Skip to content

Commit a5a9c7a

Browse files
committed
[ci] fix macos wheel building error
1 parent e2d6c3e commit a5a9c7a

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/build_macos_wheel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
- name: Build wheel
4949
run: |
5050
cd python/
51-
pip install build setuptools wheel
52-
python -m build --wheel
51+
pip install setuptools wheel
52+
pip wheel . --no-deps -w dist/
5353
ls dist/
5454
- name: Run unit tests
5555
run: |

.github/workflows/build_windows_wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
upload_windows_wheels:
5555
needs: build_windows_wheels
56-
runs-on: ubuntu-22.04
56+
runs-on: ubuntu-latest
5757
if: ${{ github.repository_owner == 'NeuroJSON' && needs.build_windows_wheels.outputs.perform_pypi_upload == 1 && github.event_name != 'pull_request'}}
5858
permissions:
5959
id-token: write

python/setup.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545

4646
def ensure_csrc():
4747
"""Copy C sources from parent directory into csrc/ if needed."""
48-
if os.path.isdir(os.path.join(csrc_dir, "src")):
48+
csrc_src = os.path.join(csrc_dir, "src")
49+
if os.path.isdir(csrc_src) and os.path.isfile(os.path.join(csrc_src, "zmatlib.c")):
4950
return # already populated
5051

5152
if not os.path.isdir(parent_srcdir):
52-
return # no parent sources available (pure sdist build)
53+
return # no parent sources available (pure sdist build, csrc should be in tree)
5354

5455
parent = os.path.join(here, "..")
5556
for src_rel, dst_rel in COPY_ITEMS:
@@ -67,7 +68,21 @@ def ensure_csrc():
6768

6869

6970
# copy sources into csrc/ so all paths are within setup.py's directory
71+
# must change to setup.py's directory first so relative paths work
72+
_orig_cwd = os.getcwd()
73+
os.chdir(here)
7074
ensure_csrc()
75+
os.chdir(_orig_cwd)
76+
77+
# verify csrc exists
78+
csrc_src = os.path.join(csrc_dir, "src")
79+
if not os.path.isdir(csrc_src):
80+
import warnings
81+
82+
warnings.warn(
83+
"csrc/src/ not found - C sources may be missing. "
84+
"Build from a full git checkout or a complete sdist."
85+
)
7186

7287
# all paths are relative to here, inside csrc/
7388
srcdir = os.path.join("csrc", "src")

0 commit comments

Comments
 (0)