34
34
run : |
35
35
cd packages/${{ matrix.package }}
36
36
python -m pip install build wheel
37
- python -m build --sdist --wheel
37
+ python -m build
38
38
39
39
- uses : actions/upload-artifact@v4
40
40
with :
@@ -63,10 +63,10 @@ jobs:
63
63
- uses : actions/upload-artifact@v4
64
64
with :
65
65
path : packages/basemap/dist/*.tar.gz
66
- name : basemap-sdist
66
+ name : dist- basemap-sdist
67
67
68
68
build_wheels :
69
- name : Build wheels on ${{ matrix.os }}
69
+ name : Build basemap wheels
70
70
needs : [build_data, build_sdist]
71
71
strategy :
72
72
matrix :
80
80
with :
81
81
python-version : " 3.9"
82
82
83
- - name : Download basemap sdist
84
- uses : actions/download-artifact@v4
85
- with :
86
- name : basemap-sdist
87
- path : ./sdist/
88
-
89
83
- name : Download data packages
90
84
uses : actions/download-artifact@v4
91
85
with :
@@ -97,38 +91,31 @@ jobs:
97
91
if : runner.os != 'Windows'
98
92
shell : bash
99
93
run : |
100
- # Debug - show what we downloaded
101
- ls -la ./data_packages/
102
-
103
- # Install the data packages
94
+ # Install the wheel data packages with wildcard
104
95
python -m pip install ./data_packages/*.whl
105
96
106
- # Verify they're installed
107
- python -c "import mpl_toolkits.basemap_data; print('Data package installed')"
97
+ # Verify that the data packages can be imported
98
+ python -c "import mpl_toolkits.basemap_data; print('mpl_toolkits.basemap_data installed successfully ')"
108
99
109
- # Install the data packages (Windows)
110
100
- name : Install data packages (Windows)
111
101
if : runner.os == 'Windows'
112
102
shell : pwsh
113
103
run : |
114
- # Debug - show what we downloaded
115
- Get-ChildItem -Path "./data_packages" -Recurse
116
-
117
- # Find all wheel files
104
+ # Install the wheel data packages sequentially
118
105
$wheels = Get-ChildItem -Path "./data_packages" -Filter "*.whl" -Recurse
119
-
120
- # Install each wheel file
121
106
foreach ($wheel in $wheels) {
122
107
Write-Host "Installing $($wheel.FullName)"
123
108
python -m pip install $wheel.FullName
124
109
}
125
110
126
- # Show installed packages
127
- python -m pip list | Select-String " mpl_toolkits.basemap "
111
+ # Verify that the data packages can be imported
112
+ python -c "import mpl_toolkits.basemap_data; print(' mpl_toolkits.basemap_data installed successfully') "
128
113
129
- # Try different import paths
130
- Write-Host "Trying to import basemap_data..."
131
- python -c "import mpl_toolkits.basemap_data; print('mpl_toolkits.basemap_data imported successfully')"
114
+ - name : Download basemap sdist
115
+ uses : actions/download-artifact@v4
116
+ with :
117
+ name : dist-basemap-sdist
118
+ path : ./sdist/
132
119
133
120
- name : Extract sdist (Linux/macOS)
134
121
if : runner.os != 'Windows'
@@ -137,44 +124,38 @@ jobs:
137
124
# Create extraction directory in the workspace
138
125
mkdir -p ./sdist_extract
139
126
140
- # Extract using tar (Unix-style)
127
+ # Extract with tar using wildcard
141
128
tar -xvf ./sdist/*.tar.gz -C ./sdist_extract
142
129
143
130
# Get the extracted directory name
144
- EXTRACTED_DIR=$(ls -d ./sdist_extract/*/ | head -1)
145
- echo "SDIST_DIR=$(pwd)/${EXTRACTED_DIR}" >> $GITHUB_ENV
131
+ EXTRACTED_DIR="$(ls -d ./sdist_extract/*/ | head -1)"
146
132
147
133
# Verify contents
148
- ls -la ${EXTRACTED_DIR}
134
+ ls -la "${EXTRACTED_DIR}"
135
+
136
+ # Set the environment variable
137
+ echo "SDIST_DIR=$(pwd)/${EXTRACTED_DIR}" >> $GITHUB_ENV
149
138
150
139
- name : Extract sdist (Windows)
151
140
if : runner.os == 'Windows'
152
141
shell : pwsh
153
142
run : |
154
- # Create extraction directory
143
+ # Create extraction directory in the workspace
155
144
New-Item -ItemType Directory -Force -Path "sdist_extract"
156
145
157
- # Find the tarball file (without using wildcards )
146
+ # Extract with tar using the specific file path (no wildcard )
158
147
$tarball = Get-ChildItem -Path "sdist" -Filter "*.tar.gz" | Select-Object -First 1
159
-
160
- # Debug - show what we found
161
- Write-Host "Found tarball: $($tarball.FullName)"
162
-
163
- # Extract using the specific file path (not wildcard)
164
148
tar -xvf $tarball.FullName -C "sdist_extract"
165
149
166
150
# Get the extracted directory name
167
151
$extractedDir = (Get-ChildItem -Path "sdist_extract" -Directory | Select-Object -First 1).FullName
168
152
169
- # Debug - show what we found
170
- Write-Host "Extracted directory: $extractedDir"
153
+ # Verify contents
154
+ Get-ChildItem " $extractedDir"
171
155
172
156
# Set the environment variable
173
157
echo "SDIST_DIR=$extractedDir" | Out-File -FilePath $env:GITHUB_ENV -Append
174
158
175
- # Verify contents
176
- Get-ChildItem $extractedDir
177
-
178
159
- name : Build wheels from sdist
179
160
180
161
env :
@@ -195,8 +176,13 @@ jobs:
195
176
# LD_LIBRARY_PATH in environment is needed by
196
177
# auditwheel (Linux) and delocate (MacOS).
197
178
with :
198
- package-dir : ${{ env.SDIST_DIR }} # Use extracted sdist
179
+ package-dir : ${{ env.SDIST_DIR }}
199
180
output-dir : " dist"
181
+ # Set `package-dir` to a folder with the extracted sdist;
182
+ # otherwise, `cibuildwheel` uses `python -m pip wheel` or
183
+ # `python -m build --wheel` with the repository package
184
+ # folder and we cannot guarantee that wheels can be built
185
+ # from the sdist.
200
186
201
187
- uses : actions/upload-artifact@v4
202
188
with :
@@ -214,11 +200,6 @@ jobs:
214
200
pattern : " dist-*"
215
201
merge-multiple : true
216
202
217
- - uses : actions/download-artifact@v4
218
- with :
219
- path : dist
220
- name : basemap-sdist
221
-
222
203
- name : Set up Python
223
204
uses : actions/setup-python@v5
224
205
with :
@@ -230,26 +211,6 @@ jobs:
230
211
python -m twine check dist/*.tar.gz
231
212
python -m twine check dist/*.whl
232
213
233
- - name : Verify sdist content
234
- run : |
235
- mkdir -p /tmp/sdist_test
236
-
237
- # Find and extract basemap sdist
238
- BASEMAP_SDIST=$(ls dist/basemap-*.tar.gz 2>/dev/null || ls dist/*basemap*.tar.gz 2>/dev/null | head -1)
239
- tar -xvf "$BASEMAP_SDIST" -C /tmp/sdist_test
240
-
241
- # Verify contents
242
- echo "Files in extracted sdist:"
243
- find /tmp/sdist_test -type f | grep -v "__pycache__" | sort
244
-
245
- # Check for critical files
246
- if [ -f "$(find /tmp/sdist_test -name "_geoslib.pyx")" ]; then
247
- echo "✓ Source files verified in sdist"
248
- else
249
- echo "✗ Missing critical source files in sdist"
250
- exit 1
251
- fi
252
-
253
214
docs :
254
215
name : Build documentation
255
216
needs : [build_wheels]
@@ -355,11 +316,6 @@ jobs:
355
316
pattern : " dist-*"
356
317
merge-multiple : true
357
318
358
- - uses : actions/download-artifact@v4
359
- with :
360
- path : dist
361
- name : basemap-sdist
362
-
363
319
- name : Publish to PyPI
364
320
uses : pypa/gh-action-pypi-publish@release/v1
365
321
with :
0 commit comments