source: trunk/setup.py.in @ 216

Last change on this file since 216 was 216, checked in by bas, 14 years ago

New configure options to determine version and where the libs are installed, borrowed from mpiexec

File size: 1.9 KB
Line 
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
8import sys
9import os
10
11from distutils.core import setup, Extension
12
13# Try some usefule defaults if not set
14#
15PBS_LIB_DIR='@pbs_library_dir@'
16NEW_BUILD_SYSTEM=1
17
18if 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
30if 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#
37if NEW_BUILD_SYSTEM:
38        LIBS = ['torque']
39else:
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### Make symlinks to right torque version
49#
50VERSION = "@pbs_version@"
51tmp = VERSION.split('.')
52major_version = '.'.join( tmp[0:2] )
53
54
55
56os.chdir('src')
57
58## Always unlink previous links
59#
60try:
61        os.unlink('pbs.py')
62        os.unlink('pbs_wrap.c')
63except OSError:
64        pass
65
66if major_version in [ '2.3', '2.4']:
67        os.symlink('pbs_wrap_2.4.c', 'pbs_wrap.c')
68        os.symlink('pbs_2.4.py', 'pbs.py')
69else:
70        os.symlink('pbs_wrap_2.1.c', 'pbs_wrap.c')
71        os.symlink('pbs_2.1.py', 'pbs.py')
72os.chdir('..')
73
74setup ( name = 'pbs_python',
75        version = '3.8.0',
76        description = 'openpbs/torque python interface',
77        author = 'Bas van der Vlies',
78        author_email = 'basv@sara.nl',
79        url = 'http://subtrac.sara.nl/oss/pbs_python',
80
81
82        extra_path = 'pbs',
83                package_dir = { '' : 'src' }, 
84                py_modules = [ 'pbs', 'PBSQuery' ], 
85
86        ext_modules = [ 
87                Extension( '_pbs', ['src/pbs_wrap.c'],
88                library_dirs = [ PBS_LIB_DIR ],
89                libraries = LIBS) 
90        ]
91)
Note: See TracBrowser for help on using the repository browser.