Skip to content

Commit 2b61ef3

Browse files
4B796C65@gmail.com4B796C65@gmail.com
authored andcommitted
Set up an elaborate script to make versioning work correctly.
1 parent 3440e8c commit 2b61ef3

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include *.bat
33
include tdl/*.bmp
44
include tdl/*.png
55
include tdl/*.txt
6+
include tdl/VERSION
67
include tdl/lib/*.txt
78
include tdl/linux*/*.so
89
include tdl/win32/*.dll

setup.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
#!/usr/bin/env python
22

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
55

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)
1127

1228
setup(name='tdl',
1329
version=VERSION,
@@ -22,10 +38,7 @@
2238
url='http://4b796c65.googlepages.com/tdl',
2339
download_url='https://launchpad.net/rlu/+download',
2440
packages=['tdl'],
25-
#package_dir={'tdl': 'tdl'},
2641
package_data={'tdl': ['lib/*.txt', '*.bmp', '*.png', 'lib/linux*/*.so', 'lib/win32/*.dll', 'lib/darwin/*']},
27-
include_package_data=True,
28-
install_requires=['setuptools'],
2942
classifiers=['Development Status :: 4 - Beta',
3043
'Programming Language :: Python',
3144
'Environment :: Win32 (MS Windows)',
@@ -48,5 +61,4 @@
4861
'Programming Language :: Python :: 3.1',
4962
],
5063
keywords = 'roguelike roguelikes console text curses doryen ascii',
51-
zip_safe=True,
5264
)

tdl/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0r7

0 commit comments

Comments
 (0)