|
10 | 10 | import warnings
|
11 | 11 | from setuptools import setup
|
12 | 12 | from setuptools import find_packages
|
| 13 | +from setuptools.command.sdist import sdist |
13 | 14 | from setuptools.dist import Distribution
|
14 | 15 | from setuptools.extension import Extension
|
15 | 16 |
|
@@ -42,6 +43,18 @@ def checkversion(directory):
|
42 | 43 | return version
|
43 | 44 |
|
44 | 45 |
|
| 46 | +class basemap_sdist(sdist): |
| 47 | + """Custom `sdist` so that it will not pack DLLs on Windows if present.""" |
| 48 | + |
| 49 | + def finalize_options(self): |
| 50 | + """Call `finalize_options` after cleaning `data_files` and reset.""" |
| 51 | + |
| 52 | + orig_data_files = self.distribution.data_files |
| 53 | + self.distribution.data_files = [] |
| 54 | + sdist.finalize_options(self) |
| 55 | + self.distribution.data_files = orig_data_files |
| 56 | + |
| 57 | + |
45 | 58 | # Initialise include and library dirs.
|
46 | 59 | include_dirs = []
|
47 | 60 | library_dirs = []
|
@@ -98,7 +111,7 @@ def checkversion(directory):
|
98 | 111 | if os.name == "nt":
|
99 | 112 | # On Windows:
|
100 | 113 | # - DLLs get installed under `bin`.
|
101 |
| - # - We need to inject the DLL in the wheel using `data_files`. |
| 114 | + # - We need to inject later the DLL in the wheel using `data_files`. |
102 | 115 | # - We do not use `runtime_library_dirs` as workaround for a
|
103 | 116 | # `distutils` bug (http://bugs.python.org/issue2437).
|
104 | 117 | library_dirs.append(os.path.join(geos_installdir, "bin"))
|
@@ -218,6 +231,9 @@ def checkversion(directory):
|
218 | 231 | "doc":
|
219 | 232 | doc_requires,
|
220 | 233 | },
|
| 234 | + "cmdclass": { |
| 235 | + "sdist": basemap_sdist, |
| 236 | + }, |
221 | 237 | "project_urls": {
|
222 | 238 | "Bug Tracker":
|
223 | 239 | "https://github.com/matplotlib/basemap/issues",
|
|
0 commit comments