Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cleanup old codegen related code #3545

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/contributing/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Following is a list of environment variables that can be set to control various
- Specifies the Docker image name while starting a Fluent container in :func:`launch_fluent() <ansys.fluent.core.launcher.launcher.launch_fluent>`.
* - FLUENT_IMAGE_TAG
- Specifies the Docker image tag while starting a Fluent container in :func:`launch_fluent() <ansys.fluent.core.launcher.launcher.launch_fluent>`.
* - PYFLUENT_CODEGEN_OUTDIR
- Specifies the directory where API files are written out during codegen.
* - PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS
- Skips the generation of built-in settings during codegen.
* - PYFLUENT_CONTAINER_MOUNT_SOURCE
Expand Down
9 changes: 4 additions & 5 deletions src/ansys/fluent/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ def version_info() -> str:
# Whether to use remote gRPC file transfer service
USE_FILE_TRANSFER_SERVICE = False

# Directory where API files are writes out during codegen
CODEGEN_OUTDIR = (Path(__file__) / ".." / "generated").resolve()

# Whether to zip settings API files during codegen
CODEGEN_ZIP_SETTINGS = os.getenv("PYFLUENT_CODEGEN_ZIP_SETTINGS", False)
# Directory where API files are written out during codegen
CODEGEN_OUTDIR = os.getenv(
"PYFLUENT_CODEGEN_OUTDIR", (Path(__file__) / ".." / "generated").resolve()
)

# Whether to show mesh in Fluent after case read
FLUENT_SHOW_MESH_AFTER_CASE_READ = False
Expand Down
3 changes: 0 additions & 3 deletions src/ansys/fluent/core/codegen/allapigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ def generate(version: str, static_infos: dict):
api_tree = {"<meshing_session>": {}, "<solver_session>": {}}
_update_first_level(api_tree, tuigen.generate(version, static_infos))
_update_first_level(api_tree, datamodelgen.generate(version, static_infos))
if os.getenv("PYFLUENT_USE_OLD_SETTINGSGEN") == "1":
global settingsgen
from ansys.fluent.core.codegen import settingsgen_old as settingsgen
_update_first_level(api_tree, settingsgen.generate(version, static_infos))
api_tree_file = get_api_tree_file_name(version)
Path(api_tree_file).parent.mkdir(parents=True, exist_ok=True)
Expand Down
25 changes: 5 additions & 20 deletions src/ansys/fluent/core/codegen/builtin_settingsgen.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""Generate builtin setting classes."""

import os
from zipimport import zipimporter

from ansys.fluent.core import CODEGEN_OUTDIR, FluentVersion
from ansys.fluent.core.solver.flobject import CreatableNamedObjectMixin, NamedObject
from ansys.fluent.core.solver.settings_builtin_data import DATA
Expand All @@ -12,24 +9,12 @@


def _get_settings_root(version: str):
from ansys.fluent.core import CODEGEN_OUTDIR, CODEGEN_ZIP_SETTINGS, utils
from ansys.fluent.core import CODEGEN_OUTDIR, utils

if os.getenv("PYFLUENT_USE_OLD_SETTINGSGEN") != "1":
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
)
else:
if CODEGEN_ZIP_SETTINGS:
importer = zipimporter(
str(CODEGEN_OUTDIR / "solver" / f"settings_{version}.zip")
)
settings = importer.load_module("settings")
else:
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}" / "__init__.py",
)
settings = utils.load_module(
f"settings_{version}",
CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
)
return settings.root


Expand Down
Loading
Loading