forked from mbuesch/awlsim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Buesch <[email protected]>
- Loading branch information
Showing
6 changed files
with
22 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# | ||
# Cython patcher | ||
# v1.20 | ||
# v1.21 | ||
# | ||
# Copyright (C) 2012-2019 Michael Buesch <[email protected]> | ||
# Copyright (C) 2012-2020 Michael Buesch <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -77,14 +77,10 @@ def makedirs(path, mode=0o755): | |
raise e | ||
|
||
def hashFile(path): | ||
if sys.version_info[0] < 3: | ||
ExpectedException = IOError | ||
else: | ||
ExpectedException = FileNotFoundError | ||
try: | ||
with open(path, "rb") as fd: | ||
return hashlib.sha1(fd.read()).hexdigest() | ||
except ExpectedException as e: | ||
except FileNotFoundError as e: | ||
return None | ||
|
||
def __fileopIfChanged(fromFile, toFile, fileops): | ||
|
@@ -167,12 +163,6 @@ def uncomment(line, removeStr): | |
elif "#@cy-win" in stripLine: | ||
if _isWindows: | ||
line = uncomment(line, "#@cy-win") | ||
elif "#@cy2" in stripLine: | ||
if sys.version_info[0] < 3: | ||
line = uncomment(line, "#@cy2") | ||
elif "#@cy3" in stripLine: | ||
if sys.version_info[0] >= 3: | ||
line = uncomment(line, "#@cy3") | ||
elif "#@cy" in stripLine: | ||
line = uncomment(line, "#@cy") | ||
|
||
|
@@ -229,15 +219,6 @@ def uncomment(line, removeStr): | |
if "#@nocy" in stripLine: | ||
line = "#" + line | ||
|
||
# Comment all lines containing #@cyX | ||
# for the not matching version. | ||
if sys.version_info[0] < 3: | ||
if "#@cy3" in stripLine: | ||
line = "#" + line | ||
else: | ||
if "#@cy2" in stripLine: | ||
line = "#" + line | ||
|
||
# Comment all lines containing #@cy-posix/win | ||
# for the not matching platform. | ||
if _isPosix: | ||
|
@@ -377,7 +358,7 @@ def registerCythonModule(baseDir, sourceModName): | |
# Warn about unused variables? | ||
"warn.unused" : False, | ||
# Set language version | ||
"language_level" : 2 if sys.version_info[0] < 3 else 3, | ||
"language_level" : 3, | ||
}, | ||
define_macros=[ | ||
("CYTHON_TRACE", str(int(profileEnabled))), | ||
|
@@ -408,6 +389,11 @@ def cythonBuildPossible(): | |
|
||
_cythonPossible = False | ||
|
||
if sys.version_info[0] < 3: | ||
print("WARNING: Could not build the CYTHON modules: " | ||
"Cython 2 not supported. Please use Cython 3.") | ||
return False | ||
|
||
try: | ||
import Cython.Compiler.Options | ||
# Omit docstrings in cythoned modules. | ||
|
@@ -431,19 +417,6 @@ def cythonBuildPossible(): | |
_cythonPossible = True | ||
return True | ||
|
||
if sys.version_info[0] < 3: | ||
# Cython2 build libraries need method pickling | ||
# for parallel build. | ||
def unpickle_method(fname, obj, cls): | ||
# Ignore MRO. We don't seem to inherit methods. | ||
return cls.__dict__[fname].__get__(obj, cls) | ||
def pickle_method(m): | ||
return unpickle_method, (m.im_func.__name__, | ||
m.im_self, | ||
m.im_class) | ||
import copy_reg, types | ||
copy_reg.pickle(types.MethodType, pickle_method, unpickle_method) | ||
|
||
def cyBuildWrapper(arg): | ||
# This function does the same thing as the for-loop-body | ||
# inside of Cython's build_ext.build_extensions() method. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters