Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with empty pg_config --cppflags output #1599

Closed
3 tasks done
jchampio opened this issue Jul 17, 2023 · 1 comment · Fixed by #1600
Closed
3 tasks done

Build fails with empty pg_config --cppflags output #1599

jchampio opened this issue Jul 17, 2023 · 1 comment · Fixed by #1600

Comments

@jchampio
Copy link
Contributor

Before opening this ticket, please confirm that:

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

psycopg2/setup.py

Lines 122 to 123 in 333b3b7

if not result:
raise Warning(pg_config_process.stderr.readline())
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?

@jchampio jchampio changed the title Build fails with empty pg_config output Build fails with empty pg_config --cppflags output Jul 17, 2023
@dvarrazzo
Copy link
Member

dvarrazzo commented Jul 18, 2023 via email

jchampio added a commit to jchampio/psycopg2 that referenced this issue Jul 19, 2023
- Differentiate between unexpected empty values and execution failure.
- Accept empty --cppflags and --ldflags output. Fixes psycopg#1599.
- Accept UTF-8 output from pg_config, for alternative client locales.
pking-moj pushed a commit to ministryofjustice/laa-crime-application-store that referenced this issue Jan 15, 2024
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.7
to 2.9.9.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psycopg/psycopg2/blob/master/NEWS">psycopg2-binary's
changelog</a>.</em></p>
<blockquote>
<h2>Current release</h2>
<p>What's new in psycopg 2.9.9
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for Python 3.12.</li>
<li>Drop support for Python 3.6.</li>
</ul>
<p>What's new in psycopg 2.9.8
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Wheel package bundled with PostgreSQL 16 libpq in order to add
support for
recent features, such as <code>sslcertmode</code>.</li>
</ul>
<p>What's new in psycopg 2.9.7
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Fix propagation of exceptions raised during module initialization

(:ticket:<code>[#1598](https://github.com/psycopg/psycopg2/issues/1598)</code>).</li>
<li>Fix building when pg_config returns an empty string
(:ticket:<code>[#1599](https://github.com/psycopg/psycopg2/issues/1599)</code>).</li>
<li>Wheel package bundled with OpenSSL 1.1.1v.</li>
</ul>
<p>What's new in psycopg 2.9.6
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Package manylinux 2014 for aarch64 and ppc64le platforms, in order
to
include libpq 15 in the binary package
(:ticket:<code>[#1396](https://github.com/psycopg/psycopg2/issues/1396)</code>).</li>
<li>Wheel package bundled with OpenSSL 1.1.1t.</li>
</ul>
<p>What's new in psycopg 2.9.5
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for Python 3.11.</li>
<li>Add support for rowcount in MERGE statements in binary packages

(:ticket:<code>[#1497](https://github.com/psycopg/psycopg2/issues/1497)</code>).</li>
<li>Wheel package bundled with OpenSSL 1.1.1r and PostgreSQL 15
libpq.</li>
</ul>
<p>What's new in psycopg 2.9.4
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Fix <code>~psycopg2.extras.register_composite()</code>,
<code>~psycopg2.extras.register_range()</code> with customized
:sql:<code>search_path</code>

(:ticket:<code>[#1487](https://github.com/psycopg/psycopg2/issues/1487)</code>).</li>
<li>Handle correctly composite types with names or in schemas requiring
escape.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psycopg/psycopg2/commit/ad5bee7054519d87f25bc5828c502b2ebe197049"><code>ad5bee7</code></a>
chore: bump version number to 2.9.9</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/37d1de1c8f446478666258f4370315f554efa16f"><code>37d1de1</code></a>
chore: add support for Python 3.12</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/abf2723c0a9d89740b433bf49b82ad765e87d5d4"><code>abf2723</code></a>
chore: drop support for Python 3.6</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/2da65a715c71fa5a242fce016835ba500376bf28"><code>2da65a7</code></a>
chore: drop leftover Python 2.7 import aliases from setup.py</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/3fa60fd26839a7e8b083ed3eb3dc592a0f2604f6"><code>3fa60fd</code></a>
chore: bump doc requirement complained by dependabot</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/1c1484e43bdd4927ac5725d4f250b198fbe7600f"><code>1c1484e</code></a>
ci: better interaction with scaleway build server</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/c81cec604f467dfb4fc87c9cbaaf4b758b4ca740"><code>c81cec6</code></a>
chore: bump to next dev release</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/7fe8cb77ca68a06c96d4551c6c9f8cab33904d2a"><code>7fe8cb7</code></a>
chore: bump docs requirements dependabot complains about</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/b39d5d64923a3e321672847bd57c002145f57430"><code>b39d5d6</code></a>
chore: bundle libpq 16</li>
<li><a
href="https://github.com/psycopg/psycopg2/commit/921510d5be7bc2f2dbf7ff3ce613ad0623de79f2"><code>921510d</code></a>
docs: replace &quot;compiled against&quot; with &quot;bundled with&quot;
in news file</li>
<li>Additional commits viewable in <a
href="https://github.com/psycopg/psycopg2/compare/2.9.7...2.9.9">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg2-binary&package-manager=pip&previous-version=2.9.7&new-version=2.9.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@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 a pull request may close this issue.

2 participants