Created
March 21, 2016 11:31
-
-
Save Jc2k/e2b48f884b2a8d9abdb8 to your computer and use it in GitHub Desktop.
Generate a git repo out of a python packages releases
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
import os | |
import subprocess | |
import sys | |
import requests | |
from pip.index import PackageFinder | |
p = PackageFinder([], ["https://pypi.python.org/simple"], session=requests.Session()) | |
versions = p._find_all_versions("newrelic") | |
versions = sorted( | |
versions, | |
key=p._candidate_sort_key, | |
) | |
for v in versions: | |
print v | |
subprocess.check_call([ | |
"wget", | |
v.location.url_without_fragment, | |
]) | |
basename = os.path.basename(v.location.url_without_fragment) | |
subprocess.check_call([ | |
"git", | |
"import-orig", | |
"-u", v.version.public, | |
os.path.join(os.getcwd(), basename), | |
], cwd="../newrelic") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment