From b9e00c72611ffbb5160e8733f020dea77871d721 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Jul 2016 22:43:54 -0700 Subject: [PATCH] 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 bda39b48384fce4ff5b35ff224fe6686d326e25a) --- setup.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 7c5c9ae..666a9d2 100644 --- a/setup.py +++ b/setup.py @@ -9,20 +9,20 @@ import subprocess from os import path # Get version from Git tags. -try: - version = subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip() -except Exception as e: - print('ERROR: Failed to get version from "git describe --tags": %s: %s' % (type(e).__name__, e)) +with open('VERSION', encoding='utf-8') as f: + version = f.read().strip() - with open('VERSION') as f: - fallback_version = f.read().strip() - print('Using fallback version of %r.' % fallback_version) - version = fallback_version +try: + real_version = subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip() +except Exception as e: + 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. with open('__init__.py', 'w') as f: f.write('# Automatically generated by setup.py\n') f.write('__version__ = %r\n' % version) + f.write('real_version = %r\n' % real_version) curdir = path.abspath(path.dirname(__file__))