mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
setup: unconditionally write __init__.py; mark builds with unretrievable version as -dirty
Ref #259.
This commit is contained in:
parent
a9a6c22044
commit
7c5b87f4d2
14
setup.py
14
setup.py
@ -11,14 +11,18 @@ try:
|
||||
except Exception as e:
|
||||
print('ERROR: Failed to get version from "git describe --tags": %s: %s' % (type(e).__name__, e))
|
||||
from __init__ import __version__ as fallback_version
|
||||
|
||||
# Mark builds with unretrievable version (GitHub tarballs, etc.) as -dirty
|
||||
if not fallback_version.endswith('-dirty'):
|
||||
fallback_version += '-dirty'
|
||||
|
||||
print('Using fallback version of %r.' % fallback_version)
|
||||
version = fallback_version
|
||||
|
||||
else:
|
||||
# Success. Write the version to disk.
|
||||
with open('__init__.py', 'w') as f:
|
||||
f.write('# Automatically generated by setup.py\n')
|
||||
f.write('__version__ = %r\n' % version)
|
||||
# Write the version to disk.
|
||||
with open('__init__.py', 'w') as f:
|
||||
f.write('# Automatically generated by setup.py\n')
|
||||
f.write('__version__ = %r\n' % version)
|
||||
|
||||
curdir = path.abspath(path.dirname(__file__))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user