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
674d5ecb
Commit
674d5ecb
authored
Dec 18, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract tmpdir as a context manager
parent
7f89e790
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+14
-9
No files found.
setuptools/command/easy_install.py
View file @
674d5ecb
...
@@ -627,12 +627,24 @@ class easy_install(Command):
...
@@ -627,12 +627,24 @@ class easy_install(Command):
(
spec
.
key
,
self
.
build_directory
)
(
spec
.
key
,
self
.
build_directory
)
)
)
def
easy_install
(
self
,
spec
,
deps
=
False
):
@
contextlib
.
contextmanager
def
_tmpdir
(
self
):
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
"easy_install-"
)
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
"easy_install-"
)
try
:
yield
tmpdir
finally
:
if
not
os
.
path
.
exists
(
tmpdir
):
return
# workaround for http://bugs.python.org/issue24672
if
six
.
PY2
:
tmpdir
=
tmpdir
.
decode
(
'ascii'
)
rmtree
(
tmpdir
)
def
easy_install
(
self
,
spec
,
deps
=
False
):
if
not
self
.
editable
:
if
not
self
.
editable
:
self
.
install_site_py
()
self
.
install_site_py
()
try
:
with
self
.
_tmpdir
()
as
tmpdir
:
if
not
isinstance
(
spec
,
Requirement
):
if
not
isinstance
(
spec
,
Requirement
):
if
URL_SCHEME
(
spec
):
if
URL_SCHEME
(
spec
):
# It's a url, download it to tmpdir and process
# It's a url, download it to tmpdir and process
...
@@ -664,13 +676,6 @@ class easy_install(Command):
...
@@ -664,13 +676,6 @@ class easy_install(Command):
else
:
else
:
return
self
.
install_item
(
spec
,
dist
.
location
,
tmpdir
,
deps
)
return
self
.
install_item
(
spec
,
dist
.
location
,
tmpdir
,
deps
)
finally
:
if
os
.
path
.
exists
(
tmpdir
):
# workaround for http://bugs.python.org/issue24672
if
six
.
PY2
:
tmpdir
=
tmpdir
.
decode
(
'ascii'
)
rmtree
(
tmpdir
)
def
install_item
(
self
,
spec
,
download
,
tmpdir
,
deps
,
install_needed
=
False
):
def
install_item
(
self
,
spec
,
download
,
tmpdir
,
deps
,
install_needed
=
False
):
# Installation is also needed if file in tmpdir or is not an egg
# Installation is also needed if file in tmpdir or is not an egg
...
...
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