Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
f2d480b8
Commit
f2d480b8
authored
Sep 27, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge with v27.3.1
parents
e91f0b18
39431830
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
28 deletions
+49
-28
CHANGES.rst
CHANGES.rst
+9
-0
setup.cfg
setup.cfg
+1
-1
setup.py
setup.py
+1
-1
setuptools/monkey.py
setuptools/monkey.py
+38
-26
No files found.
CHANGES.rst
View file @
f2d480b8
...
...
@@ -9,6 +9,15 @@ In development
*
#
795
:
Bump
certifi
.
v27
.3.1
-------
*
#
790
:
In
MSVC
monkeypatching
,
explicitly
patch
each
function
by
name
in
the
target
module
instead
of
inferring
the
module
from
the
function
's ``__module__``. Improves
compatibility with other packages that might have previously
patched distutils functions (i.e. NumPy).
v27.3.0
-------
...
...
setup.cfg
View file @
f2d480b8
[bumpversion]
current_version = 27.3.
0
current_version = 27.3.
1
commit = True
tag = True
...
...
setup.py
View file @
f2d480b8
...
...
@@ -88,7 +88,7 @@ def pypi_link(pkg_filename):
setup_params
=
dict
(
name
=
"setuptools"
,
version
=
"27.3.
0
"
,
version
=
"27.3.
1
"
,
description
=
"Easily download, build, install, upgrade, and uninstall "
"Python packages"
,
author
=
"Python Packaging Authority"
,
...
...
setuptools/monkey.py
View file @
f2d480b8
...
...
@@ -6,6 +6,7 @@ import sys
import
distutils.filelist
import
platform
import
types
import
functools
from
.py26compat
import
import_module
from
setuptools.extern
import
six
...
...
@@ -115,16 +116,21 @@ def _patch_distribution_metadata_write_pkg_info():
)
def
patch_func
(
replacement
,
original
):
# first set the 'unpatched' attribute on the replacement to
def
patch_func
(
replacement
,
target_mod
,
func_name
):
"""
Patch func_name in target_mod with replacement
Important - original must be resolved by name to avoid
patching an already patched function.
"""
original
=
getattr
(
target_mod
,
func_name
)
# set the 'unpatched' attribute on the replacement to
# point to the original.
vars
(
replacement
).
setdefault
(
'unpatched'
,
original
)
# next resolve the module in which the original func resides
target_mod
=
import_module
(
original
.
__module__
)
# finally replace the function in the original module
setattr
(
target_mod
,
original
.
__name__
,
replacement
)
# replace the function in the original module
setattr
(
target_mod
,
func_name
,
replacement
)
def
get_unpatched_function
(
candidate
):
...
...
@@ -139,37 +145,43 @@ def patch_for_msvc_specialized_compiler():
# import late to avoid circular imports on Python < 3.5
msvc
=
import_module
(
'setuptools.msvc'
)
try
:
# Distutil file for MSVC++ 9.0 and upper (Python 2.7 to 3.4)
import
distutils.msvc9compiler
as
msvc9compiler
except
ImportError
:
pass
try
:
# Distutil file for MSVC++ 14.0 and upper (Python 3.5+)
import
distutils._msvccompiler
as
msvc14compiler
except
ImportError
:
pass
if
platform
.
system
()
!=
'Windows'
:
# Compilers only availables on Microsoft Windows
return
def
patch_params
(
mod_name
,
func_name
):
"""
Prepare the parameters for patch_func to patch indicated function.
"""
repl_prefix
=
'msvc9_'
if
'msvc9'
in
mod_name
else
'msvc14_'
repl_name
=
repl_prefix
+
func_name
.
lstrip
(
'_'
)
repl
=
getattr
(
msvc
,
repl_name
)
mod
=
import_module
(
mod_name
)
if
not
hasattr
(
mod
,
func_name
):
raise
ImportError
(
func_name
)
return
repl
,
mod
,
func_name
# Python 2.7 to 3.4
msvc9
=
functools
.
partial
(
patch_params
,
'distutils.msvc9compiler'
)
# Python 3.5+
msvc14
=
functools
.
partial
(
patch_params
,
'distutils._msvccompiler'
)
try
:
# Patch distutils.msvc9compiler
patch_func
(
msvc
.
msvc9_find_vcvarsall
,
msvc9compiler
.
find_vcvarsall
)
patch_func
(
msvc
.
msvc9_query_vcvarsall
,
msvc9compiler
.
query_vcvarsall
)
except
Name
Error
:
patch_func
(
*
msvc9
(
'find_vcvarsall'
)
)
patch_func
(
*
msvc9
(
'query_vcvarsall'
)
)
except
Import
Error
:
pass
try
:
# Patch distutils._msvccompiler._get_vc_env
patch_func
(
msvc
.
msvc14_get_vc_env
,
msvc14compiler
.
_get_vc_env
)
except
Name
Error
:
patch_func
(
*
msvc14
(
'_get_vc_env'
)
)
except
Import
Error
:
pass
try
:
# Patch distutils._msvccompiler.gen_lib_options for Numpy
patch_func
(
msvc
.
msvc14_gen_lib_options
,
msvc14compiler
.
gen_lib_options
)
except
Name
Error
:
patch_func
(
*
msvc14
(
'gen_lib_options'
)
)
except
Import
Error
:
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment