Skip to content

Commit 5a2d098

Browse files
authored
Merge pull request #532 from DWesl/build-from-sdist
TST: Test that packages can be build from sdists.
2 parents ba6e90d + 403c521 commit 5a2d098

12 files changed

+48
-53
lines changed

.github/workflows/basemap-data-hires.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ jobs:
4646
name: checkout
4747
path: .
4848
-
49-
name: Build wheel
49+
name: Build sdist and wheel
5050
run: |
5151
cd ${{ env.PKGDIR }}
52-
python setup.py sdist bdist_wheel
52+
python setup.py sdist
53+
pip wheel -w dist --no-deps dist/*.zip
5354
-
5455
name: Upload build artifacts
5556
uses: actions/upload-artifact@v1

.github/workflows/basemap-data.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ jobs:
4646
name: checkout
4747
path: .
4848
-
49-
name: Build wheel
49+
name: Build sdist and wheel
5050
run: |
5151
cd ${{ env.PKGDIR }}
52-
python setup.py sdist bdist_wheel
52+
python setup.py sdist
53+
pip wheel -w dist --no-deps dist/*.zip
5354
-
5455
name: Upload build artifacts
5556
uses: actions/upload-artifact@v1

.github/workflows/basemap-for-manylinux.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ jobs:
137137
name: Build wheel
138138
run: |
139139
cd ${{ env.PKGDIR }}
140-
export GEOS_DIR=extern
141-
export NUMPY_INCLUDE_PATH=extern/include
140+
export GEOS_DIR="${GITHUB_WORKSPACE}/${{ env.PKGDIR }}/extern"
141+
export NUMPY_INCLUDE_PATH="${GITHUB_WORKSPACE}/${{ env.PKGDIR }}/extern/include"
142+
export CFLAGS="-std=c99"
142143
pip install -r requirements-setup.txt
143-
python setup.py sdist bdist_wheel
144+
python setup.py sdist
145+
pip wheel -w dist --no-deps dist/*.zip
144146
-
145147
name: Upload build artifacts
146148
uses: actions/upload-artifact@v1

.github/workflows/basemap-for-windows.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ jobs:
164164
name: Build wheel
165165
run: |
166166
cd ${{ env.PKGDIR }}
167-
$env:GEOS_DIR = "extern"
168-
$env:NUMPY_INCLUDE_PATH = "extern/include"
167+
$env:GEOS_DIR = "$env:GITHUB_WORKSPACE/${{ env.PKGDIR }}/extern"
168+
$env:NUMPY_INCLUDE_PATH = "$env:GITHUB_WORKSPACE/${{ env.PKGDIR }}/extern/include"
169+
$env:SETUPTOOLS_USE_DISTUTILS = "stdlib"
169170
pip install -r requirements-setup.txt
170-
python setup.py sdist bdist_wheel
171+
python setup.py sdist
172+
pip wheel -w dist --no-deps (Get-Item dist/*.zip)
171173
-
172174
name: Upload build artifacts
173175
uses: actions/upload-artifact@v1

packages/basemap/MANIFEST.in

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include requirements*.txt
2+
recursive-include doc *
3+
recursive-exclude doc/build *
4+
recursive-include test *
5+
recursive-include utils *.py
6+
recursive-exclude **/__pycache__ *
7+
exclude **/*.pyc
8+
exclude **/.gitkeep

packages/basemap/pyproject.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[build-system]
2+
requires = [
3+
'setuptools',
4+
'wheel',
5+
'oldest-supported-numpy; python_version >= "3.5"',
6+
'numpy == 1.16.6; python_version == "3.4" or python_version == "2.7"',
7+
'numpy == 1.11.3; python_version == "3.3" or python_version == "3.2" or python_version == "2.6"',
8+
'cython >= 0.29, < 3.1; python_version >= "3.3" or python_version <= "3.0"',
9+
'cython >= 0.26, < 0.27; python_version == "3.2"'
10+
]
11+
build-backend = "setuptools.build_meta"

