From 937d0aa086e66352a71fcd8acc2a08fdc1c08e3b Mon Sep 17 00:00:00 2001 From: Athmane Madjoudj Date: Tue, 1 Nov 2016 21:40:15 +0100 Subject: [PATCH] Combine the two patches --- ...-fix-UnicodeDecodeError-py3-e636f6d9.patch | 40 ------------------- ...atch => pefile-fix-build-43c1cc79a71.patch | 39 +++++++++--------- python-pefile.spec | 11 ++--- 3 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 pefile-fix-UnicodeDecodeError-py3-e636f6d9.patch rename pefile-fix-py2-build-43c1cc79a.patch => pefile-fix-build-43c1cc79a71.patch (56%) diff --git a/pefile-fix-UnicodeDecodeError-py3-e636f6d9.patch b/pefile-fix-UnicodeDecodeError-py3-e636f6d9.patch deleted file mode 100644 index 668bec9..0000000 --- a/pefile-fix-UnicodeDecodeError-py3-e636f6d9.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e636f6d9dc531890cd8415f077ad93dbb35c6ad8 Mon Sep 17 00:00:00 2001 -From: AndCycle -Date: Tue, 3 May 2016 23:57:33 +0800 -Subject: [PATCH] fix for UnicodeDecodeError: 'ascii' codec can't decode byte - 0xe2 in position 208687: ordinal not in range(128) #105 - ---- - setup.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/setup.py b/setup.py -index b39303a..28a9623 100755 ---- a/setup.py -+++ b/setup.py -@@ -4,6 +4,7 @@ - import os - import re - import sys -+from io import open - - try: - from setuptools import setup, Command -@@ -22,7 +23,7 @@ def _read_doc(): - Parse docstring from file 'pefile.py' and avoid importing - this module directly. - """ -- with open('pefile.py', 'r') as f: -+ with open('pefile.py', 'r', encoding='utf-8') as f: - tree = ast.parse(f.read()) - return ast.get_docstring(tree) - -@@ -35,7 +36,7 @@ def _read_attr(attr_name): - __version__, __author__, __contact__, - """ - regex = attr_name + r"\s+=\s+'(.+)'" -- with open('pefile.py', 'r') as f: -+ with open('pefile.py', 'r', encoding='utf-8') as f: - match = re.search(regex, f.read()) - # Second item in the group is the value of attribute. - return match.group(1) diff --git a/pefile-fix-py2-build-43c1cc79a.patch b/pefile-fix-build-43c1cc79a71.patch similarity index 56% rename from pefile-fix-py2-build-43c1cc79a.patch rename to pefile-fix-build-43c1cc79a71.patch index a310248..45b83b2 100644 --- a/pefile-fix-py2-build-43c1cc79a.patch +++ b/pefile-fix-build-43c1cc79a71.patch @@ -1,33 +1,23 @@ -From 43c1cc79a7120981e7465dc69c531f373fee326c Mon Sep 17 00:00:00 2001 -From: Athmane Madjoudj -Date: Tue, 1 Nov 2016 20:35:23 +0100 -Subject: [PATCH] Fix python2 build - ---- - setup.py | 20 +++++++++++++++----- - 1 file changed, 15 insertions(+), 5 deletions(-) - diff --git a/setup.py b/setup.py -index b22ed88..b932eb7 100755 +index f5345bb..b932eb7 100755 --- a/setup.py +++ b/setup.py -@@ -4,7 +4,9 @@ - import os +@@ -5,6 +5,9 @@ import os import re import sys --from io import open -+ + +if sys.version_info.major == 3: + from io import open - ++ try: from setuptools import setup, Command -@@ -23,8 +25,12 @@ def _read_doc(): + except ImportError as excp: +@@ -22,8 +25,12 @@ def _read_doc(): Parse docstring from file 'pefile.py' and avoid importing this module directly. """ -- with open('pefile.py', 'r', encoding='utf-8') as f: -- tree = ast.parse(f.read().encode('ascii', 'backslashreplace')) +- with open('pefile.py', 'r') as f: +- tree = ast.parse(f.read()) + if sys.version_info.major == 2: + with open('pefile.py', 'r') as f: + tree = ast.parse(f.read()) @@ -37,11 +27,11 @@ index b22ed88..b932eb7 100755 return ast.get_docstring(tree) -@@ -36,8 +42,12 @@ def _read_attr(attr_name): +@@ -35,8 +42,12 @@ def _read_attr(attr_name): __version__, __author__, __contact__, """ regex = attr_name + r"\s+=\s+'(.+)'" -- with open('pefile.py', 'r', encoding='utf-8') as f: +- with open('pefile.py', 'r') as f: - match = re.search(regex, f.read()) + if sys.version_info.major == 2: + with open('pefile.py', 'r') as f: @@ -52,3 +42,12 @@ index b22ed88..b932eb7 100755 # Second item in the group is the value of attribute. return match.group(1) +@@ -80,7 +91,7 @@ setup(name = 'pefile', + author = _read_attr('__author__'), + author_email = _read_attr('__contact__'), + url = 'https://github.com/erocarrera/pefile', +- download_url='https://github.com/erocarrera/pefile/releases/download/v2016.3.28/pefile-2016.3.28.tar.gz', ++ download_url='https://github.com/erocarrera/pefile/files/192316/pefile-2016.3.28.tar.gz', + keywords = ['pe', 'exe', 'dll', 'pefile', 'pecoff'], + classifiers = [ + 'Development Status :: 5 - Production/Stable', diff --git a/python-pefile.spec b/python-pefile.spec index 5084573..ae8fe19 100644 --- a/python-pefile.spec +++ b/python-pefile.spec @@ -23,8 +23,8 @@ License: MIT URL: https://github.com/erocarrera/pefile Source0: https://github.com/erocarrera/pefile/archive/v%{version}/pefile-%{version}.tar.gz -Patch0: pefile-fix-UnicodeDecodeError-py3-e636f6d9.patch -Patch1: pefile-fix-py2-build-43c1cc79a.patch +# Github PR #152 +Patch0: pefile-fix-build-43c1cc79a71.patch BuildArch: noarch # For the patch @@ -56,15 +56,15 @@ BuildRequires: python3-setuptools %autosetup -S git -n %{srcname}-%{version} %build -#%py2_build +%py2_build %py3_build %install -#%py2_install +%py2_install %py3_install %check -#%{__python2} setup.py test +%{__python2} setup.py test %{__python3} setup.py test %files -n python2-%{srcname} @@ -81,6 +81,7 @@ BuildRequires: python3-setuptools * Tue Nov 01 2016 Athmane Madjoudj - 2016.3.28-1 - Update to 2016.3.28 - Revamp the specfile +- Add patch to fix the build * Tue Jul 19 2016 Fedora Release Engineering - 1.2.10_139-5 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages