PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/scramble/scripts/pbs_python.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 49 lines | 46 code | 2 blank | 1 comment | 4 complexity | c29316bb1047f64b56fb432040041120 MD5 | raw file
 1import os, sys, shutil
 2
 3if "LIBTORQUE_DIR" not in os.environ:
 4    print "main(): Please set LIBTORQUE_DIR to the path of the"
 5    print "main(): directory containing libtorque.so"
 6    sys.exit(1)
 7
 8# change back to the build dir
 9if os.path.dirname( sys.argv[0] ) != "":
10    os.chdir( os.path.dirname( sys.argv[0] ) )
11
12# find setuptools
13sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
14from scramble_lib import *
15
16tag = get_tag() # get the tag
17clean() # clean up any existing stuff (could happen if you run scramble.py by hand)
18
19# the build process doesn't set an rpath for libtorque
20os.environ['LD_RUN_PATH'] = os.environ['LIBTORQUE_DIR']
21
22# run the config script
23run( 'sh configure --with-pbsdir=%s' % os.environ['LIBTORQUE_DIR'], os.getcwd(), 'Running pbs_python configure script' )
24
25# version string in 2.9.4 setup.py is wrong
26print "scramble(): Patching setup.py"
27if not os.path.exists( 'setup.py.orig' ):
28    shutil.copyfile( 'setup.py', 'setup.py.orig' )
29    i = open( 'setup.py.orig', 'r' )
30    o = open( 'setup.py', 'w' )
31    for line in i.readlines():
32        if line == "	version = '4.0.0',\n":
33            line = "	version = '4.1.0',\n"
34        print >>o, line,
35i.close()
36o.close()
37
38# reset args for distutils
39me = sys.argv[0]
40sys.argv = [ me ]
41sys.argv.append( "egg_info" )
42if tag is not None:
43    sys.argv.append( "--tag-build=%s" %tag )
44# svn revision (if any) is handled directly in tag-build
45sys.argv.append( "--no-svn-revision" )
46sys.argv.append( "bdist_egg" )
47
48# go
49execfile( "setup.py", globals(), locals() )