forked from bluebird75/luaunit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_release.py
72 lines (60 loc) · 2.06 KB
/
make_release.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import subprocess, sys, os, shutil, os.path
VERSION='1.5'
RELEASE_NAME='luaunit-%s' % VERSION
RELEASE_DIR='release/' + RELEASE_NAME + '/'
TARGET_ZIP=RELEASE_NAME + '.zip'
TARGET_TGZ=RELEASE_NAME + '.tgz'
REPO_PATH='d:/work/luaunit/luaunit-git/luaunit/'
LUA50='d:/program/lua/lua50/lua50.exe'
LUA51='d:/program/lua/lua51/lua51.exe'
LUA52='d:/program/lua/lua52/lua52.exe'
ALL_LUA = (
(LUA52, 'lua 5.2'),
(LUA51, 'lua 5.1'),
# (LUA50, 'lua 5.0'),
)
os.environ["nodosfilewarning"] = "1"
def report( s ):
print '[[[[[[[[[[[[[ %s ]]]]]]]]]]]]]' % s
def run_tests():
'''Run tests with all versions of lua'''
for lua, luaversion in ALL_LUA:
report( 'Running tests with %s' % luaversion )
retcode = subprocess.call( [lua, 'test_luaunit.lua'] )
if retcode != 0:
report( 'Invalid retcode when running tests: %d' % retcode )
sys.exit( retcode )
report( 'All tests succeed!' )
def run_example():
for lua, luaversion in ALL_LUA:
report( 'Running examples with %s' % luaversion )
retcode = subprocess.call( [lua, 'example_with_luaunit.lua'] )
if retcode != 6:
report( 'Invalid retcode when running examples: %d' % retcode )
sys.exit( retcode )
report( 'All examples ran!' )
def packageit():
shutil.rmtree('release', True)
try:
os.mkdir('release')
except OSError:
pass
subprocess.check_call(['c:/Program Files/Git/bin/git.exe', 'clone', '--no-hardlinks', REPO_PATH, RELEASE_DIR])
os.chdir( RELEASE_DIR )
shutil.rmtree('.git')
os.unlink('.gitignore')
run_tests()
run_example()
os.chdir('..')
report('Start packaging')
shutil.make_archive(RELEASE_NAME, 'zip', root_dir='.', base_dir=RELEASE_NAME )
shutil.make_archive(RELEASE_NAME, 'gztar', root_dir='.', base_dir=RELEASE_NAME )
report('Zip and tgz ready!')
if __name__ == '__main__':
# run_tests()
# run_example()
packageit()
# git checkout
# store version number
# generate zip and tgz
# run example with several versions of lua, check return value