File: make_mocks.py

package info (click to toggle)
mockobjects 0.09-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 1,784 kB
  • ctags: 5,275
  • sloc: java: 18,051; xml: 363; makefile: 43; sh: 32; python: 27
file content (37 lines) | stat: -rwxr-xr-x 821 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/python2

import os, shutil

libdir = 'lib'
junitlib = libdir+'/junit.jar'
antcmd = 'ant'

if os.environ.has_key('ANT_HOME'):
	anthome=os.environ('ANT_HOME')
else:
	anthome='/opt/ant'

def ante(target, javahome, options):
	ENV={
		'PATH': javahome + '/bin:' + anthome + '/bin:' + os.environ['PATH'],
		'JAVA_HOME': javahome
	}
	target = antcmd+options+' ' + target 
	print '###############################################'
	print ENV
	print '###############################################'
	os.spawnvpe(os.P_WAIT, antcmd, target.split(), ENV)
	print '###############################################'

def ant(target):
	ante(target, os.environ['JAVA_HOME'], '')

def build(env):
	args = env.strip().split(':')
	ante(args[0], args[1], args[2])


ant('clean')

for env in file('env.txt').readlines():
	build(env)