packages/basemap/setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ license_files =
33
LICENSE
44
LICENSE.geos
55

6+
[sdist]
7+
formats = zip
8+
69
[flake8]
710
ignore =
811
E301,E306,E402,E501,E731,W503,W504

packages/basemap/setup.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ def run(self):
7878
finally:
7979
self.distribution.data_files = orig_data_files
8080

81-
def initialize_options(self):
82-
"""Call `initialize_options` and then set zip as default format."""
83-
84-
sdist.initialize_options(self)
85-
self._default_to_zip()
86-
87-
def _default_to_zip(self):
88-
self.formats = ["zip"]
89-
9081

9182
# Initialise include and library dirs.
9283
data_files = []
@@ -160,6 +151,10 @@ def _default_to_zip(self):
160151
item.replace(marker1, "").replace(marker2, "") for item in install_requires
161152
if item.endswith(marker1) or item.endswith(marker2)
162153
or "python_version" not in item]
154+
else:
155+
marker1 = '; python_version == "3.2"'
156+
setup_requires = [item for item in setup_requires if not item.endswith(marker1)]
157+
install_requires = [item for item in install_requires if not item.endswith(marker1)]
163158

164159
setup(**{
165160
"name":

packages/basemap_data/setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ license_files =
55
LICENSE.epsg
66
LICENSE.mit
77

8+
[sdist]
9+
formats = zip
10+
811
[bdist_wheel]
912
universal = 1

packages/basemap_data/setup.py

-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import itertools
99
from setuptools import setup
1010
from setuptools import find_packages
11-
from setuptools.command.sdist import sdist
1211

1312

1413
def get_content(name, splitlines=False):
@@ -23,19 +22,6 @@ def get_content(name, splitlines=False):
2322
return content
2423

2524

26-
class sdist_zip(sdist):
27-
"""Custom `sdist` that saves source distributions in zip format."""
28-
29-
def initialize_options(self):
30-
"""Call `initialize_options` and then set zip as default format."""
31-
32-
sdist.initialize_options(self)
33-
self._default_to_zip()
34-
35-
def _default_to_zip(self):
36-
self.formats = ["zip"]
37-
38-
3925
# Define some helper lists.
4026
basenames = [
4127
"countries",
@@ -140,9 +126,6 @@ def _default_to_zip(self):
140126
"!=3.1.*",
141127
"<4",
142128
]),
143-
"cmdclass": {
144-
"sdist": sdist_zip,
145-
},
146129
"project_urls": {
147130
"Bug Tracker":
148131
"https://github.com/matplotlib/basemap/issues",

packages/basemap_data_hires/setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ license_files =
33
COPYING
44
COPYING.LESSER
55

6+
[sdist]
7+
formats = zip
8+
69
[bdist_wheel]
710
universal = 1

packages/basemap_data_hires/setup.py

-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import itertools
99
from setuptools import setup
1010
from setuptools import find_packages
11-
from setuptools.command.sdist import sdist
1211

1312

1413
def get_content(name, splitlines=False):
@@ -23,19 +22,6 @@ def get_content(name, splitlines=False):
2322
return content
2423

2524

26-
class sdist_zip(sdist):
27-
"""Custom `sdist` that saves source distributions in zip format."""
28-
29-
def initialize_options(self):
30-
"""Call `initialize_options` and then set zip as default format."""
31-
32-
sdist.initialize_options(self)
33-
self._default_to_zip()
34-
35-
def _default_to_zip(self):
36-
self.formats = ["zip"]
37-
38-
3925
# Define some helper lists.
4026
basenames = [
4127
"countries",
@@ -118,9 +104,6 @@ def _default_to_zip(self):
118104
"!=3.1.*",
119105
"<4",
120106
]),
121-
"cmdclass": {
122-
"sdist": sdist_zip,
123-
},
124107
"project_urls": {
125108
"Bug Tracker":
126109
"https://github.com/matplotlib/basemap/issues",

0 commit comments

Comments
 (0)