File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,17 @@ jobs:
217217 run : pip install setuptools-scm
218218
219219 - name : Generate _version.py
220- run : python -m setuptools_scm write_version_to_file _version.py
220+ run : |
221+ python -c "import setuptools_scm; \
222+ import os; \
223+ # Get the version from setuptools_scm, using the current directory as root \
224+ # fallback_version is used if setuptools_scm cannot determine the version (e.g., no .git) \
225+ version = setuptools_scm.get_version(root='.', fallback_version='0.0.0+unknown'); \
226+ # Ensure the version string is clean for Python (remove leading 'v' if present) \
227+ if version.startswith('v'): version = version[1:]; \
228+ # Write the version to _version.py \
229+ with open('_version.py', 'w') as f: f.write(f\"__version__ = '{version}'\\n\"); \
230+ print(f\"Generated _version.py with __version__ = '{version}'\")"
221231
222232 - name : Get version from _version.py
223233 id : get_version
You can’t perform that action at this time.
0 commit comments