]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Fix Windows package build
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 18 Jul 2021 23:32:24 +0000 (01:32 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 18 Jul 2021 23:53:21 +0000 (01:53 +0200)
The package was built with a libpq 11, found along the path in the PHP
dir. And with the libiconv found in the Git directory. All very
worrying.

So, add to the PATH the Postgres bin directory and deal with the
delvewheel exception of libiconv (mentioned in
https://github.com/adang1345/delvewheel/issues/13).

Also fix confusion about where does this stuff run and where is the
server. There is no Docker image here, so we can start the server from
the workflow steps and access it from cibiuldwheel on localhost.

.github/workflows/packages.yml
tools/build/wheel_windows_before_all.ps1 [deleted file]

index 54e5269cfe3311fa77a660b7536a424aa8afa649..b1ba335c6e0a63ee2c504a841783e267ad0cdade 100644 (file)
@@ -68,8 +68,8 @@ jobs:
 
     strategy:
       matrix:
-        pyver: [cp36, cp37, cp38, cp39]
         arch: [x86_64, i686, ppc64le, aarch64]
+        pyver: [cp36, cp37, cp38, cp39]
 
     steps:
       - uses: actions/checkout@v2
@@ -92,7 +92,7 @@ jobs:
           CIBW_BUILD: ${{matrix.pyver}}-manylinux_${{matrix.arch}}
           CIBW_ARCHS_LINUX: auto aarch64 ppc64le
           CIBW_BEFORE_ALL_LINUX: ./tools/build/wheel_linux_before_all.sh
-          CIBW_BEFORE_TEST: pip install ./psycopg[test]
+          CIBW_TEST_REQUIRES: ./psycopg[test]
           CIBW_TEST_COMMAND: pytest {project}/tests -m 'not slow' --color yes
           CIBW_ENVIRONMENT: >-
             PSYCOPG_IMPL=binary
@@ -124,9 +124,9 @@ jobs:
 
     strategy:
       matrix:
-        pyver: [cp36, cp37, cp38, cp39]
-        arch: [x86_64]
         # These archs require an Apple M1 runner: [arm64, universal2]
+        arch: [x86_64]
+        pyver: [cp36, cp37, cp38, cp39]
 
     steps:
       - uses: actions/checkout@v2
@@ -142,7 +142,7 @@ jobs:
           CIBW_BUILD: ${{matrix.pyver}}-macosx_${{matrix.arch}}
           CIBW_ARCHS_MACOS: x86_64 arm64 universal2
           CIBW_BEFORE_ALL_MACOS: ./tools/build/wheel_macos_before_all.sh
-          CIBW_BEFORE_TEST: pip install ./psycopg[test]
+          CIBW_TEST_REQUIRES: ./psycopg[test]
           CIBW_TEST_COMMAND: pytest {project}/tests -m 'not slow' --color yes
           CIBW_ENVIRONMENT: >-
             PSYCOPG_IMPL=binary
@@ -159,13 +159,19 @@ jobs:
 
     strategy:
       matrix:
-        pyver: [cp36, cp37, cp38, cp39]
-        arch: [win_amd64]
         # Might want to add win32, untested at the moment.
+        arch: [win_amd64]
+        pyver: [cp36, cp37, cp38, cp39]
 
     steps:
       - uses: actions/checkout@v2
 
+      - name: Start PostgreSQL service for test
+        run: |
+          $PgSvc = Get-Service "postgresql*"
+          Set-Service $PgSvc.Name -StartupType manual
+          $PgSvc.Start()
+
       - name: Create the binary package source tree
         run: python3 ./tools/build/copy_to_binary.py
 
@@ -176,17 +182,15 @@ jobs:
         env:
           CIBW_BUILD: ${{matrix.pyver}}-${{matrix.arch}}
           CIBW_ARCHS_WINDOWS: AMD64 x86
-          CIBW_BEFORE_ALL_WINDOWS: >-
-            powershell.exe tools\build\wheel_windows_before_all.ps1
-          CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
+          CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
           CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
-            delvewheel repair -w {dest_dir} {wheel}
-          CIBW_BEFORE_TEST: pip install ./psycopg[test]
+            delvewheel repair -w {dest_dir} --no-mangle libiconv-2.dll {wheel}
+          CIBW_TEST_REQUIRES: ./psycopg[test]
           CIBW_TEST_COMMAND: pytest {project}/tests -m "not slow" --color yes
           CIBW_ENVIRONMENT_WINDOWS: >-
             PSYCOPG_IMPL=binary
-            PSYCOPG_TEST_DSN='host=127.0.0.1 user=postgres'
-            PG_CONFIG='C:\Program Files\PostgreSQL\13\bin\pg_config.exe'
+            PATH="C:\\Program Files\\PostgreSQL\\13\\bin;$PATH"
+            PSYCOPG_TEST_DSN="host=127.0.0.1 user=postgres"
 
       - uses: actions/upload-artifact@v2
         with:
diff --git a/tools/build/wheel_windows_before_all.ps1 b/tools/build/wheel_windows_before_all.ps1
deleted file mode 100755 (executable)
index e7bffe3..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Start PostgreSQL service for test
-$PgSvc = Get-Service "postgresql*"
-Set-Service $PgSvc.Name -StartupType manual
-$PgSvc.Start()