@@ -12,104 +12,107 @@ def check_output(args):
12
12
output = subprocess .check_output (args ).decode ()
13
13
return output .rstrip ('\n ' )
14
14
15
+ ext_modules = []
16
+ extra_comp_args = []
15
17
linkflags = []
16
- lib_path = os .path .join (check_output ([mapnik_config , '--prefix' ]),'lib' )
17
- linkflags .extend (check_output ([mapnik_config , '--libs' ]).split (' ' ))
18
- linkflags .extend (check_output ([mapnik_config , '--ldflags' ]).split (' ' ))
19
- linkflags .extend (check_output ([mapnik_config , '--dep-libs' ]).split (' ' ))
20
- linkflags .extend ([
21
- '-lmapnik-wkt' ,
22
- '-lmapnik-json' ,
23
- ])
24
18
25
- # Dynamically make the mapnik/paths.py file
26
- f_paths = open ('packaging/mapnik/paths.py' , 'w' )
27
- f_paths .write ('import os\n ' )
28
- f_paths .write ('\n ' )
19
+ if 'clean' not in sys .argv :
20
+ lib_path = os .path .join (check_output ([mapnik_config , '--prefix' ]),'lib' )
21
+ linkflags .extend (check_output ([mapnik_config , '--libs' ]).split (' ' ))
22
+ linkflags .extend (check_output ([mapnik_config , '--ldflags' ]).split (' ' ))
23
+ linkflags .extend (check_output ([mapnik_config , '--dep-libs' ]).split (' ' ))
24
+ linkflags .extend ([
25
+ '-lmapnik-wkt' ,
26
+ '-lmapnik-json' ,
27
+ ])
29
28
30
- input_plugin_path = check_output ([mapnik_config , '--input-plugins' ])
31
- font_path = check_output ([mapnik_config , '--fonts' ])
29
+ # Dynamically make the mapnik/paths.py file
30
+ f_paths = open ('packaging/mapnik/paths.py' , 'w' )
31
+ f_paths .write ('import os\n ' )
32
+ f_paths .write ('\n ' )
32
33
33
- if os .environ .get ('LIB_DIR_NAME' ):
34
- mapnik_lib_path = lib_path + os .environ .get ('LIB_DIR_NAME' )
35
- else :
36
- mapnik_lib_path = lib_path + "/mapnik"
37
- f_paths .write ("mapniklibpath = '{path}'\n " .format (path = mapnik_lib_path ))
38
- f_paths .write (
39
- "inputpluginspath = '{path}'\n " .format (path = input_plugin_path ))
40
- f_paths .write (
41
- "fontscollectionpath = '{path}'\n " .format (path = font_path ))
42
- f_paths .write (
43
- "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n " )
44
- f_paths .close ()
34
+ input_plugin_path = check_output ([mapnik_config , '--input-plugins' ])
35
+ font_path = check_output ([mapnik_config , '--fonts' ])
45
36
46
- extra_comp_args = check_output ([mapnik_config , '--cflags' ]).split (' ' )
47
- extra_comp_args = list (filter (lambda arg : arg != "-fvisibility=hidden" , extra_comp_args ))
37
+ if os .environ .get ('LIB_DIR_NAME' ):
38
+ mapnik_lib_path = lib_path + os .environ .get ('LIB_DIR_NAME' )
39
+ else :
40
+ mapnik_lib_path = lib_path + "/mapnik"
41
+ f_paths .write ("mapniklibpath = '{path}'\n " .format (path = mapnik_lib_path ))
42
+ f_paths .write (
43
+ "inputpluginspath = '{path}'\n " .format (path = input_plugin_path ))
44
+ f_paths .write (
45
+ "fontscollectionpath = '{path}'\n " .format (path = font_path ))
46
+ f_paths .write (
47
+ "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n " )
48
+ f_paths .close ()
48
49
49
- if sys .platform == 'darwin' :
50
- pass
51
- else :
52
- linkflags .append ('-lrt' )
53
- linkflags .append ('-Wl,-z,origin' )
54
- linkflags .append ('-Wl,-rpath=$ORIGIN/lib' )
50
+ extra_comp_args = check_output ([mapnik_config , '--cflags' ]).split (' ' )
51
+ extra_comp_args = list (filter (lambda arg : arg != "-fvisibility=hidden" , extra_comp_args ))
55
52
53
+ if sys .platform == 'darwin' :
54
+ pass
55
+ else :
56
+ linkflags .append ('-lrt' )
57
+ linkflags .append ('-Wl,-z,origin' )
58
+ linkflags .append ('-Wl,-rpath=$ORIGIN/lib' )
56
59
57
- ext_modules = [
58
- Pybind11Extension (
59
- "mapnik._mapnik" ,
60
- [
61
- "src/mapnik_python.cpp" ,
62
- "src/mapnik_layer.cpp" ,
63
- "src/mapnik_query.cpp" ,
64
- "src/mapnik_map.cpp" ,
65
- "src/mapnik_color.cpp" ,
66
- "src/mapnik_composite_modes.cpp" ,
67
- "src/mapnik_coord.cpp" ,
68
- "src/mapnik_envelope.cpp" ,
69
- "src/mapnik_expression.cpp" ,
70
- "src/mapnik_datasource.cpp" ,
71
- "src/mapnik_datasource_cache.cpp" ,
72
- "src/mapnik_gamma_method.cpp" ,
73
- "src/mapnik_geometry.cpp" ,
74
- "src/mapnik_feature.cpp" ,
75
- "src/mapnik_featureset.cpp" ,
76
- "src/mapnik_font_engine.cpp" ,
77
- "src/mapnik_fontset.cpp" ,
78
- "src/mapnik_grid.cpp" ,
79
- "src/mapnik_grid_view.cpp" ,
80
- "src/mapnik_image.cpp" ,
81
- "src/mapnik_image_view.cpp" ,
82
- "src/mapnik_projection.cpp" ,
83
- "src/mapnik_proj_transform.cpp" ,
84
- "src/mapnik_rule.cpp" ,
85
- "src/mapnik_symbolizer.cpp" ,
86
- "src/mapnik_debug_symbolizer.cpp" ,
87
- "src/mapnik_markers_symbolizer.cpp" ,
88
- "src/mapnik_polygon_symbolizer.cpp" ,
89
- "src/mapnik_polygon_pattern_symbolizer.cpp" ,
90
- "src/mapnik_line_symbolizer.cpp" ,
91
- "src/mapnik_line_pattern_symbolizer.cpp" ,
92
- "src/mapnik_point_symbolizer.cpp" ,
93
- "src/mapnik_raster_symbolizer.cpp" ,
94
- "src/mapnik_scaling_method.cpp" ,
95
- "src/mapnik_style.cpp" ,
96
- "src/mapnik_logger.cpp" ,
97
- "src/mapnik_placement_finder.cpp" ,
98
- "src/mapnik_text_symbolizer.cpp" ,
99
- "src/mapnik_palette.cpp" ,
100
- "src/mapnik_parameters.cpp" ,
101
- "src/python_grid_utils.cpp" ,
102
- "src/mapnik_raster_colorizer.cpp" ,
103
- "src/mapnik_label_collision_detector.cpp" ,
104
- "src/mapnik_dot_symbolizer.cpp" ,
105
- "src/mapnik_building_symbolizer.cpp" ,
106
- "src/mapnik_shield_symbolizer.cpp" ,
107
- "src/mapnik_group_symbolizer.cpp"
108
- ],
109
- extra_compile_args = extra_comp_args ,
110
- extra_link_args = linkflags ,
111
- )
112
- ]
60
+ ext_modules = [
61
+ Pybind11Extension (
62
+ "mapnik._mapnik" ,
63
+ [
64
+ "src/mapnik_python.cpp" ,
65
+ "src/mapnik_layer.cpp" ,
66
+ "src/mapnik_query.cpp" ,
67
+ "src/mapnik_map.cpp" ,
68
+ "src/mapnik_color.cpp" ,
69
+ "src/mapnik_composite_modes.cpp" ,
70
+ "src/mapnik_coord.cpp" ,
71
+ "src/mapnik_envelope.cpp" ,
72
+ "src/mapnik_expression.cpp" ,
73
+ "src/mapnik_datasource.cpp" ,
74
+ "src/mapnik_datasource_cache.cpp" ,
75
+ "src/mapnik_gamma_method.cpp" ,
76
+ "src/mapnik_geometry.cpp" ,
77
+ "src/mapnik_feature.cpp" ,
78
+ "src/mapnik_featureset.cpp" ,
79
+ "src/mapnik_font_engine.cpp" ,
80
+ "src/mapnik_fontset.cpp" ,
81
+ "src/mapnik_grid.cpp" ,
82
+ "src/mapnik_grid_view.cpp" ,
83
+ "src/mapnik_image.cpp" ,
84
+ "src/mapnik_image_view.cpp" ,
85
+ "src/mapnik_projection.cpp" ,
86
+ "src/mapnik_proj_transform.cpp" ,
87
+ "src/mapnik_rule.cpp" ,
88
+ "src/mapnik_symbolizer.cpp" ,
89
+ "src/mapnik_debug_symbolizer.cpp" ,
90
+ "src/mapnik_markers_symbolizer.cpp" ,
91
+ "src/mapnik_polygon_symbolizer.cpp" ,
92
+ "src/mapnik_polygon_pattern_symbolizer.cpp" ,
93
+ "src/mapnik_line_symbolizer.cpp" ,
94
+ "src/mapnik_line_pattern_symbolizer.cpp" ,
95
+ "src/mapnik_point_symbolizer.cpp" ,
96
+ "src/mapnik_raster_symbolizer.cpp" ,
97
+ "src/mapnik_scaling_method.cpp" ,
98
+ "src/mapnik_style.cpp" ,
99
+ "src/mapnik_logger.cpp" ,
100
+ "src/mapnik_placement_finder.cpp" ,
101
+ "src/mapnik_text_symbolizer.cpp" ,
102
+ "src/mapnik_palette.cpp" ,
103
+ "src/mapnik_parameters.cpp" ,
104
+ "src/python_grid_utils.cpp" ,
105
+ "src/mapnik_raster_colorizer.cpp" ,
106
+ "src/mapnik_label_collision_detector.cpp" ,
107
+ "src/mapnik_dot_symbolizer.cpp" ,
108
+ "src/mapnik_building_symbolizer.cpp" ,
109
+ "src/mapnik_shield_symbolizer.cpp" ,
110
+ "src/mapnik_group_symbolizer.cpp"
111
+ ],
112
+ extra_compile_args = extra_comp_args ,
113
+ extra_link_args = linkflags ,
114
+ )
115
+ ]
113
116
114
117
if os .environ .get ("CC" , False ) == False :
115
118
os .environ ["CC" ] = check_output ([mapnik_config , '--cxx' ])
0 commit comments