-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
67 lines (63 loc) · 2.93 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from distutils.core import setup, Extension
import sys
import subprocess
if sys.version_info < (3,5):
macro_list = [ ( "PYTHON_VERSION_OLDER_THREE_FIVE", "1" ) ]
else:
macro_list = [ ]
if sys.version_info < (3,0):
FileNotFoundError = OSError
singular_cflags=[]
try:
singular_library_dir = subprocess.check_output( [ "libsingular-config", "--prefix" ] )
singular_library_dir = singular_library_dir.strip()
singular_library_dir = singular_library_dir.decode( 'utf-8' )
include_dirs=[ singular_library_dir + '/include/singular', singular_library_dir + '/include' ]
library_dirs=[ singular_library_dir + '/lib' ]
singular_ldflags=['-lSingular' ]
except FileNotFoundError:
try:
try:
singular_cflags_output = subprocess.check_output( [ "pkg-config", "--cflags", "singular" ] ).strip().decode( 'utf-8' )
except:
print( "Could not find a suitable libsingular configuration. Do you have libsingular headers installed?")
exit(1)
if singular_cflags_output.find( "not found" ) == 0:
raise FileNotFoundError
singular_cflags = singular_cflags_output.split()
## pkg-config ldflags are rubbish
singular_ldflags = [ '-lsingular-Singular' ]
include_dirs = [ ]
library_dirs = [ '/usr/lib' ]
except FileNotFoundError:
print( "libsingular-config and pkg-config not found - guessing debian" )
include_dirs=['/usr/include/x86_64-linux-gnu/singular',
'/usr/include/x86_64-linux-gnu/singular/singular',
'/usr/include/singular', '/usr/include/singular/singular',
'/usr/include/x86_64-linux-gnu/singular',
'/usr/include/x86_64-linux-gnu/singular/singular',
'/usr/include/singular', '/usr/include/singular/singular',
'/usr/include/x86_64-linux-gnu/singular',
'/usr/include/singular',
'/usr/include/x86_64-linux-gnu/singular',
'/usr/include/singular',
'/usr/include/x86_64-linux-gnu/singular',
'/usr/include/singular']
library_dirs=[ '/usr/lib' ]
singular_ldflags = ['-lsingular-Singular' ]
setup(
name = 'PySingular',
version = '0.9.7',
description = 'A simple interface to Singular',
author = 'Sebastian Gutsche',
author_email = '[email protected]',
url = 'https://github.com/sebasguts/SingularPython',
ext_modules= [ Extension( "PySingular",
[ "SingularModule.cpp" ],
include_dirs=include_dirs,
library_dirs=library_dirs,
extra_compile_args=singular_cflags,
extra_link_args=singular_ldflags,
define_macros = macro_list ) ],
package_data = { '': [ "COPYING", "GPLv2" ] },
)