|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | | -REVISION = int(''.join(c for c in "$Rev$" if c.isdigit())) |
4 | | -VERSION = '1.0r%i' % REVISION |
| 3 | +import subprocess |
| 4 | +from distutils.core import setup |
5 | 5 |
|
6 | | -try: |
7 | | - from setuptools import setup |
8 | | -except ImportError: |
9 | | - print('This module will use setuptools if available.') |
10 | | - from distutils.core import setup |
| 6 | +def getVersion(): |
| 7 | + """getting the latest revision number from svn is a pain |
| 8 | + when setup.py is run this function is called and sets up the tdl/VERSION file |
| 9 | + when run from an sdist build the svn isn't found and uses the stored version instead |
| 10 | + """ |
| 11 | + svnversion = subprocess.Popen('svnversion -n', shell=True, stdout=subprocess.PIPE) |
| 12 | + REVISION = svnversion.communicate()[0] # get stdout |
| 13 | + if REVISION == 'Unversioned directory' or REVISION is None: |
| 14 | + # a real user install, get version from file |
| 15 | + VERSION = open('tdl/VERSION', 'r').read() |
| 16 | + return VERSION |
| 17 | + # building on the svn, save version in a file for user installs |
| 18 | + if ':' in REVISION: |
| 19 | + REVISION = REVISION.split(':')[-1] # take "latest" revision, I think |
| 20 | + REVISION = ''.join((c for c in REVISION if c.isdigit())) # remove letters |
| 21 | + VERSION = '1.0r%s' % REVISION |
| 22 | + open('tdl/VERSION', 'w').write(VERSION) |
| 23 | + return VERSION |
| 24 | + |
| 25 | +VERSION = getVersion() |
| 26 | +print('TDL version is %s' % VERSION) |
11 | 27 |
|
12 | 28 | setup(name='tdl', |
13 | 29 | version=VERSION, |
|
22 | 38 | url='http://4b796c65.googlepages.com/tdl', |
23 | 39 | download_url='https://launchpad.net/rlu/+download', |
24 | 40 | packages=['tdl'], |
25 | | - #package_dir={'tdl': 'tdl'}, |
26 | 41 | package_data={'tdl': ['lib/*.txt', '*.bmp', '*.png', 'lib/linux*/*.so', 'lib/win32/*.dll', 'lib/darwin/*']}, |
27 | | - include_package_data=True, |
28 | | - install_requires=['setuptools'], |
29 | 42 | classifiers=['Development Status :: 4 - Beta', |
30 | 43 | 'Programming Language :: Python', |
31 | 44 | 'Environment :: Win32 (MS Windows)', |
|
48 | 61 | 'Programming Language :: Python :: 3.1', |
49 | 62 | ], |
50 | 63 | keywords = 'roguelike roguelikes console text curses doryen ascii', |
51 | | - zip_safe=True, |
52 | 64 | ) |
0 commit comments