diff --git a/cpioarchive_supports_2_3.patch b/cpioarchive_supports_2_3.patch new file mode 100644 index 0000000..05740fd --- /dev/null +++ b/cpioarchive_supports_2_3.patch @@ -0,0 +1,65 @@ +--- cpioarchive.py.orig 2006-01-03 19:49:29.000000000 +0000 ++++ cpioarchive.py 2015-08-14 17:06:40.580092327 +0100 +@@ -1,3 +1,5 @@ ++from __future__ import absolute_import ++ + """ cpioarchive: Support for cpio archives + Copyright (C) 2006 Ignacio Vazquez-Abrams """ + +@@ -54,7 +56,7 @@ + """Close this cpio entry. Further calls to methods will raise an + exception.""" + self.closed=True +- ++ + def flush(self): + """Flush the entry (no-op).""" + pass +@@ -77,7 +79,7 @@ + + def seek(self, offset, whence=0): + """Move to new position within an entry. +- ++ + Keyword arguments: + offset -- Byte count + whence -- Describes how offset is used. +@@ -107,7 +109,7 @@ + def open(name=None, mode='r', fileobj=None): + """Open a cpio archive. Defers to CpioArchive.__init__().""" + return CpioArchive(name, mode, fileobj) +- ++ + def __init__(self, name=None, mode='r', fileobj=None): + """Open a cpio archive. + +@@ -140,6 +142,9 @@ + if not self.external: + self.file.close() + ++ def __next__(self): ++ return self.next() ++ + def next(self): + """Return the next entry in the archive.""" + if self.closed: +@@ -154,8 +159,8 @@ + return iter(self._infos) + + def _readfile(self, name): +- self._readobj(file(name, 'rb')) +- ++ self._readobj(open(name, 'rb')) ++ + def _readobj(self, fileobj): + self.file=fileobj + start=self.file.tell() +@@ -168,7 +173,7 @@ + if not ce.name=="TRAILER!!!": + self._infos.append(ce) + else: +- return ++ return + self.file.seek((4-(self.file.tell()-istart)%4)%4, 1) + self.file.seek(self._infos[-1].size, 1) + self.file.seek((4-(self.file.tell()-istart)%4)%4, 1) diff --git a/python-cpio.spec b/python-cpio.spec index b40d06d..d3edcad 100644 --- a/python-cpio.spec +++ b/python-cpio.spec @@ -5,44 +5,57 @@ Name: python-cpio Version: 0.1 -Release: 18%{?dist} +Release: 19%{?dist} Summary: A Python module for accessing cpio archives -Group: Development/Languages License: LGPLv2+ URL: http://developer.berlios.de/projects/python-cpio/ Source0: http://download.berlios.de/python-cpio/python-cpio-0.1.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: cpioarchive_supports_2_3.patch BuildArch: noarch BuildRequires: python2-devel +BuildRequires: python3-devel %description This is a Python module for accessing cpio archives. +%package -n python3-cpio +Summary: A Python module for accessing cpio archives + +%description -n python3-cpio +This is a Python module for accessing cpio archives. + %prep %setup -q +%patch0 %build -CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +%py2_build +%py3_build %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT - -%clean -rm -rf $RPM_BUILD_ROOT +%py2_install +%py3_install %files -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING.lib README TODO +%license COPYING.lib +%doc AUTHORS ChangeLog README TODO %{python_sitelib}/cpioarchive.py* -%if 0%{?fedora} >= 9 || 0%{?rhel} >= 6 %{python_sitelib}/*.egg-info -%endif + +%files -n python3-cpio +%license COPYING.lib +%doc AUTHORS ChangeLog README TODO +%{python3_sitelib}/cpioarchive.py* +%{python3_sitelib}/__pycache__/* +%{python3_sitelib}/*.egg-info %changelog +* Fri Aug 14 2015 José Matos - 0.1-19 +- Add python3 subpackage + * Thu Jun 18 2015 Fedora Release Engineering - 0.1-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild