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
0b80f934
Commit
0b80f934
authored
Mar 30, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract a method to capture the intention of caller detection.
parent
58eb4b2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
setuptools/command/install.py
setuptools/command/install.py
+21
-13
No files found.
setuptools/command/install.py
View file @
0b80f934
...
...
@@ -52,19 +52,8 @@ class install(_install):
if
self
.
old_and_unmanageable
or
self
.
single_version_externally_managed
:
return
_install
.
run
(
self
)
# Attempt to detect whether we were called from setup() or by another
# command. If we were called by setup(), our caller will be the
# 'run_command' method in 'distutils.dist', and *its* caller will be
# the 'run_commands' method. If we were called any other way, our
# immediate caller *might* be 'run_command', but it won't have been
# called by 'run_commands'. This is slightly kludgy, but seems to
# work.
#
caller
=
sys
.
_getframe
(
2
)
caller_module
=
caller
.
f_globals
.
get
(
'__name__'
,
''
)
caller_name
=
caller
.
f_code
.
co_name
if
caller_module
!=
'distutils.dist'
or
caller_name
!=
'run_commands'
:
called_from_setup
=
self
.
_called_from_setup
(
sys
.
_getframe
(
2
))
if
not
called_from_setup
:
# We weren't called from the command line or setup(), so we
# should run in backward-compatibility mode to support bdist_*
# commands.
...
...
@@ -72,6 +61,25 @@ class install(_install):
else
:
self
.
do_egg_install
()
@
staticmethod
def
_called_from_setup
(
run_parent_parent
):
"""
Attempt to detect whether we were called from setup() or by another
command. If we were called by setup(), our caller will be the
'run_command' method in 'distutils.dist', and *its* caller will be
the 'run_commands' method. If we were called any other way, our
immediate caller *might* be 'run_command', but it won't have been
called by 'run_commands'. This is slightly kludgy, but seems to
work.
"""
caller
=
run_parent_parent
caller_module
=
caller
.
f_globals
.
get
(
'__name__'
,
''
)
caller_name
=
caller
.
f_code
.
co_name
return
(
caller_module
==
'distutils.dist'
and
caller_name
==
'run_commands'
)
def
do_egg_install
(
self
):
easy_install
=
self
.
distribution
.
get_command_class
(
'easy_install'
)
...
...
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