[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 | # |
---|
[216] | 15 | PBS_LIB_DIR='@pbs_library_dir@' |
---|
[230] | 16 | if PBS_LIB_DIR.startswith('-L'): |
---|
| 17 | PBS_LIB_DIR=PBS_LIB_DIR[2:] |
---|
[110] | 18 | |
---|
[95] | 19 | if not PBS_LIB_DIR: |
---|
[110] | 20 | print 'Please specify where the PBS libraries are!!' |
---|
| 21 | print 'edit setup.py and fill in the PBS_LIB_DIR variable' |
---|
| 22 | sys.exit(1) |
---|
[95] | 23 | |
---|
| 24 | # Test if we have all the libs: |
---|
| 25 | # |
---|
[221] | 26 | LIBS = ['torque'] |
---|
[95] | 27 | |
---|
[215] | 28 | ### Make symlinks to right torque version |
---|
| 29 | # |
---|
[216] | 30 | VERSION = "@pbs_version@" |
---|
| 31 | tmp = VERSION.split('.') |
---|
| 32 | major_version = '.'.join( tmp[0:2] ) |
---|
[215] | 33 | |
---|
[216] | 34 | |
---|
| 35 | os.chdir('src') |
---|
| 36 | |
---|
| 37 | ## Always unlink previous links |
---|
| 38 | # |
---|
| 39 | try: |
---|
| 40 | os.unlink('pbs.py') |
---|
| 41 | os.unlink('pbs_wrap.c') |
---|
| 42 | except OSError: |
---|
| 43 | pass |
---|
| 44 | |
---|
[222] | 45 | if major_version in [ '2.4' ]: |
---|
[216] | 46 | os.symlink('pbs_wrap_2.4.c', 'pbs_wrap.c') |
---|
| 47 | os.symlink('pbs_2.4.py', 'pbs.py') |
---|
[224] | 48 | TORQUE_VERSION='TORQUE_2_4' |
---|
[216] | 49 | else: |
---|
| 50 | os.symlink('pbs_wrap_2.1.c', 'pbs_wrap.c') |
---|
| 51 | os.symlink('pbs_2.1.py', 'pbs.py') |
---|
[224] | 52 | TORQUE_VERSION='TORQUE_OLD' |
---|
[218] | 53 | |
---|
[216] | 54 | os.chdir('..') |
---|
| 55 | |
---|
[95] | 56 | setup ( name = 'pbs_python', |
---|
[218] | 57 | version = '4.0.0', |
---|
[95] | 58 | description = 'openpbs/torque python interface', |
---|
| 59 | author = 'Bas van der Vlies', |
---|
| 60 | author_email = 'basv@sara.nl', |
---|
[173] | 61 | url = 'http://subtrac.sara.nl/oss/pbs_python', |
---|
[95] | 62 | |
---|
[173] | 63 | |
---|
[95] | 64 | extra_path = 'pbs', |
---|
[110] | 65 | package_dir = { '' : 'src' }, |
---|
| 66 | py_modules = [ 'pbs', 'PBSQuery' ], |
---|
[95] | 67 | |
---|
| 68 | ext_modules = [ |
---|
[110] | 69 | Extension( '_pbs', ['src/pbs_wrap.c'], |
---|
[221] | 70 | library_dirs = [ PBS_LIB_DIR ], |
---|
[233] | 71 | define_macros = [ (TORQUE_VERSION, None) ], |
---|
| 72 | libraries = LIBS, |
---|
| 73 | ) |
---|
[95] | 74 | ] |
---|
| 75 | ) |
---|