From 5ced8d917a1e3722107cae78ec3ed8d44823b2f3 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 29 Jun 2021 11:32:50 +0100 Subject: [PATCH] Pass the correct libdir to the window builder "pg_config --libdir" returns "C:/STRAWB~1/c/lib" Reported in https://github.com/actions/runner/issues/1178 --- .github/workflows/tests.yml | 4 ++++ psycopg_c/setup.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d79e03a8d..d2fee6b5d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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' diff --git a/psycopg_c/setup.py b/psycopg_c/setup.py index ffe8163d1..fed83b2bd 100644 --- a/psycopg_c/setup.py +++ b/psycopg_c/setup.py @@ -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)): -- 2.47.3