/scripts/scramble/scripts/pbs_python.py

https://bitbucket.org/cistrome/cistrome-harvard/ · Python · 49 lines · 32 code · 9 blank · 8 comment · 6 complexity · c29316bb1047f64b56fb432040041120 MD5 · raw file

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