[95] | 1 | #!/usr/bin/env python |
---|
| 2 | # |
---|
| 3 | # $Id: setup.py 434 2005-11-04 15:02:07Z bas $ |
---|
[110] | 4 | # |
---|
| 5 | # set ts=4 |
---|
| 6 | # |
---|
[95] | 7 | |
---|
| 8 | import sys |
---|
| 9 | import os |
---|
| 10 | |
---|
| 11 | from distutils.core import setup, Extension |
---|
| 12 | |
---|
[230] | 13 | # Strip off the -L it is also added by the python setup tools |
---|
[97] | 14 | # |
---|
[236] | 15 | PBS_LIB_COMPILE_LINE='@pbs_library_compile_line@' |
---|
[216] | 16 | PBS_LIB_DIR='@pbs_library_dir@' |
---|
[110] | 17 | |
---|
[95] | 18 | if not PBS_LIB_DIR: |
---|
[290] | 19 | print 'Please specify where the PBS libraries are!!' |
---|
| 20 | print 'edit setup.py and fill in the PBS_LIB_DIR variable' |
---|
| 21 | sys.exit(1) |
---|
[95] | 22 | |
---|
[221] | 23 | LIBS = ['torque'] |
---|
[95] | 24 | |
---|
[215] | 25 | ### Make symlinks to right torque version |
---|
| 26 | # |
---|
[216] | 27 | VERSION = "@pbs_version@" |
---|
| 28 | tmp = VERSION.split('.') |
---|
[215] | 29 | |
---|
[237] | 30 | major_version = int(tmp[0]) |
---|
| 31 | minor_version = int(tmp[1]) |
---|
[244] | 32 | #build_version = int(tmp[2]) |
---|
| 33 | build_version = int(tmp[2].split('-')[0]) |
---|
[216] | 34 | |
---|
[244] | 35 | |
---|
[216] | 36 | os.chdir('src') |
---|
| 37 | |
---|
| 38 | ## Always unlink previous links |
---|
| 39 | # |
---|
| 40 | try: |
---|
[290] | 41 | os.unlink('pbs.py') |
---|
| 42 | os.unlink('pbs_wrap.c') |
---|
[216] | 43 | except OSError: |
---|
[290] | 44 | pass |
---|
[216] | 45 | |
---|
[237] | 46 | if major_version >= 2 and minor_version >= 4 and build_version >= 7: |
---|
[290] | 47 | os.symlink('pbs_wrap_2.4.c', 'pbs_wrap.c') |
---|
| 48 | os.symlink('pbs_2.4.py', 'pbs.py') |
---|
| 49 | TORQUE_VERSION='TORQUE_2_4' |
---|
[216] | 50 | else: |
---|
[290] | 51 | os.symlink('pbs_wrap_2.1.c', 'pbs_wrap.c') |
---|
| 52 | os.symlink('pbs_2.1.py', 'pbs.py') |
---|
| 53 | TORQUE_VERSION='TORQUE_OLD' |
---|
[218] | 54 | |
---|
[216] | 55 | os.chdir('..') |
---|
| 56 | |
---|
[241] | 57 | setup ( |
---|
[290] | 58 | name = 'pbs_python', |
---|
| 59 | version = '4.3.5', |
---|
| 60 | description = 'openpbs/torque python interface', |
---|
| 61 | license = 'LGPLV3', |
---|
| 62 | author = 'Bas van der Vlies', |
---|
| 63 | author_email = 'bas.vandervlies@surfsara.nl', |
---|
| 64 | url = 'http://oss.trac.surfsara.nl/pbs_python', |
---|
[95] | 65 | |
---|
[173] | 66 | |
---|
[290] | 67 | extra_path = 'pbs', |
---|
| 68 | package_dir = { '' : 'src' }, |
---|
| 69 | py_modules = [ 'pbs', 'PBSQuery', 'PBSAdvancedParser' ], |
---|
[95] | 70 | |
---|
[290] | 71 | ext_modules = [ |
---|
| 72 | Extension( '_pbs', ['src/pbs_wrap.c'], |
---|
| 73 | library_dirs = [ PBS_LIB_DIR ], |
---|
| 74 | extra_link_args = [ PBS_LIB_COMPILE_LINE ], |
---|
| 75 | define_macros = [ (TORQUE_VERSION, None) ], |
---|
| 76 | libraries = LIBS, |
---|
| 77 | ) |
---|
| 78 | ] |
---|
[95] | 79 | ) |
---|