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
d6efc942
Commit
d6efc942
authored
Sep 04, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a new monkey module to encapsulate the monkeypatching.
parent
64b10c60
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
21 deletions
+28
-21
setuptools/__init__.py
setuptools/__init__.py
+3
-3
setuptools/dist.py
setuptools/dist.py
+2
-17
setuptools/extension.py
setuptools/extension.py
+1
-1
setuptools/monkey.py
setuptools/monkey.py
+22
-0
No files found.
setuptools/__init__.py
View file @
d6efc942
...
...
@@ -5,7 +5,6 @@ import sys
import
functools
import
distutils.core
import
distutils.filelist
from
distutils.core
import
Command
as
_Command
from
distutils.util
import
convert_path
from
fnmatch
import
fnmatchcase
...
...
@@ -13,7 +12,8 @@ from setuptools.extern.six.moves import filterfalse, map
import
setuptools.version
from
setuptools.extension
import
Extension
from
setuptools.dist
import
Distribution
,
Feature
,
_get_unpatched
from
setuptools.dist
import
Distribution
,
Feature
from
setuptools.monkey
import
_get_unpatched
from
setuptools.depends
import
Require
__all__
=
[
...
...
@@ -122,7 +122,7 @@ find_packages = PackageFinder.find
setup
=
distutils
.
core
.
setup
_Command
=
_get_unpatched
(
_
Command
)
_Command
=
_get_unpatched
(
distutils
.
core
.
Command
)
class
Command
(
_Command
):
...
...
setuptools/dist.py
View file @
d6efc942
...
...
@@ -9,7 +9,6 @@ import distutils.log
import
distutils.core
import
distutils.cmd
import
distutils.dist
from
distutils.core
import
Distribution
as
_Distribution
from
distutils.errors
import
(
DistutilsOptionError
,
DistutilsPlatformError
,
DistutilsSetupError
)
from
distutils.util
import
rfc822_escape
...
...
@@ -20,25 +19,11 @@ from pkg_resources.extern import packaging
from
setuptools.depends
import
Require
from
setuptools
import
windows_support
from
setuptools.monkey
import
_get_unpatched
import
pkg_resources
def
_get_unpatched
(
cls
):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
while
cls
.
__module__
.
startswith
(
'setuptools'
):
cls
,
=
cls
.
__bases__
if
not
cls
.
__module__
.
startswith
(
'distutils'
):
raise
AssertionError
(
"distutils has already been patched by %r"
%
cls
)
return
cls
_Distribution
=
_get_unpatched
(
_Distribution
)
_Distribution
=
_get_unpatched
(
distutils
.
core
.
Distribution
)
def
_patch_distribution_metadata_write_pkg_file
():
...
...
setuptools/extension.py
View file @
d6efc942
...
...
@@ -7,7 +7,7 @@ import distutils.extension
from
setuptools.extern.six.moves
import
map
from
.
dist
import
_get_unpatched
from
.
monkey
import
_get_unpatched
from
.
import
msvc
_Extension
=
_get_unpatched
(
distutils
.
core
.
Extension
)
...
...
setuptools/monkey.py
0 → 100644
View file @
d6efc942
"""
Monkey patching of distutils.
"""
__all__
=
[]
"everything is private"
def
_get_unpatched
(
cls
):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
while
cls
.
__module__
.
startswith
(
'setuptools'
):
cls
,
=
cls
.
__bases__
if
not
cls
.
__module__
.
startswith
(
'distutils'
):
raise
AssertionError
(
"distutils has already been patched by %r"
%
cls
)
return
cls
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