File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ import os
12from setuptools import setup , Extension
23
4+ def _read_version ():
5+ # The _version.py file is generated by scripts/python/prepare_python_build.sh
6+ # We read it here to set the version statically.
7+ here = os .path .dirname (os .path .abspath (__file__ ))
8+ _version_file = os .path .join (here , 'pyvsag' , '_version.py' )
9+
10+ if os .path .exists (_version_file ):
11+ ns = {}
12+ with open (_version_file ) as f :
13+ exec (f .read (), ns )
14+ return ns .get ('__version__' )
15+ return '0.0.0'
16+
317# All other configuration is in setup.cfg / pyproject.toml.
418# This file is kept for the C-extension definition.
519setup (
20+ version = _read_version (),
621 ext_modules = [Extension ('example' , sources = ['example.c' ])],
722 zip_safe = False ,
823)
Original file line number Diff line number Diff line change @@ -25,7 +25,16 @@ pip install -q setuptools_scm
2525echo " - Generating python/pyvsag/_version.py..."
2626python3 -c "
2727import setuptools_scm
28- version = setuptools_scm.get_version()
28+ try:
29+ # Explicitly configure setuptools_scm since pyproject.toml is in a subdir
30+ version = setuptools_scm.get_version(
31+ root='.',
32+ version_scheme='release-branch-semver',
33+ local_scheme='no-local-version'
34+ )
35+ except Exception:
36+ version = '0.0.0'
37+
2938with open('python/pyvsag/_version.py', 'w') as f:
3039 f.write(f'__version__ = \" {version}\"\\ n')
3140print(f' - Version generated: {version}')
You can’t perform that action at this time.
0 commit comments