public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/swig] f43: Add python3-swig with Python package metadata
@ 2026-06-11 11:19 Yaakov Selkowitz
  0 siblings, 0 replies; only message in thread
From: Yaakov Selkowitz @ 2026-06-11 11:19 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/swig
            Branch : f43
            Commit : 629969e878236279bd395d5700813d9770e022a6
            Author : Yaakov Selkowitz <yselkowi@redhat.com>
            Date   : 2026-06-10T13:14:40+02:00
            Stats  : +32/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/swig/c/629969e878236279bd395d5700813d9770e022a6?branch=f43

            Log:
            Add python3-swig with Python package metadata

SWIG is also packaged on PyPI via https://github.com/nightlark/swig-pypi.
For example, the Python bindings in gpgme now use this:

[build-system]
requires = ["setuptools", "swig"]
build-backend = "setuptools.build_meta"

When %pyproject_buildrequires is run against such a package, a
BuildRequires on python3dist(swig) is generated.  This will fulfill such a
requirement, and allow the package to build without bypassing dynamic BRs.

The PyPI project also includes a swig "module", but that only serves as a
script entrypoint which wraps the bundled version.  We don't need that
here as we already have a real /usr/bin/swig, and "import swig" is not a
documented use case for the "module".

---
diff --git a/swig.spec b/swig.spec
index 4861e11..9a5711c 100644
--- a/swig.spec
+++ b/swig.spec
@@ -69,7 +69,7 @@
 Summary: Connects C/C++/Objective C to some high-level programming languages
 Name:    swig
 Version: 4.3.1
-Release: 5%{?dist}
+Release: 6%{?dist}
 License: GPL-3.0-or-later AND BSD-3-Clause
 URL:     https://www.swig.org/
 Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
@@ -189,6 +189,17 @@ Requires:  swig
 This package contains file with commands for easier debugging of SWIG
 in gdb.
 
+%if %{python3lang}
+%package -n python%{python3_pkgversion}-swig
+Summary:   Python package metadata for SWIG
+Requires:  swig = %{version}-%{release}
+BuildArch: noarch
+
+%description -n python%{python3_pkgversion}-swig
+This package registers swig as installed for Python with pip for the
+purpose of using "swig" in build-system.requires of a pyproject.toml file.
+%endif
+
 %prep
 %autosetup -p1
 
@@ -344,6 +355,18 @@ install -pm 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d
 mkdir -p %{buildroot}%{_datadir}/%{name}/gdb
 install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
 
+%if %{python3lang}
+# Create python package metadata
+mkdir -p %{buildroot}%{python3_sitelib}/swig-%{version}.dist-info
+echo "rpm" > %{buildroot}%{python3_sitelib}/swig-%{version}.dist-info/INSTALLER
+cat > %{buildroot}%{python3_sitelib}/swig-%{version}.dist-info/METADATA <<_EOF
+Metadata-Version: 2.1
+Name: swig
+Version: %{version}
+_EOF
+%endif
+
+
 %files
 %{_bindir}/%{name}
 %{_datadir}/%{name}
@@ -367,7 +390,15 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
 %files gdb
 %{_datadir}/%{name}/gdb
 
+%if %{python3lang}
+%files -n python%{python3_pkgversion}-swig
+%{python3_sitelib}/swig-%{version}.dist-info/
+%endif
+
 %changelog
+* Thu Jan 08 2026 Yaakov Selkowitz <yselkowi@redhat.com> - 4.3.1-6
+- Add python3-swig with Python package metadata
+
 * Thu Aug 07 2025 Orion Poplawski <orion@nwra.com> - 4.3.1-5
 - Rebuild for Octave 10.2
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-11 11:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 11:19 [rpms/swig] f43: Add python3-swig with Python package metadata Yaakov Selkowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox