-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from danielfromearth/feature/issue-96-contain…
…er-registry Feature/issue 96 container registry
- Loading branch information
Showing
5 changed files
with
110 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
import logging | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
import tenacity | ||
|
||
""" | ||
Sometimes the package published to PyPi is not immediately available for download from the index. | ||
This script simply repeatedly tries to download a specific version of a package | ||
from PyPI (or test.pypi) until it succeeds or a limit is exceeded. | ||
""" | ||
|
||
|
||
@tenacity.retry( | ||
wait=tenacity.wait_exponential(multiplier=1, min=4, max=10), | ||
retry=tenacity.retry_if_exception_type(subprocess.CalledProcessError), | ||
stop=tenacity.stop_after_delay(120), | ||
before_sleep=tenacity.before_sleep_log(logging.getLogger(__name__), logging.DEBUG), | ||
) | ||
def download_package(package): | ||
subprocess.check_call( | ||
[ | ||
sys.executable, | ||
"-m", | ||
"pip", | ||
"--isolated", | ||
"--no-cache-dir", | ||
"download", | ||
"--no-deps", | ||
"-d", | ||
tempfile.gettempdir(), | ||
"--index-url", | ||
"https://pypi.org/simple/", | ||
"--extra-index-url", | ||
"https://test.pypi.org/simple/", | ||
package, | ||
] | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) | ||
package_spec = sys.argv[1] | ||
download_package(package_spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters