diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cee5b294d34..54f05cf0a6ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,6 +181,9 @@ jobs: - name: Install pyvistaqt requirements run: make install-pyvistaqt-requirements + - name: Add version information + run: make version-info + - name: Install pyfluent with post requirements run: make install-post diff --git a/Makefile b/Makefile index 0e772eae5963..66c30ed17474 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,10 @@ install: @python setup.py bdist_wheel @pip install dist/*.whl +version-info: + @bash -c "date -u +'Build date: %B %d, %Y %H:%M UTC ShaID: ' | xargs -I date sed -i 's/_VERSION_INFO = .*/_VERSION_INFO = \"date\"/g' ansys/fluent/core/__init__.py" + @bash -c "git --no-pager log -n 1 --format='%h' | xargs -I hash sed -i 's//hash/g' ansys/fluent/core/__init__.py" + install-post: @pip install -r requirements_build.txt @python setup.py sdist diff --git a/README.rst b/README.rst index 0fd3ac750678..bcfcb0032d03 100644 --- a/README.rst +++ b/README.rst @@ -98,4 +98,4 @@ to the Fluent without changing the core behavior or license of the original software. The use of the interactive Fluent control of ``PyFluent`` requires a legally licensed local copy of Ansys. -To get a copy of Ansys, please visit `Ansys `_. \ No newline at end of file +To get a copy of Ansys, please visit `Ansys `_. diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 61700fa5fe3b..dd9e84b863e5 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -18,6 +18,24 @@ except ImportError: pass +_VERSION_INFO = None +"""Global variable indicating the version of the PyFluent package - Empty by default""" + + +def version_info(): + """Method returning the version of PyFluent being used. + + Returns + ------- + str + The PyFluent version being used. + + Notes + ------- + Only available in packaged versions. Otherwise it will return __version__. + """ + return _VERSION_INFO if _VERSION_INFO is not None else __version__ + def set_log_level(level): """Set logging level.