source: trunk/setup.py.in @ 324

Last change on this file since 324 was 316, checked in by bas, 10 years ago

Dennis Stam:

  • fixed docdir error, closes #39
  • added a new option to examples/new_rack_pbsmon.py -p/--property
  • improved the autoconf setup
File size: 2.1 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('4.2'):
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_4'
51    SOURCE_FILE='src/C++/pbs_wrap.cxx'
52
53    os.symlink('C++/pbs.py', 'pbs.py')
54
55elif LooseVersion(VERSION) >= LooseVersion('2.4'):
56
57    TORQUE_VERSION='TORQUE_2'
58    SOURCE_FILE='src/C/pbs_wrap.c'
59
60    os.symlink('C/pbs.py', 'pbs.py')
61
62else:
63
64    print "Version: %s is not supported" %(VERSION)
65    sys.exit(1)
66
67
68os.chdir('..')
69
70setup ( 
71    name = 'pbs_python',
72    version = '4.4.1',
73    description = 'openpbs/torque python interface',
74    license = 'LGPLV3',
75    author = 'Bas van der Vlies',
76    author_email = 'bas.vandervlies@surfsara.nl',
77    url = 'http://oss.trac.surfsara.nl/pbs_python',
78
79
80    extra_path = 'pbs',
81        package_dir = { '' : SOURCE_DIR }, 
82        py_modules = [ 'pbs',  'PBSQuery'], 
83
84    ext_modules = [ 
85        Extension( '_pbs', [SOURCE_FILE],
86        library_dirs = [ PBS_LIB_DIR ],
87        extra_link_args = [ PBS_LIB_COMPILE_LINE ],
88        define_macros =  [ (TORQUE_VERSION, None) ],
89        libraries = LIBS,
90        ) 
91    ]
92)
Note: See TracBrowser for help on using the repository browser.