Skip to content

Commit cbec630

Browse files
committed
ensure pkg build/ exists
and set libgit2 version env var
1 parent 361b239 commit cbec630

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

build.ps1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
if (Test-Path -Path $env:LIBGIT2_SRC) {
2-
Set-Location $env:LIBGIT2_SRC
1+
if (!(Test-Path -Path "build")) {
2+
# in case the pygit2 package build/ workspace has not been created by cibuildwheel yet
3+
mkdir build
4+
}
5+
if (Test-Path -Path "$env:LIBGIT2_SRC") {
6+
Set-Location "$env:LIBGIT2_SRC"
7+
# for local runs, reuse build/libgit_src if it exists
38
if (Test-Path -Path build) {
9+
# purge previous build env (likely for a different arch type)
410
Remove-Item -Recurse -Force build
511
}
12+
# ensure we are checked out to the right version
613
git fetch --depth=1 --tags
7-
git checkout v$env:LIBGIT2_VERSION
14+
git checkout "v$env:LIBGIT2_VERSION"
815
} else {
9-
git clone --depth=1 -b v$env:LIBGIT2_VERSION https://github.com/libgit2/libgit2.git $env:LIBGIT2_SRC
10-
Set-Location $env:LIBGIT2_SRC
16+
# from a fresh run (like in CI)
17+
git clone --depth=1 -b "v$env:LIBGIT2_VERSION" https://github.com/libgit2/libgit2.git $env:LIBGIT2_SRC
18+
Set-Location "$env:LIBGIT2_SRC"
1119
}
1220
cmake -B build -S . -DBUILD_TESTS=OFF
1321
cmake --build build/ --config=Release --target install

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ repair-wheel-command = "DYLD_LIBRARY_PATH=/Users/runner/work/pygit2/pygit2/ci/li
2626

2727
[tool.cibuildwheel.windows]
2828
environment.LIBGIT2_SRC = "build/libgit2_src"
29+
environment.LIBGIT2_VERSION = "1.9.1"
2930
before-all = "powershell -File build.ps1"
3031

3132
[[tool.cibuildwheel.overrides]]

0 commit comments

Comments
 (0)