← All tasks
pythonpsycopg/psycopg2 #1599Not a task: not reproduced

Build fails with empty `pg_config --cppflags` output

envgap__psycopg__psycopg2-1599

01 / FAILURE SIGNATURE

As reported upstream

Error: b''
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
0c5b5f4ec3b0d2b371f9c579167b36ee12cb072d
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

psycopg/psycopg2 #1599 · read the original issue
**Before opening this ticket, please confirm that:**

- [x] I am running the latest version of pip, i.e. typing ``pip --version`` you get [this version](https://pypi.org/project/pip/).

- [x] I have read the [installation documentation](https://www.psycopg.org/docs/install.html) and the [frequently asked questions](https://www.psycopg.org/docs/faq.html)

- [x] If install failed, I typed `pg_config` on the command line and I obtained an output instead of an error.



**Please complete the following information:**

- OS: FreeBSD, macOS

- Psycopg version: 2.9.6

- Python version: 3.11

- PostgreSQL version: 16beta

- pip version: 23.2



-----------



I'm building psycopg2 against a Meson build of PG16 beta. On the BSDs, this results in the following error:

```

Collecting psycopg2~=2.9.6 (from -r /Users/admin/pgsql/src/test/python/requirements.txt (line 7))

  Downloading psycopg2-2.9.6.tar.gz (383 kB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.0/384.0 kB 13.7 MB/s eta 0:00:00

  Preparing metadata (setup.py): started

  Preparing metadata (setup.py): finished with status 'error'

stderr:

  error: subprocess-exited-with-error

  

  × python setup.py egg_info did not run successfully.

  │ exit code: 1

  ╰─> [21 lines of output]

      /Users/admin/pgsql/build/python_venv/lib/python3.11/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`

      !!

      

              ********************************************************************************

              The license_file parameter is deprecated, use license_files instead.

      

              By 2023-Oct-30, you need to update your project and remove deprecated calls

              or your builds will no longer be supported.

      

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.

              ********************************************************************************

      

      !!

        parsed = self.parsers.get(option_name, lambda x: x)(value)

      running egg_info

      creating /private/var/folders/s0/b8snf7qj1479hhmzr90n5s4m0000gn/T/pip-pip-egg-info-u8mn3a2m/psycopg2.egg-info

      writing /private/var/folders/s0/b8snf7qj1479hhmzr90n5s4m0000gn/T/pip-pip-egg-info-u8mn3a2m/psycopg2.egg-info/PKG-INFO

      writing dependency_links to /private/var/folders/s0/b8snf7qj1479hhmzr90n5s4m0000gn/T/pip-pip-egg-info-u8mn3a2m/psycopg2.egg-info/dependency_links.txt

      writing top-level names to /private/var/folders/s0/b8snf7qj1479hhmzr90n5s4m0000gn/T/pip-pip-egg-info-u8mn3a2m/psycopg2.egg-info/top_level.txt

      writing manifest file '/private/var/folders/s0/b8snf7qj1479hhmzr90n5s4m0000gn/T/pip-pip-egg-info-u8mn3a2m/psycopg2.egg-info/SOURCES.txt'

      Error: b''

      [end of output]

  

  note: This error originates from a subprocess, and is likely not a problem with pip.

```

That `Error: b''` line is coming from https://github.com/psycopg/psycopg2/blob/333b3b7ac45099f7b86ab35ac89152293ac7451d/setup.py#L122-L123 which is treating an empty output from `pg_config` as an error.



But in this case it's not an error -- `pg_config --cppflags` is legitimately empty on this platform and build configuration -- so there's no stderr message. It looks like maybe the `query()` helper should be looking at the process `returncode` instead, or maybe differentiating  queries where an empty response is acceptable from queries where it's not?
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]