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
ce3c43cb
Commit
ce3c43cb
authored
Sep 23, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract _clean_check call
parent
b77de7a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
ez_setup.py
ez_setup.py
+15
-18
No files found.
ez_setup.py
View file @
ce3c43cb
...
...
@@ -151,6 +151,18 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
return
_do_download
(
version
,
download_base
,
to_dir
,
download_delay
)
def
_clean_check
(
cmd
,
target
):
"""
Run the command to download target. If the command fails, clean up before
re-raising the error.
"""
try
:
subprocess
.
check_call
(
cmd
)
except
subprocess
.
CalledProcessError
:
if
os
.
access
(
target
,
os
.
F_OK
):
os
.
unlink
(
target
)
raise
def
download_file_powershell
(
url
,
target
):
"""
Download the file at url to target using Powershell (which will validate
...
...
@@ -162,12 +174,7 @@ def download_file_powershell(url, target):
'-Command'
,
"(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)"
%
vars
(),
]
try
:
subprocess
.
check_call
(
cmd
)
except
subprocess
.
CalledProcessError
:
if
os
.
access
(
target
,
os
.
F_OK
):
os
.
unlink
(
target
)
raise
_clean_check
(
cmd
,
target
)
def
has_powershell
():
if
platform
.
system
()
!=
'Windows'
:
...
...
@@ -187,12 +194,7 @@ download_file_powershell.viable = has_powershell
def
download_file_curl
(
url
,
target
):
cmd
=
[
'curl'
,
url
,
'--silent'
,
'--output'
,
target
]
try
:
subprocess
.
check_call
(
cmd
)
except
subprocess
.
CalledProcessError
:
if
os
.
access
(
target
,
os
.
F_OK
):
os
.
unlink
(
target
)
raise
_clean_check
(
cmd
,
target
)
def
has_curl
():
cmd
=
[
'curl'
,
'--version'
]
...
...
@@ -210,12 +212,7 @@ download_file_curl.viable = has_curl
def
download_file_wget
(
url
,
target
):
cmd
=
[
'wget'
,
url
,
'--quiet'
,
'--output-document'
,
target
]
try
:
subprocess
.
check_call
(
cmd
)
except
subprocess
.
CalledProcessError
:
if
os
.
access
(
target
,
os
.
F_OK
):
os
.
unlink
(
target
)
raise
_clean_check
(
cmd
,
target
)
def
has_wget
():
cmd
=
[
'wget'
,
'--version'
]
...
...
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