|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
| 3 | +import os.path |
3 | 4 | import subprocess |
4 | 5 | from distutils.core import setup |
5 | 6 |
|
6 | 7 | def getVersion(): |
7 | 8 | """getting the latest revision number from svn is a pain |
8 | 9 | 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 | + when run from an sdist build the svn data isn't found and uses the stored version instead |
10 | 11 | """ |
11 | | - svnversion = subprocess.Popen('svnversion -n', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
12 | | - REVISION = svnversion.communicate()[0] # get stdout |
| 12 | + REVISION = None |
| 13 | + if os.path.exists('.svn'): # if .svn/ doesn't even exist, don't bother running svnversion |
| 14 | + svnversion = subprocess.Popen('svnversion -n', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 15 | + REVISION = svnversion.communicate()[0] # get stdout |
| 16 | + |
13 | 17 | if not REVISION or not any([c.isdigit() for c in REVISION]): |
14 | 18 | # no numbers so assume an error |
15 | | - # likely a real user install, get version from file |
| 19 | + # but likely a real user install, so get version from file |
16 | 20 | VERSION = open('tdl/VERSION', 'r').read() |
17 | 21 | return VERSION |
18 | 22 | # building on the svn, save version in a file for user installs |
19 | 23 | if b':' in REVISION: |
20 | 24 | REVISION = REVISION.split(b':')[-1] # take "latest" revision, I think |
21 | 25 | REVISION = b''.join((c for c in REVISION if c.isdigit())) # remove letters |
22 | | - VERSION = '1.1r%s' % REVISION |
| 26 | + VERSION = '1.0r%s' % REVISION |
23 | 27 | open('tdl/VERSION', 'w').write(VERSION) |
24 | 28 | return VERSION |
25 | 29 |
|
|
0 commit comments