3434 run : |
3535 cd packages/${{ matrix.package }}
3636 python -m pip install build wheel
37- python -m build --sdist --wheel
37+ python -m build
3838
3939 - uses : actions/upload-artifact@v4
4040 with :
@@ -63,10 +63,10 @@ jobs:
6363 - uses : actions/upload-artifact@v4
6464 with :
6565 path : packages/basemap/dist/*.tar.gz
66- name : basemap-sdist
66+ name : dist- basemap-sdist
6767
6868 build_wheels :
69- name : Build wheels on ${{ matrix.os }}
69+ name : Build basemap wheels
7070 needs : [build_data, build_sdist]
7171 strategy :
7272 matrix :
8080 with :
8181 python-version : " 3.9"
8282
83- - name : Download basemap sdist
84- uses : actions/download-artifact@v4
85- with :
86- name : basemap-sdist
87- path : ./sdist/
88-
8983 - name : Download data packages
9084 uses : actions/download-artifact@v4
9185 with :
@@ -97,38 +91,31 @@ jobs:
9791 if : runner.os != 'Windows'
9892 shell : bash
9993 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
10495 python -m pip install ./data_packages/*.whl
10596
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 ')"
10899
109- # Install the data packages (Windows)
110100 - name : Install data packages (Windows)
111101 if : runner.os == 'Windows'
112102 shell : pwsh
113103 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
118105 $wheels = Get-ChildItem -Path "./data_packages" -Filter "*.whl" -Recurse
119-
120- # Install each wheel file
121106 foreach ($wheel in $wheels) {
122107 Write-Host "Installing $($wheel.FullName)"
123108 python -m pip install $wheel.FullName
124109 }
125110
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') "
128113
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/
132119
133120 - name : Extract sdist (Linux/macOS)
134121 if : runner.os != 'Windows'
@@ -137,44 +124,38 @@ jobs:
137124 # Create extraction directory in the workspace
138125 mkdir -p ./sdist_extract
139126
140- # Extract using tar (Unix-style)
127+ # Extract with tar using wildcard
141128 tar -xvf ./sdist/*.tar.gz -C ./sdist_extract
142129
143130 # 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)"
146132
147133 # 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
149138
150139 - name : Extract sdist (Windows)
151140 if : runner.os == 'Windows'
152141 shell : pwsh
153142 run : |
154- # Create extraction directory
143+ # Create extraction directory in the workspace
155144 New-Item -ItemType Directory -Force -Path "sdist_extract"
156145
157- # Find the tarball file (without using wildcards )
146+ # Extract with tar using the specific file path (no wildcard )
158147 $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)
164148 tar -xvf $tarball.FullName -C "sdist_extract"
165149
166150 # Get the extracted directory name
167151 $extractedDir = (Get-ChildItem -Path "sdist_extract" -Directory | Select-Object -First 1).FullName
168152
169- # Debug - show what we found
170- Write-Host "Extracted directory: $extractedDir"
153+ # Verify contents
154+ Get-ChildItem " $extractedDir"
171155
172156 # Set the environment variable
173157 echo "SDIST_DIR=$extractedDir" | Out-File -FilePath $env:GITHUB_ENV -Append
174158
175- # Verify contents
176- Get-ChildItem $extractedDir
177-
178159 - name : Build wheels from sdist
179160 uses : pypa/cibuildwheel@v2.22.0
180161 env :
@@ -195,8 +176,13 @@ jobs:
195176 # LD_LIBRARY_PATH in environment is needed by
196177 # auditwheel (Linux) and delocate (MacOS).
197178 with :
198- package-dir : ${{ env.SDIST_DIR }} # Use extracted sdist
179+ package-dir : ${{ env.SDIST_DIR }}
199180 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.
200186
201187 - uses : actions/upload-artifact@v4
202188 with :
@@ -214,11 +200,6 @@ jobs:
214200 pattern : " dist-*"
215201 merge-multiple : true
216202
217- - uses : actions/download-artifact@v4
218- with :
219- path : dist
220- name : basemap-sdist
221-
222203 - name : Set up Python
223204 uses : actions/setup-python@v5
224205 with :
@@ -230,26 +211,6 @@ jobs:
230211 python -m twine check dist/*.tar.gz
231212 python -m twine check dist/*.whl
232213
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-
253214 docs :
254215 name : Build documentation
255216 needs : [build_wheels]
@@ -355,11 +316,6 @@ jobs:
355316 pattern : " dist-*"
356317 merge-multiple : true
357318
358- - uses : actions/download-artifact@v4
359- with :
360- path : dist
361- name : basemap-sdist
362-
363319 - name : Publish to PyPI
364320 uses : pypa/gh-action-pypi-publish@release/v1
365321 with :
0 commit comments