-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into support-subdirectory
- Loading branch information
Showing
33 changed files
with
23,535 additions
and
455 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 |
---|---|---|
|
@@ -89,8 +89,10 @@ venv3/ | |
venv2/ | ||
ENV/ | ||
env/ | ||
env3/ | ||
env2/ | ||
env2?/ | ||
env3/ | ||
env3?/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
language: minimal | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
jobs: | ||
include: | ||
- name: Linux | x86_64 + i686 | Python 3.5 | ||
|
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,75 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import time | ||
from pathlib import Path | ||
from subprocess import run | ||
|
||
import click | ||
import textwrap | ||
|
||
|
||
def shell(cmd, **kwargs): | ||
return run([cmd], shell=True, **kwargs) | ||
|
||
|
||
def git_repo_has_changes(): | ||
unstaged_changes = shell('git diff-index --quiet HEAD --').returncode != 0 | ||
staged_changes = shell('git diff-index --quiet --cached HEAD --').returncode != 0 | ||
return unstaged_changes or staged_changes | ||
|
||
|
||
@click.command() | ||
def main(): | ||
project_root = Path(__file__).parent / '..' | ||
os.chdir(project_root) | ||
|
||
if git_repo_has_changes(): | ||
print('Your git repo has uncommitted changes. Commit or stash before continuing.') | ||
exit(1) | ||
|
||
previous_branch = shell('git rev-parse --abbrev-ref HEAD', | ||
check=True, | ||
capture_output=True, | ||
encoding='utf8').stdout.strip() | ||
|
||
shell('git fetch origin', check=True) | ||
|
||
timestamp = time.strftime('%Y-%m-%dT%H-%M-%S', time.gmtime()) | ||
branch_name = f'update-constraints-{timestamp}' | ||
|
||
shell(f'git checkout -b {branch_name} origin/master', check=True) | ||
|
||
try: | ||
shell('bin/update_dependencies.py', check=True) | ||
|
||
if not git_repo_has_changes(): | ||
print('Done: no constraint updates required.') | ||
return | ||
|
||
shell('git commit -a -m "Update dependencies"', check=True) | ||
run( | ||
[ | ||
'gh', 'pr', 'create', | ||
'--repo', 'joerick/cibuildwheel', | ||
'--base', 'master', | ||
'--title', 'Update dependencies', | ||
'--body', textwrap.dedent(f''' | ||
Update the versions of our dependencies. | ||
PR generated by `{os.path.basename(__file__)}`. | ||
''') | ||
], | ||
check=True | ||
) | ||
|
||
print('Done.') | ||
finally: | ||
# remove any local changes | ||
shell('git checkout -- .') | ||
shell(f'git checkout {previous_branch}', check=True) | ||
shell(f'git branch -D --force {branch_name}', check=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
main.main(standalone_mode=True) |
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,99 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import configparser | ||
import os | ||
import subprocess | ||
from collections import namedtuple | ||
|
||
import requests | ||
|
||
os.chdir(os.path.dirname(__file__)) | ||
os.chdir('..') | ||
|
||
# CUSTOM_COMPILE_COMMAND is a pip-compile option that tells users how to | ||
# regenerate the constraints files | ||
os.environ['CUSTOM_COMPILE_COMMAND'] = "bin/update_constraints.py" | ||
subprocess.check_call([ | ||
'pip-compile', | ||
'--allow-unsafe', | ||
'--upgrade', | ||
'cibuildwheel/resources/constraints.in', | ||
]) | ||
for python_version in ['27', '35', '36']: | ||
subprocess.check_call([ | ||
f'./env{python_version}/bin/pip-compile', | ||
'--allow-unsafe', | ||
'--upgrade', | ||
'cibuildwheel/resources/constraints.in', | ||
'--output-file', f'cibuildwheel/resources/constraints-python{python_version}.txt' | ||
]) | ||
|
||
Image = namedtuple('Image', [ | ||
'manylinux_version', | ||
'platform', | ||
'image_name', | ||
]) | ||
|
||
images = [ | ||
Image('manylinux1', 'x86_64', 'quay.io/pypa/manylinux1_x86_64'), | ||
Image('manylinux1', 'i686', 'quay.io/pypa/manylinux1_i686'), | ||
|
||
Image('manylinux2010', 'x86_64', 'quay.io/pypa/manylinux2010_x86_64'), | ||
Image('manylinux2010', 'i686', 'quay.io/pypa/manylinux2010_i686'), | ||
Image('manylinux2010', 'pypy_x86_64', 'pypywheels/manylinux2010-pypy_x86_64'), | ||
|
||
Image('manylinux2014', 'x86_64', 'quay.io/pypa/manylinux2014_x86_64'), | ||
Image('manylinux2014', 'i686', 'quay.io/pypa/manylinux2014_i686'), | ||
Image('manylinux2014', 'aarch64', 'quay.io/pypa/manylinux2014_aarch64'), | ||
Image('manylinux2014', 'ppc64le', 'quay.io/pypa/manylinux2014_ppc64le'), | ||
Image('manylinux2014', 's390x', 'quay.io/pypa/manylinux2014_s390x'), | ||
] | ||
|
||
config = configparser.ConfigParser() | ||
|
||
for image in images: | ||
# get the tag name whose digest matches 'latest' | ||
if image.image_name.startswith('quay.io/'): | ||
_, _, repository_name = image.image_name.partition('/') | ||
response = requests.get( | ||
f'https://quay.io/api/v1/repository/{repository_name}?includeTags=true' | ||
) | ||
response.raise_for_status() | ||
repo_info = response.json() | ||
tags_dict = repo_info['tags'] | ||
|
||
latest_tag = tags_dict.pop('latest') | ||
# find the tag whose manifest matches 'latest' | ||
tag_name = next( | ||
name | ||
for (name, info) in tags_dict.items() | ||
if info['manifest_digest'] == latest_tag['manifest_digest'] | ||
) | ||
else: | ||
response = requests.get( | ||
f'https://hub.docker.com/v2/repositories/{image.image_name}/tags' | ||
) | ||
response.raise_for_status() | ||
tags = response.json()['results'] | ||
|
||
latest_tag = next( | ||
tag for tag in tags if tag['name'] == 'latest' | ||
) | ||
# i don't know what it would mean to have multiple images per tag | ||
assert len(latest_tag['images']) == 1 | ||
digest = latest_tag['images'][0]['digest'] | ||
|
||
pinned_tag = next( | ||
tag | ||
for tag in tags | ||
if tag != latest_tag and tag['images'][0]['digest'] == digest | ||
) | ||
tag_name = pinned_tag['name'] | ||
|
||
if not config.has_section(image.platform): | ||
config[image.platform] = {} | ||
|
||
config[image.platform][image.manylinux_version] = f'{image.image_name}:{tag_name}' | ||
|
||
with open('cibuildwheel/resources/pinned_docker_images.cfg', 'w') as f: | ||
config.write(f) |
Oops, something went wrong.