|
1 | 1 | import os |
2 | 2 | import sys |
3 | | -import inspect |
4 | 3 |
|
5 | 4 | from setuptools import Extension, setup |
6 | 5 |
|
7 | 6 |
|
8 | | -# get current directory of file in case someone |
9 | | -# called setup.py from elsewhere |
10 | | -cwd = os.path.dirname(os.path.abspath( |
11 | | - inspect.getfile(inspect.currentframe()))) |
12 | | - |
13 | | -# load __version__ |
14 | | -exec(open(os.path.join(cwd, |
15 | | - 'fcl/version.py'), 'r').read()) |
16 | | - |
17 | | -platform_supported = False |
18 | | -for prefix in ['darwin', 'linux', 'bsd']: |
19 | | - if prefix in sys.platform: |
20 | | - platform_supported = True |
21 | | - include_dirs = ['/usr/include', |
22 | | - '/usr/local/include', |
23 | | - '/usr/include/eigen3', |
24 | | - '/usr/local/include/eigen3'] |
25 | | - lib_dirs = ['/usr/lib', |
26 | | - '/usr/local/lib'] |
27 | | - |
28 | | - if 'CPATH' in os.environ: |
29 | | - include_dirs += os.environ['CPATH'].split(':') |
30 | | - if 'LD_LIBRARY_PATH' in os.environ: |
31 | | - lib_dirs += os.environ['LD_LIBRARY_PATH'].split(':') |
32 | | - |
33 | | - try: |
34 | | - # get the numpy include path from numpy |
35 | | - import numpy |
36 | | - include_dirs.append(numpy.get_include()) |
37 | | - except: |
38 | | - pass |
39 | | - |
40 | | - break |
41 | | - |
42 | | -if sys.platform == "win32": |
| 7 | +def get_include_dirs(): |
43 | 8 | platform_supported = False |
44 | | - |
45 | | -if not platform_supported: |
| 9 | + for prefix in ['darwin', 'linux', 'bsd']: |
| 10 | + if prefix in sys.platform: |
| 11 | + platform_supported = True |
| 12 | + include_dirs = ['/usr/include', |
| 13 | + '/usr/local/include', |
| 14 | + '/usr/include/eigen3', |
| 15 | + '/usr/local/include/eigen3'] |
| 16 | + |
| 17 | + if 'CPATH' in os.environ: |
| 18 | + include_dirs += os.environ['CPATH'].split(':') |
| 19 | + |
| 20 | + break |
| 21 | + if sys.platform == "win32": |
| 22 | + platform_supported = False |
| 23 | + if not platform_supported: |
| 24 | + raise NotImplementedError(sys.platform) |
| 25 | + |
| 26 | + # get the numpy include path from numpy |
| 27 | + import numpy |
| 28 | + include_dirs.append(numpy.get_include()) |
| 29 | + return include_dirs |
| 30 | + |
| 31 | +def get_libraries_dir(): |
| 32 | + for prefix in ['darwin', 'linux', 'bsd']: |
| 33 | + if prefix in sys.platform: |
| 34 | + platform_supported = True |
| 35 | + lib_dirs = ['/usr/lib', |
| 36 | + '/usr/local/lib'] |
| 37 | + |
| 38 | + if 'LD_LIBRARY_PATH' in os.environ: |
| 39 | + lib_dirs += os.environ['LD_LIBRARY_PATH'].split(':') |
| 40 | + return lib_dirs |
46 | 41 | raise NotImplementedError(sys.platform) |
47 | 42 |
|
| 43 | + |
48 | 44 | setup( |
49 | | - name='python-fcl', |
50 | | - version=__version__, |
51 | | - description='Python bindings for the Flexible Collision Library', |
52 | | - long_description='Python bindings for the Flexible Collision Library', |
53 | | - url='https://github.com/CyrilWaechter/python-fcl', |
54 | | - author='Cyril Waechter', |
55 | | - author_email='cyrwae@hotmail.com', |
56 | | - license = "BSD", |
57 | | - classifiers=[ |
58 | | - 'Development Status :: 3 - Alpha', |
59 | | - 'License :: OSI Approved :: BSD License', |
60 | | - 'Operating System :: POSIX :: Linux', |
61 | | - 'Programming Language :: Python :: 2', |
62 | | - 'Programming Language :: Python :: 2.7', |
63 | | - 'Programming Language :: Python :: 3', |
64 | | - 'Programming Language :: Python :: 3.0', |
65 | | - 'Programming Language :: Python :: 3.1', |
66 | | - 'Programming Language :: Python :: 3.2', |
67 | | - 'Programming Language :: Python :: 3.3', |
68 | | - 'Programming Language :: Python :: 3.4', |
69 | | - 'Programming Language :: Python :: 3.5', |
70 | | - 'Programming Language :: Python :: 3.6', |
71 | | - ], |
72 | | - keywords='fcl collision distance', |
73 | | - packages=['fcl'], |
74 | | - setup_requires=['cython'], |
75 | | - install_requires=['numpy', 'cython'], |
76 | 45 | ext_modules=[Extension( |
77 | 46 | "fcl.fcl", |
78 | 47 | ["fcl/fcl.pyx"], |
79 | | - include_dirs = include_dirs, |
80 | | - library_dirs = lib_dirs, |
| 48 | + include_dirs = get_include_dirs(), |
| 49 | + library_dirs = get_libraries_dir(), |
81 | 50 | libraries=[ |
82 | 51 | "fcl","octomap" |
83 | 52 | ], |
|
0 commit comments