Compare commits

...
5 Commits
Author SHA1 Message Date
Joe Rickerby d12e54af41 Bump version: v1.6.4 2020-10-31 15:56:43 +00:00
Matthieu DarboisandJoe Rickerby 336c80b694 Use certifi provided certificates when downloading files (#455)
* Use certifi provided certificates when downloading files

* fix typo

* Add comment about certifi usage

Co-authored-by: Joe Rickerby <joerick@mac.com>

Co-authored-by: Joe Rickerby <joerick@mac.com>
2020-10-31 10:06:14 +01:00
Joe Rickerby 7dcd6826a4 Merge pull request #439 from dimitern/dimitern-xmlstarlet-example-readme
Add xmlstarlet to Working examples.
2020-10-30 22:20:35 +00:00
Dimiter Naydenov 3e7a665b11 Updated description 2020-10-07 19:26:32 +03:00
Dimiter Naydenov 734377b5f5 Add xmlstarlet to Working examples.
Building binary wheels for Python 3.6+ and Linux, MacOS, and Windows.
The easiest way to install and use the tool on Windows (from Python), also builds a truly native MSVC win_amd64 binary (not MinGW64).
I couldn't find a good example of a usable CFFI cross-platform binary wheel build setup (esp. when the original C sources only build under MinGW32).
2020-10-04 20:45:46 +03:00
13 changed files with 63 additions and 19 deletions
+9 -2
View File
@@ -85,7 +85,7 @@ env:
# Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings # Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings
install: install:
- python3 -m pip install cibuildwheel==1.6.3 - python3 -m pip install cibuildwheel==1.6.4
script: script:
# build the wheels, put them into './wheelhouse' # build the wheels, put them into './wheelhouse'
@@ -145,7 +145,7 @@ Here are some repos that use cibuildwheel.
- [pikepdf](https://github.com/pikepdf/pikepdf) - [pikepdf](https://github.com/pikepdf/pikepdf)
- [fathon](https://github.com/stfbnc/fathon) - [fathon](https://github.com/stfbnc/fathon)
- [etebase-py](https://github.com/etesync/etebase-py) - Python bindings to a Rust library using `setuptools-rust`, and `sccache` for improved speed, built on Travis CI. - [etebase-py](https://github.com/etesync/etebase-py) - Python bindings to a Rust library using `setuptools-rust`, and `sccache` for improved speed, built on Travis CI.
- [xmlstarlet](https://github.com/dimitern/xmlstarlet) - Python 3.6+ CFFI bindings with true MSVC build and GitHub Actions.
> Add your repo here! Send a PR. > Add your repo here! Send a PR.
> >
> <sup>I'd like to include notes here to indicate why an example might be interesting to cibuildwheel users - the styles/technologies/techniques used in each. Please include that in future additions!</sup> > <sup>I'd like to include notes here to indicate why an example might be interesting to cibuildwheel users - the styles/technologies/techniques used in each. Please include that in future additions!</sup>
@@ -162,6 +162,13 @@ This is similar to static linking, so it might have some licence implications. C
Changelog Changelog
========= =========
### 1.6.4
_31 October 2020_
- 🐛 Fix crash on Appveyor during nuget install due to old system CA
certificates. We now use certifi's CA certs to download files. (#455)
### 1.6.3 ### 1.6.3
_12 October 2020_ _12 October 2020_
+1 -1
View File
@@ -1 +1 @@
__version__ = '1.6.3' __version__ = '1.6.4'
+7 -1
View File
@@ -1,6 +1,8 @@
import os import os
import textwrap import textwrap
import certifi
import urllib.request import urllib.request
import ssl
from fnmatch import fnmatch from fnmatch import fnmatch
from pathlib import Path from pathlib import Path
from time import sleep from time import sleep
@@ -66,10 +68,14 @@ def download(url: str, dest: Path) -> None:
if not dest_dir.exists(): if not dest_dir.exists():
dest_dir.mkdir(parents=True) dest_dir.mkdir(parents=True)
# we've had issues when relying on the host OS' CA certificates on Windows,
# so we use certifi (this sounds odd but requests also does this by default)
cafile = os.environ.get('SSL_CERT_FILE', certifi.where())
context = ssl.create_default_context(cafile=cafile)
repeat_num = 3 repeat_num = 3
for i in range(repeat_num): for i in range(repeat_num):
try: try:
response = urllib.request.urlopen(url) response = urllib.request.urlopen(url, context=context)
except Exception: except Exception:
if i == repeat_num - 1: if i == repeat_num - 1:
raise raise
+1 -1
View File
@@ -12,7 +12,7 @@ stack: python 3.7
init: init:
- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH% - cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH%
install: python -m pip install cibuildwheel==1.6.3 install: python -m pip install cibuildwheel==1.6.4
build_script: python -m cibuildwheel --output-dir wheelhouse build_script: python -m cibuildwheel --output-dir wheelhouse
+3 -3
View File
@@ -5,7 +5,7 @@ jobs:
- task: UsePythonVersion@0 - task: UsePythonVersion@0
- bash: | - bash: |
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
pip3 install cibuildwheel==1.6.3 pip3 install cibuildwheel==1.6.4
cibuildwheel --output-dir wheelhouse . cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'} inputs: {pathtoPublish: 'wheelhouse'}
@@ -16,7 +16,7 @@ jobs:
- task: UsePythonVersion@0 - task: UsePythonVersion@0
- bash: | - bash: |
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
pip3 install cibuildwheel==1.6.3 pip3 install cibuildwheel==1.6.4
cibuildwheel --output-dir wheelhouse . cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'} inputs: {pathtoPublish: 'wheelhouse'}
@@ -29,7 +29,7 @@ jobs:
displayName: Install Visual C++ for Python 2.7 displayName: Install Visual C++ for Python 2.7
- bash: | - bash: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install cibuildwheel==1.6.3 pip install cibuildwheel==1.6.4
cibuildwheel --output-dir wheelhouse . cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'} inputs: {pathtoPublish: 'wheelhouse'}
+2 -2
View File
@@ -11,7 +11,7 @@ jobs:
- run: - run:
name: Build the Linux wheels. name: Build the Linux wheels.
command: | command: |
pip3 install --user cibuildwheel==1.6.3 pip3 install --user cibuildwheel==1.6.4
cibuildwheel --output-dir wheelhouse cibuildwheel --output-dir wheelhouse
- store_artifacts: - store_artifacts:
path: wheelhouse/ path: wheelhouse/
@@ -26,7 +26,7 @@ jobs:
- run: - run:
name: Build the OS X wheels. name: Build the OS X wheels.
command: | command: |
pip3 install cibuildwheel==1.6.3 pip3 install cibuildwheel==1.6.4
cibuildwheel --output-dir wheelhouse cibuildwheel --output-dir wheelhouse
- store_artifacts: - store_artifacts:
path: wheelhouse/ path: wheelhouse/
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Install cibuildwheel - name: Install cibuildwheel
run: | run: |
python -m pip install cibuildwheel==1.6.3 python -m pip install cibuildwheel==1.6.4
- name: Install Visual C++ for Python 2.7 - name: Install Visual C++ for Python 2.7
if: runner.os == 'Windows' if: runner.os == 'Windows'
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
- name: Install cibuildwheel - name: Install cibuildwheel
run: | run: |
python -m pip install cibuildwheel==1.6.3 python -m pip install cibuildwheel==1.6.4
- name: Install Visual C++ for Python 2.7 - name: Install Visual C++ for Python 2.7
if: runner.os == 'Windows' if: runner.os == 'Windows'
+1 -1
View File
@@ -27,7 +27,7 @@ env:
# Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings # Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings
install: install:
- python3 -m pip install cibuildwheel==1.6.3 - python3 -m pip install cibuildwheel==1.6.4
script: script:
# build the wheels, put them into './wheelhouse' # build the wheels, put them into './wheelhouse'
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe - ln -s /c/Python38/python.exe /c/Python38/python3.exe
install: install:
- python3 -m pip install cibuildwheel==1.6.3 - python3 -m pip install cibuildwheel==1.6.4
script: script:
# build the wheels, put them into './wheelhouse' # build the wheels, put them into './wheelhouse'
+3 -3
View File
@@ -55,7 +55,7 @@ jobs:
- stage: deploy - stage: deploy
name: Build and deploy Linux wheels name: Build and deploy Linux wheels
services: docker services: docker
install: python3 -m pip install cibuildwheel==1.6.3 install: python3 -m pip install cibuildwheel==1.6.4
script: python3 -m cibuildwheel --output-dir wheelhouse script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: | after_success: |
python3 -m pip install twine python3 -m pip install twine
@@ -67,7 +67,7 @@ jobs:
# PyPy 7.3.2 needs macOS >= 10.14 # PyPy 7.3.2 needs macOS >= 10.14
osx_image: xcode10.2 osx_image: xcode10.2
language: shell language: shell
install: python3 -m pip install cibuildwheel==1.6.3 install: python3 -m pip install cibuildwheel==1.6.4
script: python3 -m cibuildwheel --output-dir wheelhouse script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: | after_success: |
python3 -m pip install twine python3 -m pip install twine
@@ -77,7 +77,7 @@ jobs:
name: Build and deploy Windows wheels name: Build and deploy Windows wheels
os: windows os: windows
language: shell language: shell
install: python3 -m pip install cibuildwheel==1.6.3 install: python3 -m pip install cibuildwheel==1.6.4
script: python3 -m cibuildwheel --output-dir wheelhouse script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: | after_success: |
python3 -m pip install twine python3 -m pip install twine
+2 -2
View File
@@ -11,8 +11,8 @@ long_description = (this_directory / 'README.md').read_text(encoding='utf-8')
setup( setup(
name='cibuildwheel', name='cibuildwheel',
version='1.6.3', version='1.6.4',
install_requires=['bashlex!=0.13', 'toml'], install_requires=['bashlex!=0.13', 'toml', 'certifi'],
description="Build Python wheels on CI with minimal configuration.", description="Build Python wheels on CI with minimal configuration.",
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
+31
View File
@@ -0,0 +1,31 @@
import certifi
import pytest
import ssl
from cibuildwheel.util import download
DOWNLOAD_URL = 'https://raw.githubusercontent.com/joerick/cibuildwheel/v1.6.3/requirements-dev.txt'
def test_download(monkeypatch, tmp_path):
monkeypatch.delenv('SSL_CERT_FILE', raising=False)
dest = tmp_path / 'file.txt'
download(DOWNLOAD_URL, dest)
assert len(dest.read_bytes()) == 134
def test_download_good_ssl_cert_file(monkeypatch, tmp_path):
monkeypatch.setenv('SSL_CERT_FILE', certifi.where())
dest = tmp_path / 'file.txt'
download(DOWNLOAD_URL, dest)
assert len(dest.read_bytes()) == 134
def test_download_bad_ssl_cert_file(monkeypatch, tmp_path):
bad_cafile = tmp_path / 'ca.pem'
bad_cafile.write_text('bad certificates')
monkeypatch.setenv('SSL_CERT_FILE', str(bad_cafile))
dest = tmp_path / 'file.txt'
with pytest.raises(ssl.SSLError):
download(DOWNLOAD_URL, dest)