From 104b0ca4f50c75a2e569f2733238f2b792a0e2a2 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 29 May 2021 20:05:55 +0200 Subject: [PATCH 1/5] chore: use same `convert_to_generic_platform_wheel.py` script as cmake This prepares for `universal2` wheels and allows to create `py2.py3` wheels --- scripts/convert_to_generic_platform_wheel.py | 41 ++++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/scripts/convert_to_generic_platform_wheel.py b/scripts/convert_to_generic_platform_wheel.py index 10d737f..a163ef6 100644 --- a/scripts/convert_to_generic_platform_wheel.py +++ b/scripts/convert_to_generic_platform_wheel.py @@ -41,7 +41,7 @@ def _to_generic_pyver(pyver_tags): return ['py%s' % tag[2] if tag.startswith('cp') else tag for tag in pyver_tags] -def _convert_to_generic_platform_wheel(wheel_ctx): +def _convert_to_generic_platform_wheel(wheel_ctx, py2_py3, additional_platforms): """Switch to generic python tags and remove ABI tags from a wheel Convert implementation specific python tags to their generic equivalent and @@ -51,6 +51,10 @@ def _convert_to_generic_platform_wheel(wheel_ctx): ---------- wheel_ctx : InWheelCtx An open wheel context + py2_py3: Bool + Whether the pyver tag shall be py2.py3 or just the one inferred from the wheel name + additional_platforms : Optional[Iterable[str]] + An optional iterable of additional platform to add to the wheel """ abi_tags = ['none'] @@ -69,7 +73,14 @@ def _convert_to_generic_platform_wheel(wheel_ctx): # Update wheel filename fparts = wf.parsed_filename.groupdict() - original_platform_tags = fparts['plat'].split('.') + platform_tags = fparts['plat'].split('.') + logger.debug('Previous platform tags: %s', ', '.join(platform_tags)) + if additional_platforms: + platform_tags = list(sorted(set(platform_tags + [p for p in additional_platforms]))) + fparts['plat'] = '.'.join(platform_tags) + logger.debug('New platform tags ....: %s', ', '.join(platform_tags)) + else: + logger.debug('No platform tags change needed.') original_abi_tags = fparts['abi'].split('.') logger.debug('Previous ABI tags: %s', ', '.join(original_abi_tags)) @@ -82,6 +93,10 @@ def _convert_to_generic_platform_wheel(wheel_ctx): original_pyver_tags = fparts['pyver'].split('.') logger.debug('Previous pyver tags: %s', ', '.join(original_pyver_tags)) pyver_tags = _to_generic_pyver(original_pyver_tags) + if py2_py3: + if len(set(["py2", "py3"]) & set(pyver_tags)) == 0: + raise ValueError("pyver_tags does not contain py2 nor py3") + pyver_tags = list(sorted(set(pyver_tags + ["py2", "py3"]))) if pyver_tags != original_pyver_tags: logger.debug('New pyver tags ....: %s', ', '.join(pyver_tags)) fparts['pyver'] = '.'.join(pyver_tags) @@ -106,15 +121,14 @@ def _convert_to_generic_platform_wheel(wheel_ctx): # Python version, C-API version combinations pyc_apis = [] - for tag in in_info_tags: - py_ver = '.'.join(_to_generic_pyver(tag.split('-')[0].split('.'))) + for py_ver in pyver_tags: abi = 'none' pyc_apis.append('-'.join([py_ver, abi])) # unique Python version, C-API version combinations pyc_apis = unique_by_index(pyc_apis) # Set tags for each Python version, C-API combination - updated_tags = ['-'.join(tup) for tup in product(pyc_apis, original_platform_tags)] + updated_tags = ['-'.join(tup) for tup in product(pyc_apis, platform_tags)] if updated_tags != in_info_tags: del info['Tag'] @@ -128,7 +142,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx): return out_wheel -def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_original=False, verbose=0): +def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_original=False, verbose=0, + py2_py3=False, additional_platforms=None): logging.disable(logging.NOTSET) if verbose >= 1: logging.basicConfig(level=logging.DEBUG) @@ -140,7 +155,7 @@ def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_orig with InWheelCtx(wheel_path) as ctx: ctx.out_wheel = pjoin(out_dir, wheel_fname) - ctx.out_wheel = _convert_to_generic_platform_wheel(ctx) + ctx.out_wheel = _convert_to_generic_platform_wheel(ctx, py2_py3, additional_platforms) if remove_original: logger.info('Removed original wheel %s' % wheel_path) @@ -169,13 +184,23 @@ def main(): dest='remove_original', action='store_true', help='Remove original wheel') + p.add_argument("--py2-py3", + dest='py2_py3', + action='store_true', + help='Remove original wheel') + p.add_argument("-p", + "--add-platform", + dest='additional_platforms', + action="append", + help='Add a platform tag') args = p.parse_args() if not isfile(args.WHEEL_FILE): p.error('cannot access %s. No such file' % args.WHEEL_FILE) - convert_to_generic_platform_wheel(args.WHEEL_FILE, args.WHEEL_DIR, args.remove_original, args.verbose) + convert_to_generic_platform_wheel(args.WHEEL_FILE, args.WHEEL_DIR, args.remove_original, args.verbose, + args.py2_py3, args.additional_platforms) if __name__ == '__main__': From 8e5578e3ca981bd24ee18e2afebb96a19ad4dc1d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sat, 3 Jul 2021 22:46:32 -0400 Subject: [PATCH 2/5] ci: temporarily pin ruamel for Python 2 --- .circleci/config.yml | 2 +- .travis.yml | 2 +- appveyor.yml | 2 +- constraints.txt | 2 ++ scripts/manylinux2014-aarch64-build-and-test-wheel.sh | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 constraints.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index ed104b2..55ca42f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,7 +19,7 @@ references: # export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2) echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]" - /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci + /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci -c constraints.txt /opt/python/${MANYLINUX_PYTHON}/bin/ci - persist_to_workspace: root: ./ diff --git a/.travis.yml b/.travis.yml index 68032fa..e56217a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ before_install: - | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python -m pip install --disable-pip-version-check --upgrade pip - pip install -U scikit-ci scikit-ci-addons + pip install -U scikit-ci scikit-ci-addons -c constraints.txt ci_addons --install ../addons fi - | diff --git a/appveyor.yml b/appveyor.yml index ee382b4..45785d7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,7 +41,7 @@ cache: - C:\\cmake-3.6.2 init: - - "%PYTHON_DIR%\\python.exe -m pip install -U scikit-ci scikit-ci-addons" + - "%PYTHON_DIR%\\python.exe -m pip install -U scikit-ci scikit-ci-addons -c constraints.txt" - "%PYTHON_DIR%\\python.exe -m ci_addons --install ../addons" - ps: ../addons/appveyor/rolling-build.ps1 diff --git a/constraints.txt b/constraints.txt new file mode 100644 index 0000000..460d339 --- /dev/null +++ b/constraints.txt @@ -0,0 +1,2 @@ +ruamel.yaml.clib==0.2.2 +ruamel.yaml==0.16.13 diff --git a/scripts/manylinux2014-aarch64-build-and-test-wheel.sh b/scripts/manylinux2014-aarch64-build-and-test-wheel.sh index 2dbd71b..839b0ee 100755 --- a/scripts/manylinux2014-aarch64-build-and-test-wheel.sh +++ b/scripts/manylinux2014-aarch64-build-and-test-wheel.sh @@ -9,7 +9,7 @@ export PATH="/opt/python/${MANYLINUX_PYTHON}/bin:$PATH" cd /io ci_before_install() { - /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci scikit-ci-addons scikit-build + /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci scikit-ci-addons scikit-build -c constraints.txt } ci_install() { From 0f23004da949b974a071a788ff084c2cb685b95d Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 22 May 2021 15:44:49 +0200 Subject: [PATCH 3/5] chore: use a similar `repair_wheel.py` script as cmake --- scripts/repair_wheel.py | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 scripts/repair_wheel.py diff --git a/scripts/repair_wheel.py b/scripts/repair_wheel.py new file mode 100644 index 0000000..badd326 --- /dev/null +++ b/scripts/repair_wheel.py @@ -0,0 +1,65 @@ +import argparse +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel + + +def main(): + if sys.platform.startswith("linux"): + os_ = "linux" + elif sys.platform == "darwin": + os_ = "macos" + elif sys.platform == "win32": + os_ = "windows" + else: + raise NotImplementedError(f"sys.platform '{sys.platform}' is not supported yet.") + + p = argparse.ArgumentParser(description="Convert wheel to be independent of python implementation and ABI") + p.set_defaults(prog=Path(sys.argv[0]).name) + p.add_argument("WHEEL_FILE", help="Path to wheel file.") + p.add_argument( + "-w", + "--wheel-dir", + dest="WHEEL_DIR", + help=('Directory to store delocated wheels (default: "wheelhouse/")'), + default="wheelhouse/", + ) + + args = p.parse_args() + + file = Path(args.WHEEL_FILE).resolve(strict=True) + wheelhouse = Path(args.WHEEL_DIR).resolve() + wheelhouse.mkdir(parents=True, exist_ok=True) + + with tempfile.TemporaryDirectory() as tmpdir_: + tmpdir = Path(tmpdir_) + # use the platform specific repair tool first + if os_ == "linux": + subprocess.run(["auditwheel", "repair", "-w", str(tmpdir), str(file)], check=True, stdout=subprocess.PIPE) + elif os_ == "macos": + subprocess.run( + ["delocate-wheel", "--require-archs", "x86_64", "-w", str(tmpdir), str(file)], + check=True, + stdout=subprocess.PIPE, + ) + elif os_ == "windows": + # no specific tool, just copy + shutil.copyfile(file, tmpdir / file.name) + files = list(tmpdir.glob("*.whl")) + assert len(files) == 1, files + file = files[0] + + # make this a py2.py3 wheel + convert_to_generic_platform_wheel( + str(file), + out_dir=str(wheelhouse), + py2_py3=True, + ) + + +if __name__ == "__main__": + main() From f2e0802b0b0c81a63cd602717ef1a392ddfeb692 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 22 May 2021 15:51:26 +0200 Subject: [PATCH 4/5] refactor: split requirements --- MANIFEST.in | 2 +- requirements-deploy.txt | 8 ++++++++ requirements-dev.txt | 18 +++--------------- requirements-repair.txt | 1 + requirements-test.txt | 8 ++++++++ setup.py | 4 ++-- 6 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 requirements-deploy.txt create mode 100644 requirements-repair.txt create mode 100644 requirements-test.txt diff --git a/MANIFEST.in b/MANIFEST.in index 06860e3..bb57fcf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include CMakeLists.txt include NinjaUrls.cmake -include requirements-dev.txt +include requirements-test.txt include HISTORY.rst include README.rst include LICENSE_Apache_20 diff --git a/requirements-deploy.txt b/requirements-deploy.txt new file mode 100644 index 0000000..08e371d --- /dev/null +++ b/requirements-deploy.txt @@ -0,0 +1,8 @@ +twine + +# need to pin cryptography for manylinux1 builds & s390x/ppc64le builds +# cryptography only provides manylinux2010 wheels since 3.4.0 +# because of the lack of a decent rust compiler on manylinux1 +# For s390x/ppc64le builds, cryptography never provided wheels, the requirements to +# build from source are a relaxed when building the 3.3 series +cryptography~=3.3.2 ; sys_platform=="linux" and platform_machine in "i386, i486, i586, i686, x86_64, s390x, ppc64le" diff --git a/requirements-dev.txt b/requirements-dev.txt index e4087c7..b1a30bc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,18 +1,6 @@ -codecov>=2.0.5 -coverage>=4.2 - -# need to pin cryptography for manylinux1 builds -# cryptography only provides manylinux2010 wheels since 3.4.0 -# because of the lack of a decent rust compiler on manylinux1 -cryptography~=3.3.2 ; sys_platform=="linux" and platform_machine in "i386, i486, i586, i686, x86_64" -flake8>=3.0.4 -pytest>=4.5.0 -pytest-cov>=2.7.1 -pytest-runner>=5.1 -pytest-virtualenv>=1.7.0 +-r requirements-test.txt +-r requirements-repair.txt +-r requirements-deploy.txt scikit-build>=0.10.0 setuptools>=28.0.0 -twine -virtualenv>=15.0.3 wheel>=0.34 -wheeltools diff --git a/requirements-repair.txt b/requirements-repair.txt new file mode 100644 index 0000000..fe31845 --- /dev/null +++ b/requirements-repair.txt @@ -0,0 +1 @@ +git+https://github.com/jcfr/wheeltools.git@wheeltools-2018-10-28-a2f174d0e diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..5bc4e09 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,8 @@ +codecov>=2.0.5 +coverage>=4.2 +flake8>=3.0.4 +pytest>=4.5.0 +pytest-cov>=2.7.1 +pytest-runner>=5.1 +pytest-virtualenv>=1.7.0 +virtualenv>=15.0.3 diff --git a/setup.py b/setup.py index d826e78..a7aae6b 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def parse_requirements(filename): requirements = [] -dev_requirements = parse_requirements('requirements-dev.txt') +test_requirements = parse_requirements('requirements-test.txt') # Require pytest-runner only when running tests pytest_runner = (['pytest-runner>=2.0,<3dev'] @@ -79,6 +79,6 @@ def parse_requirements(filename): keywords='ninja build c++ fortran cross-platform cross-compilation', install_requires=requirements, - tests_require=dev_requirements, + tests_require=test_requirements, setup_requires=setup_requires ) From e31875a5526e9cb1eddc636fabbb8ec2bc03eae6 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 22 May 2021 15:52:59 +0200 Subject: [PATCH 5/5] ci: use cibuildwheel --- .circleci/config.yml | 123 --------------- .github/workflows/build.yml | 142 ++++++++++++++++++ .travis.yml | 117 --------------- appveyor.yml | 77 ---------- pyproject.toml | 26 ++++ requirements-deploy.txt | 8 - scikit-ci.yml | 72 --------- ...ylinux2014-aarch64-build-and-test-wheel.sh | 33 ---- 8 files changed, 168 insertions(+), 430 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 requirements-deploy.txt delete mode 100644 scikit-ci.yml delete mode 100755 scripts/manylinux2014-aarch64-build-and-test-wheel.sh diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 55ca42f..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,123 +0,0 @@ -version: 2 - -references: - - ci_steps: &ci_steps - working_directory: /work - steps: - - checkout - - run: - name: Run CI - command: | - # - # Set UPLOAD_SDIST environment variable - # - export UPLOAD_SDIST=$(echo ${CIRCLE_JOB} | cut -d"_" -f3) - echo "UPLOAD_SDIST [${UPLOAD_SDIST}]" - # - # Run CI - # - export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2) - echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]" - /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci -c constraints.txt - /opt/python/${MANYLINUX_PYTHON}/bin/ci - - persist_to_workspace: - root: ./ - paths: - - dist - - x64_build_job: &x64_build_job - docker: - - image: dockcross/manylinux1-x64 - <<: *ci_steps - - x86_build_job: &x86_build_job - docker: - - image: dockcross/manylinux1-x86 - <<: *ci_steps - - no_filters: &no_filters - filters: - tags: - only: /.*/ - -jobs: - - # x64 - manylinux-x64_cp27-cp27mu: - <<: *x64_build_job - manylinux-x64_cp37-cp37m_upload-sdist: - <<: *x64_build_job - - # x86 - manylinux-x86_cp27-cp27mu: - <<: *x86_build_job - manylinux-x86_cp37-cp37m: - <<: *x86_build_job - - deploy-master: - docker: - - image: circleci/python:3.7.0-stretch - steps: - - attach_workspace: - at: ./ - - run: - name: Deploy master - command: | - echo "Deploy master (not implemented)" - - deploy-release: - docker: - - image: circleci/python:3.7.0-stretch - steps: - - attach_workspace: - at: ./ - - run: - name: Deploy release - command: | - echo "Deploy release" - python -m venv ../venv - . ../venv/bin/activate - pip install twine - ls dist - twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/* - -workflows: - version: 2 - build-test-deploy: - jobs: - # x64 - - manylinux-x64_cp27-cp27mu: - <<: *no_filters - - manylinux-x64_cp37-cp37m_upload-sdist: - <<: *no_filters - # x86 - - manylinux-x86_cp27-cp27mu: - <<: *no_filters - - manylinux-x86_cp37-cp37m: - <<: *no_filters - - - deploy-master: - requires: - # x64 - - manylinux-x64_cp27-cp27mu - - manylinux-x64_cp37-cp37m_upload-sdist - # x86 - - manylinux-x86_cp27-cp27mu - - manylinux-x86_cp37-cp37m - filters: - branches: - only: master - - deploy-release: - requires: - # x64 - - manylinux-x64_cp27-cp27mu - - manylinux-x64_cp37-cp37m_upload-sdist - # x86 - - manylinux-x86_cp27-cp27mu - - manylinux-x86_cp37-cp37m - filters: - tags: - only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/ - branches: - ignore: /.*/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7e3636a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,142 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + push: + # branches: + # - master + # - main + # tags: + # - "*.*.*" + +jobs: + lint: + name: Lint + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.3 + + + build_wheels: + name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }} + needs: [lint] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + arch: "x86_64" + - os: ubuntu-20.04 + arch: "i686" + - os: ubuntu-20.04 + arch: "aarch64" + - os: ubuntu-20.04 + arch: "ppc64le" + - os: ubuntu-20.04 + arch: "s390x" + - os: windows-2019 + arch: "AMD64" + - os: windows-2019 + arch: "x86" + - os: macos-10.15 + arch: "x86_64" + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # required for versioneer to find tags + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1.2.0 + if: runner.os == 'Linux' + + - name: Build wheels + uses: pypa/cibuildwheel@v2.0.0a4 + env: + CIBW_ARCHS: "${{ matrix.arch }}" + + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + needs: [lint] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # required for versioneer to find tags + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + + test_sdist: + name: Test SDist with python ${{ matrix.python }} + needs: [build_sdist] + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + python: ["2.7", "3.6", "3.10-dev"] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + name: Install Python ${{ matrix.python }} + with: + python-version: ${{ matrix.python }} + + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - name: Install SDist + env: + SKBUILD_CONFIGURE_OPTIONS: "-DBUILD_CMAKE_FROM_SOURCE:BOOL=OFF" + run: pip install dist/*.tar.gz + + - name: Install test dependencies + run: pip install -r requirements-test.txt + + - name: Test installed SDist + run: pytest ./tests + + check_dist: + name: Check dist + needs: [build_wheels, build_sdist, test_sdist] + runs-on: ubuntu-20.04 + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - run: pipx run twine check --strict dist/* + + upload_pypi: + name: Upload to PyPI + needs: [build_wheels, build_sdist, test_sdist, check_dist] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.repository == 'scikit-build/ninja-python-distributions' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_RELEASE_PASSWORD }} + skip_existing: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e56217a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,117 +0,0 @@ -branches: - only: - - master - - /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/ - -language: python - -matrix: - include: - - - os: osx - language: generic - env: - - PYTHON_VERSION=3.7.9 - - - os: osx - language: generic - env: - - PYTHON_VERSION=2.7.18 - - - os: linux - arch: arm64-graviton2 - virt: vm - group: edge - dist: focal - language: generic - env: - - PYTHON_VERSION=3.8.5 - -cache: - directories: - # scikit-ci-addons - - $HOME/downloads - -before_install: - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - # Install official python distribution - curl -fsSLo /tmp/Python.pkg "https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macosx10.9.pkg" - sudo installer -pkg /tmp/Python.pkg -target / - PYTHON_VERSION2=${PYTHON_VERSION%.*} - PYTHON_VERSION1=${PYTHON_VERSION2%.*} - python_executable=/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION2}/bin/python${PYTHON_VERSION1} - # Install SSL certificates - curl -fsSLo /tmp/install_certifi.py https://github.com/joerick/cibuildwheel/raw/v1.10.0/cibuildwheel/resources/install_certifi.py - sudo ${python_executable} /tmp/install_certifi.py - ${python_executable} scripts/ssl-check.py - # Install packages - ${python_executable} -m pip install --disable-pip-version-check --upgrade pip - ${python_executable} -m pip install virtualenv - # Create and activate virtual environment - ${python_executable} -m virtualenv ${HOME}/.pyenv/versions/${PYTHON_VERSION} - source ${HOME}/.pyenv/versions/${PYTHON_VERSION}/bin/activate - fi - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - python -m pip install --disable-pip-version-check --upgrade pip - pip install -U scikit-ci scikit-ci-addons -c constraints.txt - ci_addons --install ../addons - fi - - | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - docker run --name python-ninja --rm -itd \ - -v $(pwd):/io \ - --env TRAVIS=True \ - --env TRAVIS_OS_NAME="${TRAVIS_OS_NAME}" \ - quay.io/pypa/manylinux2014_$(arch) bash - docker exec -it python-ninja /io/scripts/manylinux2014-aarch64-build-and-test-wheel.sh ci_before_install - fi - -install: - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ci install - elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - docker exec -it python-ninja /io/scripts/manylinux2014-aarch64-build-and-test-wheel.sh ci_install - fi - -script: - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ci test - elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - docker exec -it python-ninja /io/scripts/manylinux2014-aarch64-build-and-test-wheel.sh ci_script - fi - -after_success: - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ci after_test - elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - docker exec -it python-ninja /io/scripts/manylinux2014-aarch64-build-and-test-wheel.sh ci_after_success - docker stop python-ninja - fi - -deploy: - # deploy-release - - provider: script - script: pwd && ls dist;echo "deploy-release" && ~/.pyenv/versions/${PYTHON_VERSION}/bin/twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/* - skip_cleanup: true - on: - repo: ${TRAVIS_REPO_SLUG} - tags: true - # deploy-master - - provider: script - script: pwd && ls dist;echo "deploy-master" && echo "not implemented" - skip_cleanup: true - on: - repo: ${TRAVIS_REPO_SLUG} - branch: master - -env: - global: - # PYPI_USER - - secure: "sA3o5PT2DKbLWuJPTIr678arQbaeeIJ2ALKyyYlbzIQllhXtO3kkLlXmwcoReOKwwfW7VZdCU+G95bBpIsuhs8BjFmtOiZ3wwM93zah1r1MsJt/SybZdAdcZjdK0UCn9uYoU2mKshzpSEEtwfwMbVPeo4koJGQ7quFm1Gg06nmkpUvGmWQt6Fjr8f7xgZ3Rr07LcMjbI/cyuYL2kKPRFVXB8IFgY/ZDl7LjyaiaBc7HNd1W4E47GhF9dLJ3ueKW7kGamqj2/tv7mbrAnKG4F89uj4zIb5BWlo9QDuvs6M6uTf/QlXjb2oZ0KrX8Zt4T6eUz+zSZzpQ8L7P1rn7CwXbx9QksQbe8SKY6jz9yy7gyr9zTglJZySHo/6sMOv1zv9Akya9eVtfw8yENmCX8Q/5cMmmc1AfMwzrXWQrmEETAOPGwCu6LrLlILY2YNAY7B6aNOhxmGm9QZT3BBmkXf5JATPqHL0NC7x8B7yNFeod17To/wMaxpPsitxpsfssg4ff/D9uRw9GVVCp6jjUHHzcyiFHxxdwzfY1YslBqVQYTU8vbGeOm5WpBtdeaHr956NHmRBlvOZ4SpJncXAoAFFbQdajfvXrjjMxKyBdj7aTHOsRSAWmOw+o5Gba71uus2M5f5iDyGHM6hX7t7RSoW/WYubsROU66eUZBWpWkAvh8=" - # PYPI_PASSWORD - - secure: "shzENcgaOOVspVbdH0JsXVP9761809YNulGwB6qpBWzy+WURP7lYOSlUiAgSvPV576E80O7VvdUX5s/QQbcZNfLE25+mdSn5LsDocn+/KunKX1uHJkAXz0XpiOeuLMRjIQ+zSbTxVBkk7pe4dw6Y4ug+bSCuoe9IWo/JuOP5TNV2lZuiO2ggyGvXeXNCTJTzPsnCXq4rqbe5UM69JSyM8eGc79IVUUF02UfKhBBL2Six41yVDfN60YW+KLREI/g0/rg3PeagBVzAYvl3wftFxF3TCB6XujoIMPbgP/XFLcJA5+EU+5Uq8tXuPp2oU2UDySMjj67KjnWOsoUtqym7uqGTnN7HtftPGr9K77/KFmYc8OvEhhzzgaNkN2zFpARsYO+X5+KYhEAxD0q7u+7bjs9F8xe3bYFFtZB8DpGkTxlX0qAJ6Q1sNqb3sYDRzXQtCmGY4FO/f1qx0wY824JwaVDRn9GPRifkCoIqN8yuBTEldC8Ht50xiKzOBf+jAuZ7zVJAh9rCwzwQpq0xXY34cTUcOC7tnKVrgXZUxPz79cYeDbJ8VXe0oFPCH8EsgJBQ+7rkvZsljjXH2asH7K3cydECp/00J1HxSTHwq/ek+Sk4WZsLiGBTJUCv7aouBu51orviKeANVFvtsUgkRNwygX+jQAe7bCmQxlInQN7zwtQ=" diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 45785d7..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,77 +0,0 @@ -branches: - only: - - master - - /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/ - -version: "0.0.1.{build}" - -environment: - matrix: - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - PYTHON_DIR: "C:\\Python27" - PYTHON_VERSION: "2.7.x" - PYTHON_ARCH: "32" - BLOCK: "0" - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - PYTHON_DIR: "C:\\Python27-x64" - PYTHON_VERSION: "2.7.x" - PYTHON_ARCH: "64" - BLOCK: "0" - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PYTHON_DIR: "C:\\Python37" - PYTHON_VERSION: "3.7.x" - PYTHON_ARCH: "32" - BLOCK: "0" - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PYTHON_DIR: "C:\\Python37-x64" - PYTHON_VERSION: "3.7.x" - PYTHON_ARCH: "64" - BLOCK: "0" - - PYPI_USER: - secure: j/nubIi1eucjCtYuwpykWg== - PYPI_PASSWORD: - secure: qDoPKmtLMdcKUKRHuTlfaajjzO4Q4yu25FM5JuB7z84= - -cache: - - C:\\cmake-3.6.2 - -init: - - "%PYTHON_DIR%\\python.exe -m pip install -U scikit-ci scikit-ci-addons -c constraints.txt" - - "%PYTHON_DIR%\\python.exe -m ci_addons --install ../addons" - - - ps: ../addons/appveyor/rolling-build.ps1 - -install: - - "%PYTHON_DIR%\\python.exe -m ci install" - -build_script: - - "%PYTHON_DIR%\\python.exe -m ci build" - -test_script: - - "%PYTHON_DIR%\\python.exe -m ci test" - -after_test: - - "%PYTHON_DIR%\\python.exe -m ci after_test" - -on_finish: - - ps: ../addons/appveyor/enable-worker-remote-access.ps1 -check_for_block - -deploy_script: - - ps: | - if ($env:appveyor_repo_tag -eq $true -and $env:appveyor_repo_tag_name –match "^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$") { - Write-Host "deploy release" - $env:PATH="$env:PYTHON_DIR/Scripts/;$env:PATH" - twine upload -u $env:PYPI_USER -p $env:PYPI_PASSWORD --skip-existing dist/* - } elseif ($env:appveyor_repo_branch -eq "master") { - Write-Host "deploy master (not implemented)" - } else { - Write-Host "nothing to deploy" - } - -matrix: - fast_finish: false diff --git a/pyproject.toml b/pyproject.toml index 80c0c51..ad0c474 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,29 @@ [build-system] requires = ["setuptools>=42", "wheel", "scikit-build"] build-backend = "setuptools.build_meta" + +[tool.cibuildwheel] +build = "cp39-*" +before-all = [ + "pipx install cmake==3.20.4", + "cmake --version", +] +before-build = "pip install -r requirements-repair.txt" +repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}" +test-requires = "-r requirements-test.txt" +test-command = "pytest {project}/tests" + +[tool.cibuildwheel.linux] +manylinux-x86_64-image = "manylinux1" +manylinux-i686-image = "manylinux1" + +[tool.cibuildwheel.macos.environment] +MACOSX_DEPLOYMENT_TARGET = "10.9" + +[tool.cibuildwheel.windows] +before-all = [ + "pipx install cmake==3.20.4", + "cmake --version", + "pipx install ninja==1.10.0.post2", + "ninja --version", +] diff --git a/requirements-deploy.txt b/requirements-deploy.txt deleted file mode 100644 index 08e371d..0000000 --- a/requirements-deploy.txt +++ /dev/null @@ -1,8 +0,0 @@ -twine - -# need to pin cryptography for manylinux1 builds & s390x/ppc64le builds -# cryptography only provides manylinux2010 wheels since 3.4.0 -# because of the lack of a decent rust compiler on manylinux1 -# For s390x/ppc64le builds, cryptography never provided wheels, the requirements to -# build from source are a relaxed when building the 3.3 series -cryptography~=3.3.2 ; sys_platform=="linux" and platform_machine in "i386, i486, i586, i686, x86_64, s390x, ppc64le" diff --git a/scikit-ci.yml b/scikit-ci.yml deleted file mode 100644 index bc21737..0000000 --- a/scikit-ci.yml +++ /dev/null @@ -1,72 +0,0 @@ -schema_version: "0.5.0" - -before_install: - - appveyor: - environment: - PATH: $;$\\Scripts;$ - commands: - - python ../addons/appveyor/patch_vs2008.py - - circle: - environment: - PATH: /opt/python/$/bin:$ - # Required to build cryptography wheel from source for cp37-cp37 when using manylinux-x86 - CFLAGS: -I/usr/local/ssl/include -L/usr/local/ssl/lib - - travis: - osx: - environment: - PATH: $/.pyenv/versions/$/bin:$ - SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-10.6-x86_64 - -install: - commands: - - python -c "import sys; print(sys.version)" - - python -m pip install --disable-pip-version-check --upgrade pip - - pip install git+https://github.com/jcfr/wheeltools.git@wheeltools-2018-10-28-a2f174d0e - - pip install -U -r requirements-dev.txt - -before_build: - commands: - - flake8 - -build: - commands: - # Source distribution - - python setup.py --hide-listing sdist - # Built distribution (wheel) - - python setup.py --hide-listing bdist_wheel $ -- $ - # Cleanup - - python: | - import glob, os - if os.environ.get("UPLOAD_SDIST", "") == "": - sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0] - print("Deleting [%s]" % sdist) - os.remove(sdist) - - circle: - commands: - - | - # Since there are no external shared libraries to bundle into the wheels - # this step will fixup the wheel switching from 'linux' to 'manylinux' tag - for whl in dist/*$(python -c "import wheel.pep425tags as w; print(w.get_platform())").whl; do - auditwheel repair $whl -w ./dist/ - rm $whl - done - -test: - commands: - # Convert to generic platform wheel - - python: | - import glob, sys - sys.path.insert(0, "./scripts") - from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel - wheels = glob.glob("dist/*.whl") - for wheel in wheels: - convert_to_generic_platform_wheel(wheel, remove_original=True) - - python setup.py test - -#after_test: -# commands: -# - codecov -X gcov --required --file ./tests/coverage.xml diff --git a/scripts/manylinux2014-aarch64-build-and-test-wheel.sh b/scripts/manylinux2014-aarch64-build-and-test-wheel.sh deleted file mode 100755 index 839b0ee..0000000 --- a/scripts/manylinux2014-aarch64-build-and-test-wheel.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e -set -x - -MANYLINUX_PYTHON=cp38-cp38 -export PATH="/opt/python/${MANYLINUX_PYTHON}/bin:$PATH" - -cd /io - -ci_before_install() { - /opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci scikit-ci-addons scikit-build -c constraints.txt -} - -ci_install() { - /opt/python/${MANYLINUX_PYTHON}/bin/ci install -} -ci_script() { - /opt/python/${MANYLINUX_PYTHON}/bin/ci test -} -ci_after_success() { - /opt/python/${MANYLINUX_PYTHON}/bin/ci after_test -} - - -if [[ $1 == 'all' ]]; then - ci_before_install - ci_install - ci_script - ci_after_success -else - $1 -fi