-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-30450: Pull Windows dependencies from GitHub rather than svn #1783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
49e6717
Pull Windows dependencies from GitHub rather than svn
zware 8e3c238
Use quotes around an envvar
zware b9993bb
Use 32-bit python from Nuget; exclude version
zware e95433a
Use pathlib, leave directory creation to Python if possible
zware e0bd20d
Rewrite Tools/msi/get_externals.bat
zware c304ea6
Fix Tools/msi/get_externals.bat
zware ffb3f71
Be more consistent in quoting and capitalization
zware 99063c0
Be more consistent in quoting and capitalization
zware b7766fa
Remove SVN mentions from readme.txt
zware 2bc26ce
Fix capitalization of NuGet
zware 3d2545e
Hope this isn't what broke AppVeyor...
zware 27441cb
Can NuGet handle dirs with spaces in them?
zware e18a852
Fix support for dirs with spaces
zware 1c820dd
Allow a bit more environmental configurability
zware 9f6f471
Don't add trailing slash to EXTERNALS_DIR
zware 26308cf
Update Tools/msi/get_externals.bat
zware e6830ae
Merge branch 'master' into goodbye_svn
zware db974fd
66s/binaries/tools/, add comment
zware File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,60 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import os | ||
import pathlib | ||
import zipfile | ||
from urllib.request import urlretrieve | ||
|
||
|
||
def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose): | ||
repo = f'cpython-{"bin" if binary else "source"}-deps' | ||
url = f'https://github.com/{org}/{repo}/archive/{commit_hash}.zip' | ||
reporthook = None | ||
if verbose: | ||
reporthook = print | ||
zip_dir.mkdir(parents=True, exist_ok=True) | ||
filename, headers = urlretrieve( | ||
url, | ||
zip_dir / f'{commit_hash}.zip', | ||
reporthook=reporthook, | ||
) | ||
return filename | ||
|
||
|
||
def extract_zip(externals_dir, zip_path): | ||
with zipfile.ZipFile(os.fspath(zip_path)) as zf: | ||
zf.extractall(os.fspath(externals_dir)) | ||
return externals_dir / zf.namelist()[0].split('/')[0] | ||
|
||
|
||
def parse_args(): | ||
p = argparse.ArgumentParser() | ||
p.add_argument('-v', '--verbose', action='store_true') | ||
p.add_argument('-b', '--binary', action='store_true', | ||
help='Is the dependency in the binary repo?') | ||
p.add_argument('-O', '--organization', | ||
help='Organization owning the deps repos', default='python') | ||
p.add_argument('-e', '--externals-dir', type=pathlib.Path, | ||
help='Directory in which to store dependencies', | ||
default=pathlib.Path(__file__).parent.parent / 'externals') | ||
p.add_argument('tag', | ||
help='tag of the dependency') | ||
return p.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
zip_path = fetch_zip( | ||
args.tag, | ||
args.externals_dir / 'zips', | ||
org=args.organization, | ||
binary=args.binary, | ||
verbose=args.verbose, | ||
) | ||
final_name = args.externals_dir / args.tag | ||
extract_zip(args.externals_dir, zip_path).replace(final_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will download the entire repo at this commit - is your plan to use a branch per project? That's fine by me, just can't see the full picture yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the current layout. I don't think there's a way to get just a specific directory, and I like being able to not get OpenSSL or Tcl/Tk as desired.