Skip to content

[py-psycopg-c] Make it usable without pg_config#240

Merged
3nids merged 2 commits into
mainfrom
fix-py-psycopg-c-pg-config-again
May 26, 2026
Merged

[py-psycopg-c] Make it usable without pg_config#240
3nids merged 2 commits into
mainfrom
fix-py-psycopg-c-pg-config-again

Conversation

@3nids

@3nids 3nids commented May 22, 2026

Copy link
Copy Markdown
Collaborator

so yes pg_config is not in bin anymore (I checked on my system, it was in bin before) but since a recent change upstream to package using meson, it's not anymore.

see microsoft/vcpkg#51250

PR #237 ended up merging the revert (commit 4c56d3c "Update PG_CONFIG path for non-Windows systems") which restored the wrong tools/libpq/bin/pg_config path. libpq's portfile calls vcpkg_copy_tools(TOOL_NAMES pg_config ... AUTO_CLEAN) with no DESTINATION, and vcpkg_copy_tools.cmake (line 13) defaults DESTINATION to ${CURRENT_PACKAGES_DIR}/tools/${PORT}, so pg_config lands at tools/libpq/pg_config (no /bin). Restore the correct path and bump port-version to 4.
@3nids 3nids requested a review from m-kuhn May 22, 2026 08:46
@m-kuhn

m-kuhn commented May 22, 2026

Copy link
Copy Markdown
Contributor

We could add a python script that mimics pg_config (compare: https://github.com/psycopg/psycopg/blob/master/tools/ci/pg_config_vcpkg_stub/pg_config_vcpkg_stub/__init__.py), ideally directly as part of this port

@m-kuhn m-kuhn force-pushed the fix-py-psycopg-c-pg-config-again branch from 73c3572 to 53901ff Compare May 22, 2026 19:43
@m-kuhn m-kuhn changed the title [py-psycopg-c] Re-fix pg_config path on non-Windows [py-psycopg-c] Make it usable without pg_config May 22, 2026
@3nids

3nids commented May 23, 2026

Copy link
Copy Markdown
Collaborator Author

you'd prefer to wait to see what's happening upstream?

@3nids 3nids merged commit 1578c39 into main May 26, 2026
7 of 9 checks passed
@3nids 3nids deleted the fix-py-psycopg-c-pg-config-again branch May 26, 2026 09:46
3nids added a commit to qgis/QGIS that referenced this pull request May 26, 2026
Integrates open-vcpkg/python-registry#240 ([py-psycopg-c] Make it usable without pg_config) which fixes the pg_config path issue on non-Windows post-meson refactor of microsoft/vcpkg's libpq port.
3nids added a commit that referenced this pull request May 27, 2026
Mirrors the stub-based approach from py-psycopg-c (PR #240): drop a tiny pg_config shim on PATH that returns vcpkg-relative paths for --includedir / --libdir. Fixes 'pg_config executable not found' on macOS arm after microsoft/vcpkg#51250 moved pg_config from tools/libpq/bin/ to tools/libpq/.
3nids added a commit to qgis/QGIS that referenced this pull request May 28, 2026
* Bump vcpkg baselines

* error report when building with vcpkg

* handle case when there is no artifact

* do not rely on /tmp

* fix encoding

* link to error log echoed in workflow

* add python overlay to test zlib detection

* [python3 overlay] Skip ZLIB_DEBUG lookup on release-only triplets

VCPKG_BUILD_TYPE=release triplets (e.g. x64-windows-release) don't install debug libs, so find_library(ZLIB_DEBUG ... REQUIRED) fails fatally even though add_libs_dbg is unused in release-only builds. Gate the debug lookup on the build type.

* vcpkg_build_failures_report: surface portfile-execute aborts

Two related fixes for the case where vcpkg fails before any port leaves a parseable buildtree (e.g. a CMake Error in portfile.cmake from find_library REQUIRED, or vcpkg_extract_source_archive download failure). Previously the parser saw nothing and the report claimed 'all ports built ✅' despite a non-zero exit code.

1. parse_failures.py: new --manifest-install-log option that scans vcpkg-manifest-install.log for 'error: building <port>:<triplet> failed with: BUILD_FAILED' lines and 'CMake Error at .../ports/<port>/portfile.cmake' blocks, synthesizing failure records (with excerpts) for ports that never produced a buildtree.

2. format_report.py + action.yml: new build-status input. When the upstream build/configure step failed but no per-port failures were parsed, render a 'vcpkg failed before producing per-port logs' banner with links to the artifacts/run instead of the misleading 'all ports built' line.

Both windows-qt6.yml and build-macos-qt6.yml now pass build-status=${{ job.status }} and manifest-install-log=${{ github.workspace }}/build/vcpkg-manifest-install.log.

* [python3 overlay] Align ZLIB find_library names with microsoft/vcpkg#51235

Drop the REQUIRED + VCPKG_BUILD_TYPE gating in favour of the broader name set used in the upstream vcpkg fix (which also handles the static linkage 'zs.lib' / 'zsd.lib' produced by the new zlib 1.3.2 port).

  release: z zs zlib

  debug:   zd zsd zlibd

Ref: microsoft/vcpkg#51235

* vcpkg_build_failures_report: escape ${{ in build-status description

GitHub evaluates ${{ ... }} expressions inside input descriptions too, so the previous wording caused the composite action to fail to load with 'Unrecognized named-value: job'. Rephrase the description to avoid the expression syntax.

Fixes the action.yml validation error seen in workflow run 69945800777.

* [py-psycopg-c] Fix pg_config path on non-Windows

libpq's portfile uses vcpkg_copy_tools(TOOL_NAMES pg_config ...) without a DESTINATION, so the binary lands at tools/libpq/pg_config — not tools/libpq/bin/pg_config. The else() branch of py-psycopg-c had the wrong path, causing the build to fall back to PATH lookup of pg_config (not present) and fail with 'No such file or directory'. Match the Windows branch which already uses tools/libpq with no /bin.

Failure seen on arm64-osx-dynamic-release / x64-osx-dynamic-release in workflow run 69945800777.

* vcpkg overlays: drop libxml2 and py-psycopg-c (fixed upstream)

Both fixes have landed in their respective upstream registries (microsoft/vcpkg for libxml2, open-vcpkg/python-registry for py-psycopg-c). The overlay copies are no longer needed.

* vcpkg: bump python-registry baseline to 17723c4

Pulls in py-psycopg-c 3.3.4#3 (pg_config path fix) and other recent updates from open-vcpkg/python-registry.

* vcpkg_build_failures_report: surface commit SHA in sticky comment

Adds an optional commit-sha input. When set, the rendered report footer shows a linked short SHA (e.g. 📌 Commit `abc1234`) so reviewers know which revision the sticky comment reflects.

Wired up the windows-qt6 and build-macos-qt6 workflows to pass github.event.pull_request.head.sha (with fallback to github.sha).

* remove python overlay

* Restore libxml2 overlay (dropped prematurely)

* bump python-reg

* vcpkg: bump python-registry baseline to 1578c39

Integrates open-vcpkg/python-registry#240 ([py-psycopg-c] Make it usable without pg_config) which fixes the pg_config path issue on non-Windows post-meson refactor of microsoft/vcpkg's libpq port.

* bump pr

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

* Update vcpkg.json

---------

Co-authored-by: 3nids <127259+3nids@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants