]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Pass the correct libdir to the window builder
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 10:32:50 +0000 (11:32 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 12:47:52 +0000 (13:47 +0100)
"pg_config --libdir" returns "C:/STRAWB~1/c/lib"

Reported in https://github.com/actions/runner/issues/1178

.github/workflows/tests.yml
psycopg_c/setup.py

index d79e03a8d22b9e453c1e567c6d0ccd507c8a6433..d2fee6b5d677d344f2f77ac6cffe5c613c7b4cb8 100644 (file)
@@ -153,3 +153,7 @@ jobs:
       - name: Run tests (C implementation)
         run: tox -c psycopg_c -e ${{ matrix.python }} -- --color yes
         if: ${{ matrix.impl == 'c' }}
+        env:
+          # the pg_config returns the wrong path
+          # Note: this env var name must be in the tox.ini passenv
+          PG_LIBPATH: 'C:\Program Files\PostgreSQL\13\lib'
index ffe8163d10ff1ca3d8fa53ec0ea76c1853c58b64..fed83b2bd62cb69aebc161ea20c0c4f5773557d9 100644 (file)
@@ -58,6 +58,12 @@ class psycopg_build_ext(build_ext):
             ext.include_dirs.append(includedir)
             ext.library_dirs.append(libdir)
 
+            # hack to build on GH Actions (pg_config --libdir broken)
+            # https://github.com/actions/runner/issues/1178
+            for path in os.environ.get("PG_LIBPATH", "").split(os.pathsep):
+                if path:
+                    ext.library_dirs.append(path)
+
         if cythonize is not None:
             for ext in self.distribution.ext_modules:
                 for i in range(len(ext.sources)):