source:
sasview/build_tools/get_version.py
@
d8c4019
Last change on this file since d8c4019 was 3a39c2e, checked in by krzywon, 10 years ago | |
---|---|
|
|
File size: 839 bytes |
Rev | Line | |
---|---|---|
[8d2f5bb] | 1 | import os |
[0cbdaf0] | 2 | __revision__ = "0" |
[ee1e4b20] | 3 | __version__ = "0.0.0" |
[e0c830a] | 4 | |
[5709051] | 5 | import subprocess |
[e0c830a] | 6 | |
[5709051] | 7 | def get_svn_revision(): |
8 | p = subprocess.Popen("svnversion", shell=True, \ | |
9 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
10 | (stdout, stderr) = p.communicate() | |
11 | try: | |
12 | rev = int(stdout.strip()) | |
13 | return str(rev) | |
14 | except: | |
15 | return __revision__ | |
[e0c830a] | 16 | |
[3a39c2e] | 17 | # Get the version number from the sasview module |
[0cbdaf0] | 18 | # Check to see if we are dealing with a release |
19 | try: | |
[3a39c2e] | 20 | import sas.sasview |
21 | __version__ = sas.sasview.__version__ | |
22 | __revision__ = sas.sasview.__build__ | |
[0cbdaf0] | 23 | except: |
[3a39c2e] | 24 | print "Could not load sasview module" |
[0cbdaf0] | 25 | |
[e0c830a] | 26 | # Get actual revision number if possible |
27 | try: | |
28 | rev = get_svn_revision() | |
29 | if rev is not None: | |
30 | __revision__ = rev | |
31 | except: | |
32 | print "Could not extract revision number" | |
33 | ||
[0cbdaf0] | 34 | |
[5709051] | 35 | print "SasView v", __version__, __revision__ |
Note: See TracBrowser
for help on using the repository browser.