Skip to contentSkip to conversation

dnf: backport a patch to fix execution under Python 3.7

PATCH New Ross Burton 1 participant 1 message Nov 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dnf: backport a patch to fix execution under Python 3.7

Python 3.7 removed the os.errno import, so fix dnf to use the correct import.

---
 meta/recipes-devtools/dnf/dnf/errno.patch | 36 +++++++++++++++++++++++++++++++
 meta/recipes-devtools/dnf/dnf_2.7.5.bb    |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/dnf/dnf/errno.patch
meta/recipes-devtools/dnf/dnf/errno.patch new file +36 -0
new file mode 100644
index 00000000000..76a1690b765
@@ -0,0 +1,36 @@
+Don't use os.errno as that should never have existed, and doesn't exist with
+Python 3.7.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 199fc9cb11ff004fc752b58b7177aaf8d7fcedfd Mon Sep 17 00:00:00 2001
+From: Neal Gompa <[email protected]>
+Date: Sat, 3 Mar 2018 12:44:54 -0500
+Subject: [PATCH] util: Correctly source errno.EEXIST
+
+---
+ dnf/util.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/dnf/util.py b/dnf/util.py
+index ab7fd279c..d0f1a4f25 100644
+--- a/dnf/util.py
++++ b/dnf/util.py
+@@ -28,6 +28,7 @@
+ import dnf
+ import dnf.const
+ import dnf.pycomp
++import errno
+ import itertools
+ import librepo
+ import locale
+@@ -120,7 +121,7 @@ def ensure_dir(dname):
+     try:
+         os.makedirs(dname, mode=0o755)
+     except OSError as e:
+-        if e.errno != os.errno.EEXIST or not os.path.isdir(dname):
++        if e.errno != errno.EEXIST or not os.path.isdir(dname):
+             raise e
+ 
+ def empty(iterable):
\ No newline at end of file
meta/recipes-devtools/dnf/dnf_2.7.5.bb +1 -0
index df60d731b69..e2754fbb932 100644
@@ -10,6 +10,7 @@ SRC_URI = "git://github.com/rpm-software-management/dnf.git \
            file://0005-Do-not-prepend-installroot-to-logdir.patch \
            file://0029-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \
            file://0030-Run-python-scripts-using-env.patch \
+           file://errno.patch \
            "
 
 SRCREV = "564c44667c7014843fa6f1732621093114ec59b2"
Signature · 1 line
2.11.0