Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Python packaging tools can't resolve the package metadata without `libsystemd`

未关闭
#167 19 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, python
领域
build-system

调研方向

Start by reproducing the uv sync failure for systemd-python==235 on a non-Linux platform without libsystemd, then read the Meson build configuration and the linked meson-python issue. Evaluate the proposed optional C-extension approach; done means package metadata can be resolved without those libraries while preserving the stated runtime behavior.

由索引模型根据 Issue 内容生成。

描述

I ran into this whilst trying to move my project to replace poetry with uv.

One interesting property of uv, is that it creates a lockfile that works for all platforms. This means that even if systemd-python is only installed on Linux ("systemd-python>=231; sys_platform == 'linux'" in the dependencies), it needs to be able to resolve the package metadata.

The problem is, as far as I can tell, mesonpy always run the meson build, even just for resolving the package metadata. And because the current meson build will hard-fail if libsystemd isn't available, regardless of the platform, it makes generating/updating the uv lockfile impossible on non-linux platforms.

❯ uv sync
  × Failed to build `systemd-python==235`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stderr]
      Cannot find libsystemd or libsystemd-journal:

      Package libsystemd was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libsystemd.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libsystemd' found

      Package libsystemd-journal was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libsystemd-journal.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libsystemd-journal' found


      hint: This usually indicates a problem with the package or the build environment.
  help: `systemd-python` (v235) was included because `matrix-synapse[systemd]` (v1.148.0rc1) depends on `systemd-python>=231`

Some background about this issue on the mesonpy side can be read here: https://github.com/mesonbuild/meson-python/issues/236

Now, this could be solved by making the C extension optional, and throw at runtime if it was built without it. It's not ideal, it would stop failing at build-time, but would make it possible to use python-systemd in projects using uv without requiring libsystemd to be available

Another very creative solution would be to write a special build backend which delegates to mesonpy in most cases, but provides its own prepare_metadata_for_build_wheel implementation… but that feels a bit overkill

Last but not least, using another build backend than mesonpy could be a solution, but definitely more involved.

I'll put up a draft PR for the first solution shortly to let you evaluate how that feels

主要语言
C
星标
522
派生
79
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

systemd/python-systemd 的其他 Issue

查看 systemd/python-systemd 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。