!1 package init

Merge pull request !1 from jeff200902/master
This commit is contained in:
openeuler-ci-bot 2020-06-20 14:41:18 +08:00 committed by Gitee
commit a62b5a49e9
4 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,65 @@
--- a/cpioarchive.py.orig 2006-01-03 19:49:29.000000000 +0000
+++ b/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)

BIN
python-cpio-0.1.tar.bz2 Normal file

Binary file not shown.

50
python-cpio.spec Normal file
View File

@ -0,0 +1,50 @@
Name: python-cpio
Version: 0.1
Release: 31
Summary: This module provides for accessing cpio archives
License: LGPLv2+
URL: https://sourceforge.net/projects/python-cpio.berlios/
Source0: https://sourceforge.net/projects/python-cpio.berlios/files/python-cpio-0.1.tar.bz2
Patch0000: cpioarchive_supports_2_3.patch
BuildArch: noarch
BuildRequires: python2-devel python3-devel
%description
The package provides for accessing cpio archives wrote by python.
%package -n python2-cpio
Summary: This module provides for accessing cpio archive
%{?python_provide:%python_provide python2-cpio}
%description -n python2-cpio
The package provides for accessing cpio archives wrote by python.
%package -n python3-cpio
Summary: This module provides for accessing cpio archive
%description -n python3-cpio
The package provides for accessing cpio archives wrote by python.
%prep
%autosetup -n python-cpio-%{version} -p1 -S git
%build
%py2_build
%py3_build
%install
%py2_install
%py3_install
%files -n python2-cpio
%doc AUTHORS ChangeLog README TODO COPYING.lib
%{python2_sitelib}/cpioarchive.py*
%{python2_sitelib}/*.egg-info
%files -n python3-cpio
%doc AUTHORS ChangeLog README TODO COPYING.lib
%{python3_sitelib}/cpioarchive.py*
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/*.egg-info
%changelog
* Thu May 14 2020 Jeffery.Gao <gaojianxing@huawei.com> - 0.1-31
- Package init

4
python-cpio.yaml Normal file
View File

@ -0,0 +1,4 @@
version-control: NA
src_repo: NA
tag_prefix: NA
seperator: NA