summaryrefslogtreecommitdiff
path: root/dev-python/pefile/files/pefile-2022.5.30-remove-future.patch
blob: 7f7cc5d29d4843e8c4af3ccf2b86c41dafe98e06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Bug: https://bugs.gentoo.org/888279

From 36bf63f1185b8407ff9b4ce8c1c8e8620d8ae30f Mon Sep 17 00:00:00 2001
From: Letu Ren <fantasquex@gmail.com>
Date: Sun, 26 Jun 2022 22:54:27 +0800
Subject: [PATCH] Remove future from dependencies

Fix: #348
---
 ordlookup/__init__.py | 15 ++-------------
 peutils.py            |  7 -------
 setup.py              | 19 ++++---------------
 tests/pefile_test.py  |  3 ---
 4 files changed, 6 insertions(+), 38 deletions(-)

diff --git a/ordlookup/__init__.py b/ordlookup/__init__.py
index c69aee0..8841d74 100644
--- a/ordlookup/__init__.py
+++ b/ordlookup/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import
-import sys
 from . import ws2_32
 from . import oleaut32
 
@@ -15,18 +13,9 @@
     b"oleaut32.dll": oleaut32.ord_names,
 }
 
-PY3 = sys.version_info > (3,)
 
-if PY3:
-
-    def formatOrdString(ord_val):
-        return "ord{}".format(ord_val).encode()
-
-
-else:
-
-    def formatOrdString(ord_val):
-        return b"ord%d" % ord_val
+def formatOrdString(ord_val):
+    return "ord{}".format(ord_val).encode()
 
 
 def ordLookup(libname, ord_val, make_name=False):
diff --git a/peutils.py b/peutils.py
index 34b98f5..4d4b2bd 100644
--- a/peutils.py
+++ b/peutils.py
@@ -6,13 +6,6 @@
 
 All rights reserved.
 """
-from __future__ import division
-from future import standard_library
-
-standard_library.install_aliases()
-from builtins import range
-from builtins import object
-
 import os
 import re
 import string
diff --git a/setup.py b/setup.py
index c8ab89f..206db6f 100755
--- a/setup.py
+++ b/setup.py
@@ -5,8 +5,6 @@
 import re
 import sys
 
-if sys.version_info.major == 3:
-    from io import open
 
 try:
     from setuptools import setup, Command
@@ -25,12 +23,8 @@ def _read_doc():
     Parse docstring from file 'pefile.py' and avoid importing
     this module directly.
     """
-    if sys.version_info.major == 2:
-        with open('pefile.py', 'r') as f:
-            tree = ast.parse(f.read())
-    else:
-        with open('pefile.py', 'r', encoding='utf-8') as f:
-            tree = ast.parse(f.read())
+    with open('pefile.py', 'r', encoding='utf-8') as f:
+        tree = ast.parse(f.read())
     return ast.get_docstring(tree)
 
 
@@ -42,12 +36,8 @@ def _read_attr(attr_name):
     __version__, __author__, __contact__,
     """
     regex = attr_name + r"\s+=\s+['\"](.+)['\"]"
-    if sys.version_info.major == 2:
-        with open('pefile.py', 'r') as f:
-            match = re.search(regex, f.read())
-    else:
-        with open('pefile.py', 'r', encoding='utf-8') as f:
-            match = re.search(regex, f.read())
+    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)
 
@@ -89,7 +79,6 @@ def run(self):
     python_requires=">=3.6.0",
     packages = ['ordlookup'],
     install_requires=[
-          'future',
     ],
     license="MIT",
 )