-
Notifications
You must be signed in to change notification settings - Fork 4
/
update.py
49 lines (31 loc) · 1.22 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
44
45
46
47
48
49
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import doctester
import os
import subprocess
import unittest
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( "NIST/version.py", "w+" ) as fp:
fp.write( verstring )
with open( "doc/version.py", "w+" ) as fp:
fp.write( verstring )
################################################################################
unittest.TextTestRunner( verbosity = 2 ).run( doctester.NISTtests() )
################################################################################
wd = os.path.abspath( "./doc" )
cmd = [ 'make', 'html' ]
stdout, stderr = _exe( cmd, wd )
print( stdout )
eprint( stderr )