Skip to content

Added script to fetch wheels [ci skip] #20928

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 2 commits into from
May 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions scripts/download_wheels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Fetch wheels from wheels.scipy.org for a pandas version."""
import argparse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pathlib
import sys
import urllib.parse
import urllib.request

from lxml import html


def parse_args(args=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("version", type=str, help="Pandas version (0.23.0)")
return parser.parse_args(args)


def fetch(version):
base = 'http://wheels.scipy.org'
tree = html.parse(base)
root = tree.getroot()

dest = pathlib.Path('dist')
dest.mkdir(exist_ok=True)

files = [x for x in root.xpath("//a/text()")
if x.startswith(f'pandas-{version}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only works on >= 3.6 (which is ok), but the linter is running this.

and not dest.joinpath(x).exists()]

N = len(files)

for i, filename in enumerate(files, 1):
out = str(dest.joinpath(filename))
link = urllib.request.urljoin(base, filename)
urllib.request.urlretrieve(link, out)
print(f"Downloaded {link} to {out} [{i}/{N}]")


def main(args=None):
args = parse_args(args)
fetch(args.version)


if __name__ == '__main__':
sys.exit(main())