-
Notifications
You must be signed in to change notification settings - Fork 3
/
mapnik_setup.py.patch
111 lines (101 loc) · 4.77 KB
/
mapnik_setup.py.patch
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff --git a/setup.py b/setup.py
index 9985da5..57cba59 100755
--- a/setup.py
+++ b/setup.py
@@ -84,22 +84,26 @@ class WhichBoostCommand(Command):
print("\n".join(get_boost_library_names()))
-cflags = sysconfig.get_config_var('CFLAGS')
-sysconfig._config_vars['CFLAGS'] = re.sub(
- ' +', ' ', cflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
-opt = sysconfig.get_config_var('OPT')
-sysconfig._config_vars['OPT'] = re.sub(
- ' +', ' ', opt.replace('-g ', '').replace('-Os', ''))
-ldshared = sysconfig.get_config_var('LDSHARED')
-sysconfig._config_vars['LDSHARED'] = re.sub(
- ' +', ' ', ldshared.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
-ldflags = sysconfig.get_config_var('LDFLAGS')
-sysconfig._config_vars['LDFLAGS'] = re.sub(
- ' +', ' ', ldflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
-pycflags = sysconfig.get_config_var('PY_CFLAGS')
-sysconfig._config_vars['PY_CFLAGS'] = re.sub(
- ' +', ' ', pycflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
-sysconfig._config_vars['CFLAGSFORSHARED'] = ''
+try:
+ cflags = sysconfig.get_config_var('CFLAGS')
+ sysconfig._config_vars['CFLAGS'] = re.sub(
+ ' +', ' ', cflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
+ opt = sysconfig.get_config_var('OPT')
+ sysconfig._config_vars['OPT'] = re.sub(
+ ' +', ' ', opt.replace('-g ', '').replace('-Os', ''))
+ ldshared = sysconfig.get_config_var('LDSHARED')
+ sysconfig._config_vars['LDSHARED'] = re.sub(
+ ' +', ' ', ldshared.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
+ ldflags = sysconfig.get_config_var('LDFLAGS')
+ sysconfig._config_vars['LDFLAGS'] = re.sub(
+ ' +', ' ', ldflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
+ pycflags = sysconfig.get_config_var('PY_CFLAGS')
+ sysconfig._config_vars['PY_CFLAGS'] = re.sub(
+ ' +', ' ', pycflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
+ sysconfig._config_vars['CFLAGSFORSHARED'] = ''
+
+except Exception:
+ pass
os.environ['ARCHFLAGS'] = ''
if os.environ.get("MASON_BUILD", "false") == "true":
@@ -113,22 +117,17 @@ else:
linkflags = []
-lib_path = os.path.join(check_output([mapnik_config, '--prefix']),'lib')
-linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
-linkflags.extend(check_output([mapnik_config, '--ldflags']).split(' '))
-linkflags.extend(check_output([mapnik_config, '--dep-libs']).split(' '))
-linkflags.extend([
-'-lmapnik-wkt',
-'-lmapnik-json',
-] + ['-l%s' % i for i in get_boost_library_names()])
+lib_path = check_output(['pkg-config', 'libmapnik', '--variable', 'libdir'])
+linkflags.extend(check_output(['pkg-config', 'libmapnik', '--libs']).split(' '))
+linkflags.extend(['-l%s' % i for i in get_boost_library_names()])
# Dynamically make the mapnik/paths.py file
f_paths = open('mapnik/paths.py', 'w')
f_paths.write('import os\n')
f_paths.write('\n')
-input_plugin_path = check_output([mapnik_config, '--input-plugins'])
-font_path = check_output([mapnik_config, '--fonts'])
+input_plugin_path = os.path.join(lib_path, 'mapnik', 'input')
+font_path = os.path.join(lib_path, 'mapnik', 'fonts')
if mason_build:
try:
@@ -181,6 +180,12 @@ else:
"inputpluginspath = '{path}'\n".format(path=input_plugin_path))
f_paths.write(
"fontscollectionpath = '{path}'\n".format(path=font_path))
+ f_paths.write("localpath = os.path.dirname(os.path.abspath( __file__ ))\n")
+ f_paths.write("mapniklibpath = os.path.join(localpath, 'mapnik.libs')\n")
+ f_paths.write("mapniklibpath = os.path.normpath(mapniklibpath)\n")
+ f_paths.write("inputpluginspath = os.path.join(localpath, 'input')\n")
+ f_paths.write("fontscollectionpath = os.path.join(localpath, 'fonts')\n")
+
f_paths.write(
"__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n")
f_paths.close()
@@ -223,9 +228,7 @@ if mason_build:
except shutil.Error:
pass
-extra_comp_args = check_output([mapnik_config, '--cflags']).split(' ')
-
-extra_comp_args = list(filter(lambda arg: arg != "-fvisibility=hidden", extra_comp_args))
+extra_comp_args = check_output(['pkg-config', 'libmapnik', '--cflags']).split(' ')
if os.environ.get("PYCAIRO", "false") == "true":
try:
@@ -267,9 +271,10 @@ setup(
'nose',
],
package_data={
- 'mapnik': ['lib/*.*', 'lib/*/*/*', 'share/*/*'],
+ 'mapnik': ['lib/*.*', 'lib/*/*/*', 'share/*/*', 'input/*', 'fonts/*', 'proj/*', 'gdal/*', 'bin/*'],
},
test_suite='nose.collector',
+ entry_points={'console_scripts': ['%s=mapnik.bin:program' % name for name in os.listdir('mapnik/bin') if not name.endswith('.py')]},
cmdclass={
'whichboost': WhichBoostCommand,
},