1 | #!/usr/bin/env python |
---|
2 | # |
---|
3 | # $Id: setup.py 434 2005-11-04 15:02:07Z bas $ |
---|
4 | # |
---|
5 | # set ts=4 |
---|
6 | # |
---|
7 | |
---|
8 | import sys |
---|
9 | import os |
---|
10 | |
---|
11 | from distutils.core import setup, Extension |
---|
12 | |
---|
13 | # Strip off the -L it is also added by the python setup tools |
---|
14 | # |
---|
15 | PBS_LIB_DIR='@pbs_library_dir@' |
---|
16 | if PBS_LIB_DIR.startswith('-L'): |
---|
17 | PBS_LIB_DIR=PBS_LIB_DIR[2:] |
---|
18 | |
---|
19 | if not PBS_LIB_DIR: |
---|
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) |
---|
23 | |
---|
24 | # Test if we have all the libs: |
---|
25 | # |
---|
26 | LIBS = ['torque'] |
---|
27 | |
---|
28 | ### Make symlinks to right torque version |
---|
29 | # |
---|
30 | VERSION = "@pbs_version@" |
---|
31 | tmp = VERSION.split('.') |
---|
32 | major_version = '.'.join( tmp[0:2] ) |
---|
33 | |
---|
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 | |
---|
45 | if major_version in [ '2.4' ]: |
---|
46 | os.symlink('pbs_wrap_2.4.c', 'pbs_wrap.c') |
---|
47 | os.symlink('pbs_2.4.py', 'pbs.py') |
---|
48 | TORQUE_VERSION='TORQUE_2_4' |
---|
49 | else: |
---|
50 | os.symlink('pbs_wrap_2.1.c', 'pbs_wrap.c') |
---|
51 | os.symlink('pbs_2.1.py', 'pbs.py') |
---|
52 | TORQUE_VERSION='TORQUE_OLD' |
---|
53 | |
---|
54 | os.chdir('..') |
---|
55 | |
---|
56 | setup ( name = 'pbs_python', |
---|
57 | version = '4.0.0', |
---|
58 | description = 'openpbs/torque python interface', |
---|
59 | author = 'Bas van der Vlies', |
---|
60 | author_email = 'basv@sara.nl', |
---|
61 | url = 'http://subtrac.sara.nl/oss/pbs_python', |
---|
62 | |
---|
63 | |
---|
64 | extra_path = 'pbs', |
---|
65 | package_dir = { '' : 'src' }, |
---|
66 | py_modules = [ 'pbs', 'PBSQuery' ], |
---|
67 | |
---|
68 | ext_modules = [ |
---|
69 | Extension( '_pbs', ['src/pbs_wrap.c'], |
---|
70 | library_dirs = [ PBS_LIB_DIR ], |
---|
71 | define_macros = [ (TORQUE_VERSION, None) ]) |
---|
72 | ] |
---|
73 | ) |
---|