summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-09-06 20:29:13 +0100
committerSimon McVittie <smcv@collabora.com>2022-09-06 21:14:26 +0100
commit85c5d7f35aec2fa36557d4ed27e31a572da71b68 (patch)
tree30fba4bf9f25412abf65093972ebe77fac340df4
parent32c3f7966a98a6fd9c23ab2952609a2c3a69ed7f (diff)
downloaddbus-python-85c5d7f35aec2fa36557d4ed27e31a572da71b68.tar.gz
build: Include PKG-INFO, egg-info etc. in dist tarballs again
twine requires at least PKG-INFO, and if we're generating that, we might as well have everything. Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--Makefile.am13
-rwxr-xr-xtools/ci-install.sh18
-rwxr-xr-xtools/generate-pkginfo.py26
3 files changed, 55 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 49bac1d..8738d57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,8 +52,8 @@ EXTRA_DIST = \
tools/check-c-style.sh \
tools/check-coding-style.mk \
tools/check-py-style.sh \
- tools/check-whitespace.sh
- tools/ci-build.sh \
+ tools/check-whitespace.sh \
+ tools/generate-pkginfo.py \
$(NULL)
# === C code ===
@@ -370,13 +370,22 @@ $(patsubst %,%.test,$(test_programs)): %.test: Makefile
dist-hook:
echo $(VERSION) > $(distdir)/.version
+ $(MKDIR_P) $(distdir)/dbus_python.egg-info
touch $(distdir)/MANIFEST
touch $(distdir)/MANIFEST.in
+ touch $(distdir)/dbus_python.egg-info/SOURCES.txt
+ $(PYTHON) $(distdir)/tools/generate-pkginfo.py $(VERSION) $(distdir)/PKG-INFO
+ echo > $(distdir)/dbus_python.egg-info/dependency_links.txt
+ echo _dbus_bindings > $(distdir)/dbus_python.egg-info/top_level.txt
+ echo _dbus_glib_bindings >> $(distdir)/dbus_python.egg-info/top_level.txt
+ echo dbus >> $(distdir)/dbus_python.egg-info/top_level.txt
+ cp $(distdir)/PKG-INFO $(distdir)/dbus_python.egg-info/PKG-INFO
( cd $(distdir) && find -type d -o -print ) | \
LC_ALL=C sort | \
$(SED) -e 's|^\./||' \
> $(distdir)/MANIFEST
sed -e 's/.*/include &/' < $(distdir)/MANIFEST > $(distdir)/MANIFEST.in
+ cp $(distdir)/MANIFEST $(distdir)/dbus_python.egg-info/SOURCES.txt
maintainer-upload:
rsync -tvpP --chmod=ugo=r $(DIST_ARCHIVES) $(DIST_ARCHIVES:%=%.asc) \
diff --git a/tools/ci-install.sh b/tools/ci-install.sh
index ce9864b..f233369 100755
--- a/tools/ci-install.sh
+++ b/tools/ci-install.sh
@@ -162,6 +162,24 @@ case "$ci_distro" in
have_system_meson=true
;;
esac
+
+ # Needed for distcheck
+ case "$ci_suite" in
+ (buster|focal|bullseye)
+ runuser -u user -- \
+ "${dbus_ci_system_python-python3}" -m pip install --user \
+ pyproject_metadata \
+ tomli \
+ ${NULL}
+ ;;
+
+ (*)
+ $sudo apt-get -qq -y install \
+ python3-pyproject-metadata \
+ python3-tomli \
+ ${NULL}
+ ;;
+ esac
;;
(*)
diff --git a/tools/generate-pkginfo.py b/tools/generate-pkginfo.py
new file mode 100755
index 0000000..9e7df21
--- /dev/null
+++ b/tools/generate-pkginfo.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+# Copyright 2021 Quansight, LLC
+# Copyright 2021 Filipe LaĆ­ns
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+# Generate a PKG-INFO file using a very small subset of meson-python.
+
+import sys
+from pathlib import Path
+
+import pyproject_metadata
+import tomli
+
+if __name__ == '__main__':
+ top_srcdir = Path(__file__).parent.parent
+
+ with open(top_srcdir / 'pyproject.toml') as reader:
+ conf = tomli.loads(reader.read())
+
+ meta = pyproject_metadata.StandardMetadata.from_pyproject(conf, top_srcdir)
+ meta.version = sys.argv[1]
+ core_metadata = meta.as_rfc822()
+
+ with open(sys.argv[2], 'wb') as writer:
+ writer.write(bytes(core_metadata))