mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 10:10:46 +00: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:
parent
441eea9897
commit
c0d8a98d90
@ -53,10 +53,11 @@ from devlib.host import LocalConnection
|
|||||||
from devlib.utils.android import AdbConnection
|
from devlib.utils.android import AdbConnection
|
||||||
from devlib.utils.ssh import SshConnection, TelnetConnection, Gem5Connection
|
from devlib.utils.ssh import SshConnection, TelnetConnection, Gem5Connection
|
||||||
|
|
||||||
from devlib.utils.version import get_devlib_version, get_commit as __get_commit
|
from devlib.utils.version import (get_devlib_version as __get_devlib_version,
|
||||||
|
get_commit as __get_commit)
|
||||||
|
|
||||||
|
|
||||||
__version__ = get_devlib_version()
|
__version__ = __get_devlib_version()
|
||||||
|
|
||||||
__commit = __get_commit()
|
__commit = __get_commit()
|
||||||
if __commit:
|
if __commit:
|
||||||
|
22
setup.py
22
setup.py
@ -41,22 +41,12 @@ except OSError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
with open(os.path.join(devlib_dir, '__init__.py')) as fh:
|
vh_path = os.path.join(devlib_dir, 'utils', 'version.py')
|
||||||
# Extract the version by parsing the text of the file,
|
# can load this, as it does not have any devlib imports
|
||||||
# as may not be able to load as a module yet.
|
version_helper = imp.load_source('version_helper', vh_path)
|
||||||
for line in fh:
|
__version__ = version_helper.get_devlib_version()
|
||||||
if '__version__' in line:
|
commit = version_helper.get_commit()
|
||||||
parts = line.split("'")
|
if commit:
|
||||||
__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)
|
__version__ = '{}+{}'.format(__version__, commit)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user