projects/python-hwdata/hwdata.py | 14 +++++++- projects/python-hwdata/python-hwdata.spec | 50 +++++++++++++++++++++++++++++- projects/python-hwdata/setup.py | 2 - rel-eng/packages/python-hwdata | 2 - 4 files changed, 63 insertions(+), 5 deletions(-)
New commits: commit d16f9322dcb09f7f2964658cbfa44911daa93351 Author: Miroslav Suchý msuchy@redhat.com Date: Wed Dec 4 17:13:13 2013 +0100
Automatic commit of package [python-hwdata] release [1.10.1-1].
diff --git a/projects/python-hwdata/python-hwdata.spec b/projects/python-hwdata/python-hwdata.spec index 4877af6..71699e7 100644 --- a/projects/python-hwdata/python-hwdata.spec +++ b/projects/python-hwdata/python-hwdata.spec @@ -9,7 +9,7 @@ %endif
Name: python-hwdata -Version: 1.10.0 +Version: 1.10.1 Release: 1%{?dist} Summary: Python bindings to hwdata package BuildArch: noarch @@ -85,6 +85,11 @@ rm -rf $RPM_BUILD_ROOT %endif
%changelog +* Wed Dec 04 2013 Miroslav Suchý msuchy@redhat.com 1.10.1-1 +- create python3-hwdata subpackage +- Bumping package versions for 1.9 +- %%defattr is not needed since rpm 4.4 + * Fri Mar 02 2012 Miroslav Suchý 1.7.3-1 - 798375 - fix PCI device name translation (Joshua.Roys@gtri.gatech.edu) - use setup from distutils diff --git a/projects/python-hwdata/setup.py b/projects/python-hwdata/setup.py index 916a6fe..03788bb 100644 --- a/projects/python-hwdata/setup.py +++ b/projects/python-hwdata/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup, Extension
setup (name = 'pciutils', - version = '1.7.3', + version = '1.10.1', description = 'Interface to pciutils', author = 'Miroslav Suchý', author_email = 'msuchy@redhat.com', diff --git a/rel-eng/packages/python-hwdata b/rel-eng/packages/python-hwdata index 4208eac..92c6b7c 100644 --- a/rel-eng/packages/python-hwdata +++ b/rel-eng/packages/python-hwdata @@ -1 +1 @@ -1.7.3-1 projects/python-hwdata/ +1.10.1-1 projects/python-hwdata/
commit 3afcf036cca2aae117b8396d2366ce7375684147 Author: Miroslav Suchý msuchy@redhat.com Date: Wed Dec 4 16:13:33 2013 +0100
create python3-hwdata subpackage
alter code to handle python3 leave python2 package until the Py2to3Guideline is finalized rhel{5,6} does not have python3 - leave them out
diff --git a/projects/python-hwdata/hwdata.py b/projects/python-hwdata/hwdata.py index b458912..f0a2894 100644 --- a/projects/python-hwdata/hwdata.py +++ b/projects/python-hwdata/hwdata.py @@ -12,6 +12,8 @@ # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. # +import sys +inPy3k = sys.version_info[0] == 3
""" Query hwdata database and return decription of vendor and/or device. """
@@ -33,7 +35,11 @@ class USB: if self.cache and not USB.devices: # parse usb.ids USB.devices = {} - for line in open(self.filename).readlines(): + if inPy3k: + f = open(self.filename, encoding='ISO8859-1') + else: + f = open(self.filename) + for line in f.readlines(): l = line.split() if line.startswith('#'): if line.startswith('# List of known device classes, subclasses and protocols'): @@ -110,7 +116,11 @@ class PCI: # parse pci.ids pcirec = {} PCI.devices = {} - for line in open(self.filename).readlines(): + if inPy3k: + f = open(self.filename, encoding='ISO8859-1') + else: + f = open(self.filename) + for line in f.readlines(): l = line.split() if line.startswith('#'): continue diff --git a/projects/python-hwdata/python-hwdata.spec b/projects/python-hwdata/python-hwdata.spec index d58549b..4877af6 100644 --- a/projects/python-hwdata/python-hwdata.spec +++ b/projects/python-hwdata/python-hwdata.spec @@ -1,6 +1,12 @@ %if ! (0%{?fedora} || 0%{?rhel} > 5) %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %endif +#%global with_python2 1 +%if (0%{?fedora} || 0%{?rhel} > 6) +%global with_python3 1 +%else +%global with_python3 0 +%endif
Name: python-hwdata Version: 1.10.0 @@ -15,22 +21,53 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: python-devel Requires: hwdata +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif
%description Provide python interface to database stored in hwdata package. It allows you to get human readable description of USB and PCI devices.
+%if 0%{?with_python3} +%package -n python3-hwdata +Summary: Python bindings to hwdata package +Group: Development/Languages + +%description -n python3-hwdata +Provide python interface to database stored in hwdata package. +It allows you to get human readable description of USB and PCI devices. + +This is the Python 3 build of the module. +%endif + %prep %setup -q
+%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif
%build %{__python} setup.py build
+%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif + %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --prefix=%{_prefix} --root=%{buildroot} +popd +%endif + %clean rm -rf $RPM_BUILD_ROOT
@@ -40,6 +77,12 @@ rm -rf $RPM_BUILD_ROOT %doc html %{python_sitelib}/*
+%if 0%{?with_python3} +%files -n python3-hwdata +%doc LICENSE example.py +%doc html +%{python3_sitelib}/* +%endif
%changelog * Fri Mar 02 2012 Miroslav Suchý 1.7.3-1
spacewalk-commits@lists.fedorahosted.org