Combine the two patches

This commit is contained in:
Athmane Madjoudj 2016-11-01 21:40:15 +01:00
parent 01806039dd
commit 937d0aa086
3 changed files with 25 additions and 65 deletions

View File

@ -1,40 +0,0 @@
From e636f6d9dc531890cd8415f077ad93dbb35c6ad8 Mon Sep 17 00:00:00 2001
From: AndCycle <andcycle-github@andcycle.idv.tw>
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)

View File

@ -1,33 +1,23 @@
From 43c1cc79a7120981e7465dc69c531f373fee326c Mon Sep 17 00:00:00 2001
From: Athmane Madjoudj <athmane@fedoraproject.org>
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',

View File

@ -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 <athmane@fedoraproject.org> - 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 <rel-eng@lists.fedoraproject.org> - 1.2.10_139-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages