From 4a01551018ab4023a0c4ae99eda372a8659300fa Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 17:12:07 +0200 Subject: [PATCH 01/24] Trial without conditional run --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cee5b294d34..60b3094986c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,18 @@ jobs: with: configDirectory: protos + - name: Generate updated last commit info + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + echo "$GITHUB_SHA" > .last-commit-info + + - name: Update last commit info in repository + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: test-room-7/action-update-file@v1 + file-path: .last-commit-info + commit-msg: Update .last-commit-info + github-token: ${{ secrets.GITHUB_TOKEN }} + test-import: name: Smoke Tests runs-on: ${{ matrix.os }} From a8cd70c83e5bd8df2d42ccbd43d8e41906df4595 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 17:16:20 +0200 Subject: [PATCH 02/24] Missing "with" --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60b3094986c4..d983fc2b19d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,7 @@ jobs: - name: Update last commit info in repository # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} uses: test-room-7/action-update-file@v1 + with: file-path: .last-commit-info commit-msg: Update .last-commit-info github-token: ${{ secrets.GITHUB_TOKEN }} From f503a16825162dedd9a577cd7b57e3bd342c9279 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 19:48:17 +0200 Subject: [PATCH 03/24] Better to unify all pre-commit operations in one place --- .github/workflows/ci.yml | 22 ++++++++-------------- .pre-commit-config.yaml | 8 ++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d983fc2b19d3..3d138e77c894 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,25 +36,19 @@ jobs: run: | pre-commit run --all-files --show-diff-on-failure + - name: Run pre-commit with last commit-info only + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + env: + GITHUB_LASTSHA: ${{ github.sha }} + run: | + pre-commit run --hook-stage manual last-commit-info + - name: Run protolint uses: plexsystems/protolint-action@v0.6.0 if: always() with: configDirectory: protos - - - name: Generate updated last commit info - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: | - echo "$GITHUB_SHA" > .last-commit-info - - - name: Update last commit info in repository - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - uses: test-room-7/action-update-file@v1 - with: - file-path: .last-commit-info - commit-msg: Update .last-commit-info - github-token: ${{ secrets.GITHUB_TOKEN }} - + test-import: name: Smoke Tests runs-on: ${{ matrix.os }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04f87ffe3874..61165e3ab51f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,3 +67,11 @@ repos: # --ignore, "D107,D105,D4", # --count, # ] + +- repo: local + hooks: + - id: last-commit-info + name: last-commit-info + entry: bash -c '$GITHUB_LASTSHA > .last-commit-info' + language: script + types: [manual] \ No newline at end of file From 50f3777bfebf5523f8b5a7c3f33294537de10c9d Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 19:53:43 +0200 Subject: [PATCH 04/24] Bug on configuration key used --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61165e3ab51f..20ae77e8e1eb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,4 +74,4 @@ repos: name: last-commit-info entry: bash -c '$GITHUB_LASTSHA > .last-commit-info' language: script - types: [manual] \ No newline at end of file + stages: [manual] \ No newline at end of file From aaf15518ab6261f5cdd8518afde12ccb381f4054 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 20:07:47 +0200 Subject: [PATCH 05/24] Bug - Add echo in command --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20ae77e8e1eb..1301b2126b11 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,6 +72,6 @@ repos: hooks: - id: last-commit-info name: last-commit-info - entry: bash -c '$GITHUB_LASTSHA > .last-commit-info' + entry: bash -c 'echo $GITHUB_LASTSHA > .last-commit-info' language: script stages: [manual] \ No newline at end of file From 6f6167eb1d31960ed68c30f04c1792651e4bdc11 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 20:13:15 +0200 Subject: [PATCH 06/24] Select files on where to apply pre-commit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d138e77c894..a0be92122b03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: env: GITHUB_LASTSHA: ${{ github.sha }} run: | - pre-commit run --hook-stage manual last-commit-info + pre-commit run --all-files --hook-stage manual last-commit-info - name: Run protolint uses: plexsystems/protolint-action@v0.6.0 From 9b5980321b5c5eec4c35b6b8b5c3d07b5b655a97 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 20:26:29 +0200 Subject: [PATCH 07/24] Remove bash -c --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1301b2126b11..301c57fb6441 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,6 +72,6 @@ repos: hooks: - id: last-commit-info name: last-commit-info - entry: bash -c 'echo $GITHUB_LASTSHA > .last-commit-info' + entry: echo $GITHUB_LASTSHA > .last-commit-info language: script stages: [manual] \ No newline at end of file From 20a4b411d5a764cf5ea43a1da44da82f0dfcfaa0 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 20:33:58 +0200 Subject: [PATCH 08/24] Bash script approach --- .ci/update_last_commit_info.sh | 2 ++ .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 .ci/update_last_commit_info.sh diff --git a/.ci/update_last_commit_info.sh b/.ci/update_last_commit_info.sh new file mode 100755 index 000000000000..030ea470bb93 --- /dev/null +++ b/.ci/update_last_commit_info.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo $GITHUB_LASTSHA > ../.last-commit-info \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 301c57fb6441..36a6d6a8acdc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,6 +72,6 @@ repos: hooks: - id: last-commit-info name: last-commit-info - entry: echo $GITHUB_LASTSHA > .last-commit-info + entry: .ci/update_last_commit_info.sh language: script stages: [manual] \ No newline at end of file From 8503a45572a468ba2178d4abe93340da6070a7da Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Thu, 7 Apr 2022 20:48:59 +0200 Subject: [PATCH 09/24] Reverting pre-commit approach... --- .ci/update_last_commit_info.sh | 2 -- .github/workflows/ci.yml | 22 ++++++++++++++-------- .pre-commit-config.yaml | 8 -------- 3 files changed, 14 insertions(+), 18 deletions(-) delete mode 100755 .ci/update_last_commit_info.sh diff --git a/.ci/update_last_commit_info.sh b/.ci/update_last_commit_info.sh deleted file mode 100755 index 030ea470bb93..000000000000 --- a/.ci/update_last_commit_info.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo $GITHUB_LASTSHA > ../.last-commit-info \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0be92122b03..c952a33d15e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,19 +36,25 @@ jobs: run: | pre-commit run --all-files --show-diff-on-failure - - name: Run pre-commit with last commit-info only - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - env: - GITHUB_LASTSHA: ${{ github.sha }} - run: | - pre-commit run --all-files --hook-stage manual last-commit-info - - name: Run protolint uses: plexsystems/protolint-action@v0.6.0 if: always() with: configDirectory: protos - + + - name: Generate updated last commit info + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + echo "$GITHUB_SHA" > .last-commit-info + - name: Update last commit info in repository + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: test-room-7/action-update-file@v1 + with: + file-path: .last-commit-info + commit-msg: Update .last-commit-info + github-token: ${{ secrets.GITHUB_TOKEN }} + + test-import: name: Smoke Tests runs-on: ${{ matrix.os }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36a6d6a8acdc..04f87ffe3874 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,11 +67,3 @@ repos: # --ignore, "D107,D105,D4", # --count, # ] - -- repo: local - hooks: - - id: last-commit-info - name: last-commit-info - entry: .ci/update_last_commit_info.sh - language: script - stages: [manual] \ No newline at end of file From ef0350582112a0eecc3bfa1f39b98d8f23812060 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 07:52:38 +0200 Subject: [PATCH 10/24] Commit to your own branch on every push - main branch is protected --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c952a33d15e8..23692453e49c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,16 +42,17 @@ jobs: with: configDirectory: protos - - name: Generate updated last commit info - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + - name: Generate updated .last-commit-info + if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }} run: | echo "$GITHUB_SHA" > .last-commit-info - - name: Update last commit info in repository - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + - name: Update .last-commit-info in repository + if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }} uses: test-room-7/action-update-file@v1 with: + branch: ${{ github.ref }} file-path: .last-commit-info - commit-msg: Update .last-commit-info + commit-msg: [skip ci] Update .last-commit-info github-token: ${{ secrets.GITHUB_TOKEN }} From 857a2d65054f34263123a133c520b55fffb61b51 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 09:09:33 +0200 Subject: [PATCH 11/24] Append last commit information to README (and thus to PKG-INFO) --- .github/workflows/ci.yml | 17 +++-------------- Makefile | 6 ++++++ README.rst | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23692453e49c..e84bd1ae9a18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,20 +42,6 @@ jobs: with: configDirectory: protos - - name: Generate updated .last-commit-info - if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }} - run: | - echo "$GITHUB_SHA" > .last-commit-info - - name: Update .last-commit-info in repository - if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }} - uses: test-room-7/action-update-file@v1 - with: - branch: ${{ github.ref }} - file-path: .last-commit-info - commit-msg: [skip ci] Update .last-commit-info - github-token: ${{ secrets.GITHUB_TOKEN }} - - test-import: name: Smoke Tests runs-on: ${{ matrix.os }} @@ -195,6 +181,9 @@ jobs: - name: Install pyvistaqt requirements run: make install-pyvistaqt-requirements + - name: Add last commit information + run: make last-commit-info + - name: Install pyfluent with post requirements run: make install-post diff --git a/Makefile b/Makefile index 0e772eae5963..56f555dca5e2 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,12 @@ install: @python setup.py bdist_wheel @pip install dist/*.whl +last-commit-info: + @bash -c "echo '' >> README.rst" + @bash -c "echo 'Last commit info' >> README.rst" + @bash -c "echo '----------------' >> README.rst" + @bash -c "git log -n 1 --format='%an <%ae> - %ad - %H' >> README.rst" + 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 `_. From a3b44c974d6d5d1df72525c313a79b9e27cff6e3 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 10:39:54 +0200 Subject: [PATCH 12/24] LAST_COMMIT Variable creation --- ansys/fluent/core/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 61700fa5fe3b..0ffb85ff1f79 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -18,6 +18,8 @@ except ImportError: pass +LAST_COMMIT = "" + def set_log_level(level): """Set logging level. From 582a6c91787179f224537f5ef7fb6252e27abc01 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 10:43:48 +0200 Subject: [PATCH 13/24] Adapt Makefile --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 56f555dca5e2..73b998a1b4ed 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,7 @@ install: @pip install dist/*.whl last-commit-info: - @bash -c "echo '' >> README.rst" - @bash -c "echo 'Last commit info' >> README.rst" - @bash -c "echo '----------------' >> README.rst" - @bash -c "git log -n 1 --format='%an <%ae> - %ad - %H' >> README.rst" + @bash -c "git --no-pager log -n 1 --format='%an <%ae> - %ad - %h' | xargs -I hash sed -i 's/LAST_COMMIT.*/LAST_COMMIT = \"hash\"/g' ansys/fluent/core/__init__.py" install-post: @pip install -r requirements_build.txt From 11e2395155626b868c653095001e655449deb32a Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 10:48:23 +0200 Subject: [PATCH 14/24] Doc for global variable --- ansys/fluent/core/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 0ffb85ff1f79..82b3042949df 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -18,6 +18,7 @@ except ImportError: pass +"""Global variable indicating the last commit information for the PyFluent package - Empty by default""" LAST_COMMIT = "" From a17aea3bd183967e992db7ca3ec250b5f5d30537 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 12:18:38 +0200 Subject: [PATCH 15/24] Modify output way - via method version_info() --- Makefile | 3 ++- ansys/fluent/core/__init__.py | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 73b998a1b4ed..72a055b131b1 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ install: @pip install dist/*.whl last-commit-info: - @bash -c "git --no-pager log -n 1 --format='%an <%ae> - %ad - %h' | xargs -I hash sed -i 's/LAST_COMMIT.*/LAST_COMMIT = \"hash\"/g' ansys/fluent/core/__init__.py" + @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 diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 82b3042949df..b5c14cf388ed 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -18,8 +18,21 @@ except ImportError: pass -"""Global variable indicating the last commit information for the PyFluent package - Empty by default""" -LAST_COMMIT = "" +"""Global variable indicating the version of the PyFluent package - Empty by default""" +__VERSION_INFO = "" + + +def version_info(): + """Method returning the version of PyFluent being used. + + NB: Only available in packaged versions. + + Returns + ------- + str + The PyFluent version being used. + """ + return __VERSION_INFO def set_log_level(level): From f985bdd5bf349b214224c9c3bdb63fa912c61f6d Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 12:20:41 +0200 Subject: [PATCH 16/24] Rename Makefile target from last-commit-info to version-info --- .github/workflows/ci.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e84bd1ae9a18..3d0f360bc171 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,7 +182,7 @@ jobs: run: make install-pyvistaqt-requirements - name: Add last commit information - run: make last-commit-info + run: make version-info - name: Install pyfluent with post requirements run: make install-post diff --git a/Makefile b/Makefile index 72a055b131b1..42ef031edd6e 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ install: @python setup.py bdist_wheel @pip install dist/*.whl -last-commit-info: +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" From 15ff2e85f642707c837b94d25edda60a8d877325 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 12:21:33 +0200 Subject: [PATCH 17/24] Missing field to adapt --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d0f360bc171..54f05cf0a6ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,7 +181,7 @@ jobs: - name: Install pyvistaqt requirements run: make install-pyvistaqt-requirements - - name: Add last commit information + - name: Add version information run: make version-info - name: Install pyfluent with post requirements From ae3efc9735137f2364a916e6ba068c358a220112 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 12:22:48 +0200 Subject: [PATCH 18/24] Single underscore for _VERSION_INFO --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 42ef031edd6e..66c30ed17474 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ install: @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 "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: From dfa4073eafadd884e081785f9c6d95a745a6e5cc Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Fri, 8 Apr 2022 12:30:57 +0200 Subject: [PATCH 19/24] Return __version__ if undefined _VERSION_INFO --- ansys/fluent/core/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index b5c14cf388ed..3fc12f82275d 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -19,20 +19,20 @@ pass """Global variable indicating the version of the PyFluent package - Empty by default""" -__VERSION_INFO = "" +_VERSION_INFO = "" def version_info(): """Method returning the version of PyFluent being used. - NB: Only available in packaged versions. + NB: Only available in packaged versions. Otherwise it will return __version__ Returns ------- str The PyFluent version being used. """ - return __VERSION_INFO + return _VERSION_INFO if _VERSION_INFO != "" else __version__ def set_log_level(level): From 919acdc2258a78d5ee401c27215f9d20512afc49 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Fri, 8 Apr 2022 13:06:29 +0200 Subject: [PATCH 20/24] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jorge Martínez <28702884+jorgepiloto@users.noreply.github.com> --- ansys/fluent/core/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 3fc12f82275d..9a9f99b86211 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -18,9 +18,8 @@ except ImportError: pass +_VERSION_INFO = None """Global variable indicating the version of the PyFluent package - Empty by default""" -_VERSION_INFO = "" - def version_info(): """Method returning the version of PyFluent being used. @@ -32,7 +31,7 @@ def version_info(): str The PyFluent version being used. """ - return _VERSION_INFO if _VERSION_INFO != "" else __version__ + return _VERSION_INFO if _VERSION_INFO is not None else __version__ def set_log_level(level): From d35ec8901c04ff86ac3e44135959355922b27487 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Fri, 8 Apr 2022 13:09:17 +0200 Subject: [PATCH 21/24] Adding extra line - style check --- ansys/fluent/core/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 9a9f99b86211..ef82ef0e8952 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -21,6 +21,7 @@ _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. From 2daa643d462f808b49b3bb13fcaa086f672bdef5 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Mon, 11 Apr 2022 09:46:09 +0200 Subject: [PATCH 22/24] Minor modification to NB statement --- ansys/fluent/core/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 9a9f99b86211..7e0a837ef9a9 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -24,7 +24,9 @@ def version_info(): """Method returning the version of PyFluent being used. - NB: Only available in packaged versions. Otherwise it will return __version__ + Notes + ------- + Only available in packaged versions. Otherwise it will return __version__. Returns ------- From e3d1ba0495ffb1b7f63d727f8768cd24142a9bc7 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Mon, 11 Apr 2022 09:47:51 +0200 Subject: [PATCH 23/24] Change location --- ansys/fluent/core/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 85964ec780aa..5c55e54aa192 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -24,15 +24,15 @@ def version_info(): """Method returning the version of PyFluent being used. - - Notes - ------- - Only available in packaged versions. Otherwise it will return __version__. - + 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__ From bf09391fad7ab10d329cdae485ca1db46869a5e2 Mon Sep 17 00:00:00 2001 From: RobPasMue Date: Mon, 11 Apr 2022 09:50:24 +0200 Subject: [PATCH 24/24] Remove spaces --- ansys/fluent/core/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansys/fluent/core/__init__.py b/ansys/fluent/core/__init__.py index 5c55e54aa192..dd9e84b863e5 100644 --- a/ansys/fluent/core/__init__.py +++ b/ansys/fluent/core/__init__.py @@ -24,12 +24,12 @@ 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__.