-
Notifications
You must be signed in to change notification settings - Fork 3
/
mapnik_setup.py.patch
74 lines (66 loc) · 3.02 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
diff --git a/setup.py b/setup.py
index 1de707a34..c50f32116 100755
--- a/setup.py
+++ b/setup.py
@@ -13,22 +13,16 @@ def check_output(args):
return output.rstrip('\n')
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',
-])
+lib_path = check_output(['pkg-config', 'libmapnik', '--variable', 'libdir'])
+linkflags.extend(check_output(['pkg-config', 'libmapnik', '--libs']).split(' '))
# Dynamically make the mapnik/paths.py file
f_paths = open('packaging/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 os.environ.get('LIB_DIR_NAME'):
mapnik_lib_path = lib_path + os.environ.get('LIB_DIR_NAME')
@@ -39,12 +33,16 @@ 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()
-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 sys.platform == 'darwin':
pass
@@ -112,9 +110,9 @@ ext_modules = [
]
if os.environ.get("CC", False) == False:
- os.environ["CC"] = check_output([mapnik_config, '--cxx'])
+ os.environ["CC"] = 'c++'
if os.environ.get("CXX", False) == False:
- os.environ["CXX"] = check_output([mapnik_config, '--cxx'])
+ os.environ["CXX"] = 'c++'
setup(
name="mapnik",
@@ -122,9 +120,10 @@ setup(
packages=find_packages(where="packaging"),
package_dir={"": "packaging"},
package_data={
- 'mapnik': ['lib/*.*', 'lib/*/*/*', 'share/*/*'],
+ 'mapnik': ['lib/*.*', 'lib/*/*/*', 'share/*/*', 'input/*', 'fonts/*', 'proj/*', 'gdal/*', 'bin/*'],
},
ext_modules=ext_modules,
+ entry_points={'console_scripts': ['%s=mapnik.bin:program' % name for name in os.listdir('packaging/mapnik/bin') if not name.endswith('.py')]},
cmdclass={"build_ext": build_ext},
python_requires=">=3.7",
)