source: trunk/setup.py.in @ 187

Last change on this file since 187 was 187, checked in by bas, 15 years ago

New build system for rpm package, thanks to Michel Jouvin

File size: 1.5 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='@pbspath@'
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
48setup ( name = 'pbs_python',
49        version = '3.0.2',
50        description = 'openpbs/torque python interface',
51        author = 'Bas van der Vlies',
52        author_email = 'basv@sara.nl',
53        url = 'http://subtrac.sara.nl/oss/pbs_python',
54
55
56        extra_path = 'pbs',
57                package_dir = { '' : 'src' }, 
58                py_modules = [ 'pbs', 'PBSQuery' ], 
59
60        ext_modules = [ 
61                Extension( '_pbs', ['src/pbs_wrap.c'],
62                library_dirs = [ PBS_LIB_DIR ],
63                libraries = LIBS) 
64        ]
65)
Note: See TracBrowser for help on using the repository browser.