Package: python-libarchive-c
Version: 2.8-0.4
Tags: patch
User: [email protected]
Usertags: origin-ubuntu focal ubuntu-patch

The package failes to build with python 3.8, the attached patch fixes
the issue
diff -Nru python-libarchive-c-2.8/debian/changelog python-libarchive-c-2.8/debian/changelog
--- python-libarchive-c-2.8/debian/changelog	2019-10-08 02:24:30.000000000 +0200
+++ python-libarchive-c-2.8/debian/changelog	2019-12-19 18:25:00.000000000 +0100
@@ -1,3 +1,10 @@
+python-libarchive-c (2.8-0.5) UNRELEASED; urgency=medium
+
+  * debian/patches/git_python38_compat.patch:
+    - backport an upstream commit to fix build with python 3.8
+
+ -- Sebastien Bacher <[email protected]>  Thu, 19 Dec 2019 18:23:18 +0100
+
 python-libarchive-c (2.8-0.4) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru python-libarchive-c-2.8/debian/patches/git_python38_compat.patch python-libarchive-c-2.8/debian/patches/git_python38_compat.patch
--- python-libarchive-c-2.8/debian/patches/git_python38_compat.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-libarchive-c-2.8/debian/patches/git_python38_compat.patch	2019-12-19 18:24:08.000000000 +0100
@@ -0,0 +1,49 @@
+From 7480fcdc8c6585d3f8ac67fe9a4dff0ebb0e479e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
+Date: Thu, 2 May 2019 15:39:00 +0200
+Subject: [PATCH] Python 3.8: tarfile.filemode is gone, use stat.filemode if
+ available
+
+    >           mode = tarfile.filemode(entry.mode)[1:]
+    E           AttributeError: module 'tarfile' has no attribute 'filemode'
+---
+ tests/__init__.py | 6 +++++-
+ tox.ini           | 2 +-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/tests/__init__.py b/tests/__init__.py
+index 7e922aa..bfca007 100644
+--- a/tests/__init__.py
++++ b/tests/__init__.py
+@@ -6,6 +6,10 @@
+ from os.path import abspath, dirname, join
+ from stat import S_ISREG
+ import tarfile
++try:
++    from stat import filemode
++except ImportError:  # Python 2
++    filemode = tarfile.filemode
+ 
+ from libarchive import file_reader
+ 
+@@ -83,7 +87,7 @@ def get_tarinfos(location):
+                 path += '/'
+             # libarchive introduces prefixes such as h prefix for
+             # hardlinks: tarfile does not, so we ignore the first char
+-            mode = tarfile.filemode(entry.mode)[1:]
++            mode = filemode(entry.mode)[1:]
+             yield {
+                 'path': path,
+                 'mtime': entry.mtime,
+diff --git a/tox.ini b/tox.ini
+index 8973837..1f6b04f 100644
+--- a/tox.ini
++++ b/tox.ini
+@@ -1,5 +1,5 @@
+ [tox]
+-envlist=py27,py34,py35,py36
++envlist=py27,py34,py35,py36,py37,py38
+ skipsdist=True
+ 
+ [testenv]
+
diff -Nru python-libarchive-c-2.8/debian/patches/series python-libarchive-c-2.8/debian/patches/series
--- python-libarchive-c-2.8/debian/patches/series	2019-01-08 12:28:40.000000000 +0100
+++ python-libarchive-c-2.8/debian/patches/series	2019-12-19 18:24:17.000000000 +0100
@@ -1 +1,2 @@
 retrieve-version-from-debian-changelog.diff
+git_python38_compat.patch

Reply via email to