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 | # Try some usefule defaults if not set |
---|
14 | # |
---|
15 | PBS_LIB_DIR='@pbspath@' |
---|
16 | NEW_BUILD_SYSTEM=1 |
---|
17 | |
---|
18 | if not PBS_LIB_DIR: |
---|
19 | for dir in ['/usr/lib', '/usr/local/lib', '/opt/pbs/usr/lib', '/usr/lib/torque', '/opt/pbs/lib', '/opt/torque/lib' ]: |
---|
20 | dummy_new = os.path.join(dir, 'libtorque.so') |
---|
21 | dummy_old = os.path.join(dir, 'libpbs.a') |
---|
22 | if os.path.exists(dummy_new): |
---|
23 | PBS_LIB_DIR=dir |
---|
24 | break |
---|
25 | elif os.path.exists(dummy_old): |
---|
26 | PBS_LIB_DIR=dir |
---|
27 | NEW_BUILD_SYSTEM=0 |
---|
28 | break |
---|
29 | |
---|
30 | if not PBS_LIB_DIR: |
---|
31 | print 'Please specify where the PBS libraries are!!' |
---|
32 | print 'edit setup.py and fill in the PBS_LIB_DIR variable' |
---|
33 | sys.exit(1) |
---|
34 | |
---|
35 | # Test if we have all the libs: |
---|
36 | # |
---|
37 | if NEW_BUILD_SYSTEM: |
---|
38 | LIBS = ['torque'] |
---|
39 | else: |
---|
40 | LIBS = ['log', 'net', 'pbs'] |
---|
41 | for lib in LIBS: |
---|
42 | library = 'lib%s.a' %(lib) |
---|
43 | dummy = os.path.join(PBS_LIB_DIR, library) |
---|
44 | if not os.path.exists(dummy): |
---|
45 | print 'You need to install "%s" in %s' %(library, PBS_LIB_DIR) |
---|
46 | sys.exit(1) |
---|
47 | |
---|
48 | setup ( name = 'pbs_python', |
---|
49 | version = '2.9.0', |
---|
50 | description = 'openpbs/torque python interface', |
---|
51 | author = 'Bas van der Vlies', |
---|
52 | author_email = 'basv@sara.nl', |
---|
53 | url = 'http://www.sara.nl/index_eng.html', |
---|
54 | |
---|
55 | extra_path = 'pbs', |
---|
56 | package_dir = { '' : 'src' }, |
---|
57 | py_modules = [ 'pbs', 'PBSQuery' ], |
---|
58 | |
---|
59 | ext_modules = [ |
---|
60 | Extension( '_pbs', ['src/pbs_wrap.c'], |
---|
61 | library_dirs = [ PBS_LIB_DIR ], |
---|
62 | libraries = LIBS) |
---|
63 | ] |
---|
64 | ) |
---|