source: trunk/setup.py.in @ 347

Last change on this file since 347 was 347, checked in by dennis, 9 years ago

Bumped up version number

File size: 2.7 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
10import glob
11
12from distutils.core import setup, Extension
13from distutils.version import LooseVersion
14
15# Strip off the -L it is also added by the python setup tools
16#
17PBS_LIB_COMPILE_LINE='@pbs_library_compile_line@'
18PBS_LIB_DIR='@pbs_library_dir@'
19
20if not PBS_LIB_DIR:
21    print 'Please specify where the PBS libraries are!!'
22    print 'edit setup.py and fill in the PBS_LIB_DIR variable'
23    sys.exit(1)
24
25LIBS = ['torque']
26
27VERSION = "@pbs_version@"
28SOURCE_DIR='src'
29
30os.chdir(SOURCE_DIR)
31
32try:
33    os.unlink('pbs.py')
34except OSError:
35    pass
36
37if LooseVersion(VERSION) >= LooseVersion('5.0'):
38
39    inc=os.environ.get('PBS_PYTHON_INCLUDEDIR','/usr/include/torque')
40    os.environ['CC']='g++'
41    os.environ['CFLAGS']=' '.join(os.environ.get('CFLAGS','').split(' ')+['-I%s'%inc])
42   
43    if not os.path.exists(os.path.join(inc,'log.h')):
44        print 'Failed to find log.h in include dir %s. (Set include dir via PBS_PYTHON_INCLUDEDIR variable)'%inc
45        sys.exit(2)
46 
47    for fn in glob.glob('*.h'):
48        os.remove(fn)
49     
50    TORQUE_VERSION='TORQUE_5'
51    SOURCE_FILE='src/5.x/pbs_wrap.cxx'
52
53    os.symlink('5.x/pbs.py', 'pbs.py')
54
55elif LooseVersion(VERSION) >= LooseVersion('4.2'):
56
57    inc=os.environ.get('PBS_PYTHON_INCLUDEDIR','/usr/include/torque')
58    os.environ['CC']='g++'
59    os.environ['CFLAGS']=' '.join(os.environ.get('CFLAGS','').split(' ')+['-I%s'%inc])
60   
61    if not os.path.exists(os.path.join(inc,'log.h')):
62        print 'Failed to find log.h in include dir %s. (Set include dir via PBS_PYTHON_INCLUDEDIR variable)'%inc
63        sys.exit(2)
64 
65    for fn in glob.glob('*.h'):
66        os.remove(fn)
67     
68    TORQUE_VERSION='TORQUE_4'
69    SOURCE_FILE='src/C++/pbs_wrap.cxx'
70
71    os.symlink('C++/pbs.py', 'pbs.py')
72
73elif LooseVersion(VERSION) >= LooseVersion('2.4'):
74
75    TORQUE_VERSION='TORQUE_2'
76    SOURCE_FILE='src/C/pbs_wrap.c'
77
78    os.symlink('C/pbs.py', 'pbs.py')
79
80else:
81
82    print "Version: %s is not supported" %(VERSION)
83    sys.exit(1)
84
85
86os.chdir('..')
87
88setup ( 
89    name = 'pbs_python',
90    version = '4.6.1',
91    description = 'openpbs/torque python interface',
92    license = 'LGPLV3',
93    author = 'Bas van der Vlies',
94    author_email = 'bas.vandervlies@surfsara.nl',
95    url = 'http://oss.trac.surfsara.nl/pbs_python',
96
97
98    extra_path = 'pbs',
99        package_dir = { '' : SOURCE_DIR }, 
100        py_modules = [ 'pbs',  'PBSQuery'], 
101
102    ext_modules = [ 
103        Extension( '_pbs', [SOURCE_FILE],
104        library_dirs = [ PBS_LIB_DIR ],
105        extra_link_args = [ PBS_LIB_COMPILE_LINE ],
106        define_macros =  [ (TORQUE_VERSION, None) ],
107        libraries = LIBS,
108        ) 
109    ]
110)
Note: See TracBrowser for help on using the repository browser.