1616
1717try :
1818 import Cython
19+
1920 cython_major_version = int (Cython .__version__ .split ("." , 1 )[0 ])
2021except ImportError :
2122 cython_major_version = 0
@@ -50,8 +51,15 @@ def get_geos_install_prefix():
5051 if env_candidate is not None :
5152 candidates = [env_candidate ]
5253 else :
53- candidates = [os .path .expanduser ("~/local" ), os .path .expanduser ("~" ),
54- "/usr/local" , "/usr" , "/opt/local" , "/opt" , "/sw" ]
54+ candidates = [
55+ os .path .expanduser ("~/local" ),
56+ os .path .expanduser ("~" ),
57+ "/usr/local" ,
58+ "/usr" ,
59+ "/opt/local" ,
60+ "/opt" ,
61+ "/sw" ,
62+ ]
5563
5664 # Prepare filename pattern to find the GEOS library.
5765 extensions = {"win32" : "dll" , "cygwin" : "dll" , "darwin" : "dylib" }
@@ -71,15 +79,20 @@ def get_geos_install_prefix():
7179 # the user is trying to build the library.
7280 build_cmds = ("bdist_wheel" , "build" , "install" )
7381 if any (cmd in sys .argv [1 :] for cmd in build_cmds ):
74- warnings .warn (" " .join ([
75- "Cannot find GEOS library and/or headers in standard locations" ,
76- "('{0}'). Please install the corresponding packages using your" ,
77- "software management system or set the environment variable" ,
78- "GEOS_DIR to point to the location where GEOS is installed" ,
79- "(for example, if 'geos_c.h' is in '/usr/local/include'" ,
80- "and 'libgeos_c' is in '/usr/local/lib', then you need to" ,
81- "set GEOS_DIR to '/usr/local'" ,
82- ]).format ("', '" .join (candidates )), RuntimeWarning )
82+ warnings .warn (
83+ " " .join (
84+ [
85+ "Cannot find GEOS library and/or headers in standard locations" ,
86+ "('{0}'). Please install the corresponding packages using your" ,
87+ "software management system or set the environment variable" ,
88+ "GEOS_DIR to point to the location where GEOS is installed" ,
89+ "(for example, if 'geos_c.h' is in '/usr/local/include'" ,
90+ "and 'libgeos_c' is in '/usr/local/lib', then you need to" ,
91+ "set GEOS_DIR to '/usr/local'" ,
92+ ]
93+ ).format ("', '" .join (candidates )),
94+ RuntimeWarning ,
95+ )
8396 return None
8497
8598
@@ -91,8 +104,7 @@ def run(self):
91104
92105 # Replace DLL data files and add GEOS build script.
93106 orig_data_files = self .distribution .data_files
94- self .distribution .data_files = [
95- ("." , glob .glob (os .path .join ("utils" , "*.py" )))]
107+ self .distribution .data_files = [("." , glob .glob (os .path .join ("utils" , "*.py" )))]
96108
97109 # Run the original `run` method and leave `data_files` as it was found.
98110 try :
@@ -114,6 +126,7 @@ def run(self):
114126else :
115127 try :
116128 import numpy
129+
117130 include_dirs .append (numpy .get_include ())
118131 except ImportError as err :
119132 cmds = ("bdist_wheel" , "build" , "install" )
@@ -142,27 +155,25 @@ def run(self):
142155# Define `_geoslib` extension module. It cannot be installed in the
143156# `mpl_toolkits.basemap` namespace or `Basemap` objects will not be pickleable.
144157ext_modules = [
145- Extension (** {
146- "name" :
147- "_geoslib" ,
148- "sources" : [
149- "src/_geoslib.pyx" ,
150- ],
151- "libraries" : [
152- "geos_c" ,
153- ],
154- "include_dirs" :
155- include_dirs ,
156- "library_dirs" :
157- library_dirs ,
158- "runtime_library_dirs" :
159- runtime_library_dirs ,
160- }),
158+ Extension (
159+ ** {
160+ "name" : "_geoslib" ,
161+ "sources" : [
162+ "src/_geoslib.pyx" ,
163+ ],
164+ "libraries" : [
165+ "geos_c" ,
166+ ],
167+ "include_dirs" : include_dirs ,
168+ "library_dirs" : library_dirs ,
169+ "runtime_library_dirs" : runtime_library_dirs ,
170+ }
171+ ),
161172]
162173for ext in ext_modules :
163174 ext .cython_directives = [
164175 ("language_level" , str (sys .version_info [0 ])),
165- ][:1 + int (cython_major_version >= 3 )]
176+ ][: 1 + int (cython_major_version >= 3 )]
166177
167178# Define all the different requirements.
168179setup_requires = get_content ("requirements-setup.txt" , splitlines = True )
@@ -172,95 +183,79 @@ def run(self):
172183 marker1 = '; python_version == "3.2"'
173184 marker2 = '; python_version >= "2.7"'
174185 setup_requires = [
175- item .replace (marker1 , "" ).replace (marker2 , "" ) for item in setup_requires
176- if item .endswith (marker1 ) or item .endswith (marker2 )
177- or "python_version" not in item ]
186+ item .replace (marker1 , "" ).replace (marker2 , "" )
187+ for item in setup_requires
188+ if item .endswith (marker1 )
189+ or item .endswith (marker2 )
190+ or "python_version" not in item
191+ ]
178192 install_requires = [
179- item .replace (marker1 , "" ).replace (marker2 , "" ) for item in install_requires
180- if item .endswith (marker1 ) or item .endswith (marker2 )
181- or "python_version" not in item ]
193+ item .replace (marker1 , "" ).replace (marker2 , "" )
194+ for item in install_requires
195+ if item .endswith (marker1 )
196+ or item .endswith (marker2 )
197+ or "python_version" not in item
198+ ]
182199else :
183200 marker1 = '; python_version == "3.2"'
184201 setup_requires = [item for item in setup_requires if not item .endswith (marker1 )]
185202 install_requires = [item for item in install_requires if not item .endswith (marker1 )]
186203
187- setup (** {
188- "name" :
189- "basemap" ,
190- "version" :
191- get_version ("mpl_toolkits.basemap" ),
192- "license" :
193- "MIT" ,
194- "description" :
195- "Plot data on map projections with matplotlib" ,
196- "long_description" :
197- get_content ("README.md" ),
198- "long_description_content_type" :
199- "text/markdown" ,
200- "url" :
201- "https://matplotlib.org/basemap" ,
202- "author" :
203- "Jeff Whitaker" ,
204- "author_email" :
205- 206- "maintainer" :
207- "Víctor Molina García" ,
208- "maintainer_email" :
209- 210- "classifiers" : [
211- "Development Status :: 5 - Production/Stable" ,
212- "Intended Audience :: Education" ,
213- "Intended Audience :: Science/Research" ,
214- "License :: OSI Approved :: MIT License" ,
215- "Operating System :: OS Independent" ,
216- "Programming Language :: Python :: 2" ,
217- "Programming Language :: Python :: 3" ,
218- "Topic :: Scientific/Engineering :: Visualization" ,
219- "Topic :: Software Development :: Libraries :: Python Modules" ,
220- ],
221- "keywords" : [
222- "GIS" ,
223- "maps" ,
224- "plots" ,
225- ],
226- "package_dir" :
227- {"" : "src" },
228- "packages" :
229- find_namespace_packages (where = "src" ),
230- "ext_modules" :
231- ext_modules ,
232- "data_files" :
233- data_files ,
234- "python_requires" :
235- ", " .join ([
236- ">=3.9" ,
237- "<3.13" ,
238- ]),
239- "setup_requires" :
240- setup_requires ,
241- "install_requires" :
242- install_requires ,
243- "extras_require" : {
244- "doc" :
245- get_content ("requirements-doc.txt" , splitlines = True ),
246- "lint" :
247- get_content ("requirements-lint.txt" , splitlines = True ),
248- "test" :
249- get_content ("requirements-test.txt" , splitlines = True ),
250- "owslib" :
251- get_content ("requirements-owslib.txt" , splitlines = True ),
252- "pillow" :
253- get_content ("requirements-pillow.txt" , splitlines = True ),
254- },
255- "cmdclass" : {
256- "sdist" : basemap_sdist ,
257- },
258- "project_urls" : {
259- "Bug Tracker" :
260- "https://github.com/matplotlib/basemap/issues" ,
261- "Documentation" :
262- "https://matplotlib.org/basemap/" ,
263- "Source" :
264- "https://github.com/matplotlib/basemap" ,
265- },
266- })
204+ setup (
205+ ** {
206+ "name" : "basemap" ,
207+ "version" : get_version ("mpl_toolkits.basemap" ),
208+ "license" : "MIT" ,
209+ "description" : "Plot data on map projections with matplotlib" ,
210+ "long_description" : get_content ("README.md" ),
211+ "long_description_content_type" : "text/markdown" ,
212+ "url" : "https://matplotlib.org/basemap" ,
213+ "author" : "Jeff Whitaker" ,
214+ "author_email" :
"[email protected] " ,
215+ "maintainer" : "Víctor Molina García" ,
216+ "maintainer_email" :
"[email protected] " ,
217+ "classifiers" : [
218+ "Development Status :: 5 - Production/Stable" ,
219+ "Intended Audience :: Education" ,
220+ "Intended Audience :: Science/Research" ,
221+ "License :: OSI Approved :: MIT License" ,
222+ "Operating System :: OS Independent" ,
223+ "Programming Language :: Python :: 2" ,
224+ "Programming Language :: Python :: 3" ,
225+ "Topic :: Scientific/Engineering :: Visualization" ,
226+ "Topic :: Software Development :: Libraries :: Python Modules" ,
227+ ],
228+ "keywords" : [
229+ "GIS" ,
230+ "maps" ,
231+ "plots" ,
232+ ],
233+ "package_dir" : {"" : "src" },
234+ "packages" : find_namespace_packages (where = "src" ),
235+ "ext_modules" : ext_modules ,
236+ "data_files" : data_files ,
237+ "python_requires" : ", " .join (
238+ [
239+ ">=3.9" ,
240+ "<3.13" ,
241+ ]
242+ ),
243+ "setup_requires" : setup_requires ,
244+ "install_requires" : install_requires ,
245+ "extras_require" : {
246+ "doc" : get_content ("requirements-doc.txt" , splitlines = True ),
247+ "lint" : get_content ("requirements-lint.txt" , splitlines = True ),
248+ "test" : get_content ("requirements-test.txt" , splitlines = True ),
249+ "owslib" : get_content ("requirements-owslib.txt" , splitlines = True ),
250+ "pillow" : get_content ("requirements-pillow.txt" , splitlines = True ),
251+ },
252+ "cmdclass" : {
253+ "sdist" : basemap_sdist ,
254+ },
255+ "project_urls" : {
256+ "Bug Tracker" : "https://github.com/matplotlib/basemap/issues" ,
257+ "Documentation" : "https://matplotlib.org/basemap/" ,
258+ "Source" : "https://github.com/matplotlib/basemap" ,
259+ },
260+ }
261+ )
0 commit comments