public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: - python 3 string and file compatibility fixes
@ 2026-11-23 9:28 Panu Matilainen
0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23 9:28 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 7bc2daa0ccabde92ac4686d375fedd5b341ca538
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2013-11-18T11:11:18+02:00
Stats : +65/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/7bc2daa0ccabde92ac4686d375fedd5b341ca538?branch=pmatilai-v6
Log:
- python 3 string and file compatibility fixes
---
diff --git a/rpm-4.11.1-py3-fixes.patch b/rpm-4.11.1-py3-fixes.patch
new file mode 100644
index 0000000..63ad2a8
--- /dev/null
+++ b/rpm-4.11.1-py3-fixes.patch
@@ -0,0 +1,59 @@
+commit 62bdcc0a32d07a7423876b3ae17900da04eb8a97
+Author: Jan Silhan <jsilhan@redhat.com>
+Date: Fri Oct 18 18:30:52 2013 +0200
+
+ Python 3 compatibility fixes
+
+ - Use open() instead of calling file constructor
+ - Borrow python-six trick of dealing with difference in string types
+
+ Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
+
+diff --git a/python/rpm/transaction.py b/python/rpm/transaction.py
+index 756e893..df72ce9 100644
+--- a/python/rpm/transaction.py
++++ b/python/rpm/transaction.py
+@@ -1,8 +1,14 @@
+ #!/usr/bin/python
+
++import sys
+ import rpm
+ from rpm._rpm import ts as TransactionSetCore
+
++if sys.version_info[0] == 3:
++ _string_types = str,
++else:
++ _string_types = basestring,
++
+ # TODO: migrate relevant documentation from C-side
+ class TransactionSet(TransactionSetCore):
+ _probFilter = 0
+@@ -45,14 +51,14 @@ class TransactionSet(TransactionSetCore):
+ return tuple(keys)
+
+ def addInstall(self, item, key, how="u"):
+- if isinstance(item, basestring):
+- f = file(item)
++ if isinstance(item, _string_types):
++ f = open(item)
+ header = self.hdrFromFdno(f)
+ f.close()
+- elif isinstance(item, file):
+- header = self.hdrFromFdno(item)
+- else:
++ elif isinstance(item, rpm.hdr):
+ header = item
++ else:
++ header = self.hdrFromFdno(item)
+
+ if not how in ['u', 'i']:
+ raise ValueError('how argument must be "u" or "i"')
+@@ -69,7 +75,7 @@ class TransactionSet(TransactionSetCore):
+ hdrs = item
+ elif isinstance(item, int):
+ hdrs = self.dbMatch(rpm.RPMDBI_PACKAGES, item)
+- elif isinstance(item, basestring):
++ elif isinstance(item, _string_types):
+ hdrs = self.dbMatch(rpm.RPMDBI_LABEL, item)
+ else:
+ raise TypeError("invalid type %s" % type(item))
diff --git a/rpm.spec b/rpm.spec
index 90d04fa..abf729d 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}9%{?dist}
+Release: %{?snapver:0.%{snapver}.}10%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.11.x/%{name}-%{srcver}.tar.bz2
@@ -55,6 +55,7 @@ Patch104: rpm-4.11.1-caps-double-free.patch
Patch105: rpm-4.11.1-empty-lua-script.patch
Patch106: rpm-4.11.1-ppc64le.patch
Patch107: rpm-4.11.1-application-provides.patch
+Patch108: rpm-4.11.1-py3-fixes.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@@ -261,6 +262,7 @@ packages on a system.
%patch105 -p1 -b .empty-lua-script
%patch106 -p1 -b .ppc64le
%patch107 -p1 -b .application-provides
+%patch108 -p1 -b .py3-fixes
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@@ -517,6 +519,9 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
+* Mon Nov 18 2013 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-10
+- python 3 string and file compatibility fixes
+
* Mon Oct 14 2013 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-9
- generate application() provides for gnome-software
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 9:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 9:28 [rpms/rpm] pmatilai-v6: - python 3 string and file compatibility fixes Panu Matilainen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox