-
Notifications
You must be signed in to change notification settings - Fork 3
/
update.py
43 lines (27 loc) · 1.04 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import subprocess
from MDmisc.egit import git_version
from MDmisc.eprint import eprint
################################################################################
def _exe( cmd, wd ):
return subprocess.Popen( cmd, cwd = wd, stdout = subprocess.PIPE, stderr = subprocess.PIPE ).communicate()
################################################################################
try:
version = git_version( describe = [ "--match", "v*" ] )[ "commit_describe" ]
except:
version = "dev"
finally:
os.chdir( os.path.split( os.path.abspath( __file__ ) )[ 0 ] )
verstring = "__version__ = '%s'" % version
with open( "TPS/version.py", "w+" ) as fp:
fp.write( verstring )
with open( "doc/version.py", "w+" ) as fp:
fp.write( verstring )
################################################################################
wd = os.path.abspath( "./doc" )
cmd = [ 'make', 'html' ]
stdout, stderr = _exe( cmd, wd )
print( stdout )
eprint( stderr )