-
Notifications
You must be signed in to change notification settings - Fork 8
/
archiver.py
executable file
·38 lines (31 loc) · 1.71 KB
/
archiver.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
#!/usr/bin/env python
'''Utility script for creating a versioned .tar.gz of the documenentation and
the code for either matlab or python.
'''
import os
def callSystem(command):
print('>' + command)
ret = os.system(command)
if ret != 0:
print('Command failed, exiting')
exit(1)
version = '1.0.0'
# Ensure tests pass
callSystem('cd test;nosetests-2.7 test.py')
callSystem('cd test;python testVersionCompatibility.py')
# Re-create doc if neccesary
callSystem('cd doc;latexmk -pdf doc.tex')
include_common = ' doc README.md '
python_name = 'archive/matrix2latexPython'
include_files = 'matrix2latex setup.py' + include_common
callSystem('git archive --format=tar --prefix={name}{v}/ HEAD {include} | gzip > {name}-{v}.tar.gz'.format(name=python_name,
v=version,
include=include_files))
matlab_name = 'archive/matrix2latexMatlab'
include_files = 'src_matlab' + include_common
callSystem('git archive --format=tar --prefix={name}{v}/ HEAD {include} | gzip > {name}-{v}.tar.gz'.format(name=matlab_name,
v=version,
include=include_files))
callSystem('git add {p_name}-{v}.tar.gz {m_name}-{v}.tar.gz'.format(p_name=python_name,
m_name=matlab_name,
v=version))