-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Changes to support Fluent 25.2 dev
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
Script to update the settings_builtin_data.py file with the new Fluent version. | ||
Usage: python devel/update_settings_builtin_data.py --version 252 | ||
""" | ||
|
||
import argparse | ||
from pathlib import Path | ||
|
||
from ansys.fluent.core.utils.fluent_version import FluentVersion | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--version", type=str, required=True) | ||
args = parser.parse_args() | ||
new_version = FluentVersion(args.version).name | ||
index = FluentVersion._member_names_.index(new_version) | ||
previous_version = FluentVersion._member_names_[index + 1] | ||
|
||
file_path = ( | ||
Path(__file__).parent.parent | ||
/ "src" | ||
/ "ansys" | ||
/ "fluent" | ||
/ "core" | ||
/ "solver" | ||
/ "settings_builtin_data.py" | ||
).resolve() | ||
lines = [] | ||
|
||
with open(file_path, "r") as file: | ||
for line in file: | ||
if previous_version in line: | ||
new_line = line.replace(previous_version, new_version) | ||
lines.append(new_line) | ||
lines.append(line) | ||
|
||
with open(file_path, "w") as file: | ||
file.writelines(lines) |