3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 04:32:51 +01:00

setup: remove rolling package versions

This makes 'reload' after commit impossible, for example, because each version is installed in a separate folder. Also, versions from 'git describe' aren't compatible with PEP 440.

(cherry picked from commit bda39b4838)
This commit is contained in:
James Lu 2016-07-23 22:43:54 -07:00
parent c8ec2d9600
commit b9e00c7261

View File

@ -9,20 +9,20 @@ import subprocess
from os import path from os import path
# Get version from Git tags. # Get version from Git tags.
try: with open('VERSION', encoding='utf-8') as f:
version = subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip() version = f.read().strip()
except Exception as e:
print('ERROR: Failed to get version from "git describe --tags": %s: %s' % (type(e).__name__, e))
with open('VERSION') as f: try:
fallback_version = f.read().strip() real_version = subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip()
print('Using fallback version of %r.' % fallback_version) except Exception as e:
version = fallback_version print('ERROR: Failed to get Git version from "git describe --tags": %s: %s' % (type(e).__name__, e))
real_version = version + '-dirty'
# Write the version to disk. # Write the version to disk.
with open('__init__.py', 'w') as f: with open('__init__.py', 'w') as f:
f.write('# Automatically generated by setup.py\n') f.write('# Automatically generated by setup.py\n')
f.write('__version__ = %r\n' % version) f.write('__version__ = %r\n' % version)
f.write('real_version = %r\n' % real_version)
curdir = path.abspath(path.dirname(__file__)) curdir = path.abspath(path.dirname(__file__))