File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3+ import subprocess
4+
35try :
46 # use setuptools or distribute if available
57 from setuptools import setup
68except ImportError :
79 from distutils .core import setup
810
11+ base_version = '1.1.6' # base version
12+ def get_version ():
13+ """Probably a much more elegant way to do this.
14+
15+ Update tdl/VERSION.txt with the current svn version, then return the result"""
16+ try :
17+ revision = subprocess .check_output ('svnversion' , universal_newlines = True )[:- 1 ]
18+ except :
19+ revision = None
20+
21+ if revision :
22+ if ':' in revision :
23+ revision = revision .split (':' )[- 1 ]
24+ if 'M' in revision :
25+ revision = revision [:- 1 ]
26+ file = open ('tdl/VERSION.txt' , 'w' )
27+ file .write (base_version + 'r' + revision )
28+ file .close ()
29+ print ('revision %s' % revision )
30+
31+ file = open ('tdl/VERSION.txt' , 'r' )
32+ version = file .read ()
33+ file .close ()
34+ return version
35+
936setup (name = 'tdl' ,
10- version = '1.1.6' ,
37+ version = get_version () ,
1138 author = 'Kyle Stewart' ,
1239 author_email = '4B796C65+pythonTDL@gmail.com' ,
1340 description = 'Pythonic port of rogue-like library libtcod.' ,
Original file line number Diff line number Diff line change 1+ 1.1.6r79
Original file line number Diff line number Diff line change @@ -1331,3 +1331,7 @@ def forceResolution(width, height):
13311331
13321332__license__ = "New BSD License"
13331333__email__ = "4b796c65+pythonTDL@gmail.com"
1334+
1335+ file = open (os .path .join (os .path .dirname (__file__ ), 'VERSION.txt' ), 'r' )
1336+ __version__ = file .read ()
1337+ file .close ()
You can’t perform that action at this time.
0 commit comments