1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-07 12:31:54 +01:00

setup.py: Use version_helper to generate devlib version

Instead of parsing the text of the file to extract the current version
use the version_helper to access the newly added version tuple.
This commit is contained in:
Marc Bonnici
2019-02-20 14:05:32 +00:00
committed by setrofim
parent 441eea9897
commit c0d8a98d90
2 changed files with 10 additions and 19 deletions

View File

@@ -41,23 +41,13 @@ except OSError:
pass
with open(os.path.join(devlib_dir, '__init__.py')) as fh:
# Extract the version by parsing the text of the file,
# as may not be able to load as a module yet.
for line in fh:
if '__version__' in line:
parts = line.split("'")
__version__ = parts[1]
break
else:
raise RuntimeError('Did not see __version__')
vh_path = os.path.join(devlib_dir, 'utils', 'version.py')
# can load this, as it does not have any devlib imports
version_helper = imp.load_source('version_helper', vh_path)
commit = version_helper.get_commit()
if commit:
__version__ = '{}+{}'.format(__version__, commit)
vh_path = os.path.join(devlib_dir, 'utils', 'version.py')
# can load this, as it does not have any devlib imports
version_helper = imp.load_source('version_helper', vh_path)
__version__ = version_helper.get_devlib_version()
commit = version_helper.get_commit()
if commit:
__version__ = '{}+{}'.format(__version__, commit)
packages = []