From da23826f195de8248683a5383fbcea9cfc67ac1a Mon Sep 17 00:00:00 2001 From: KmolYuan Date: Mon, 23 Sep 2019 13:28:43 +0800 Subject: [PATCH 1/3] Add Windows build. --- .travis.yml | 8 ++-- appveyor.yml | 72 +++++++++++++++++++++++++----- cython/platform/set_pycompiler.bat | 18 ++++++++ 3 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 cython/platform/set_pycompiler.bat diff --git a/.travis.yml b/.travis.yml index e083cf57..d2d030a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -language: python - matrix: include: @@ -34,9 +32,10 @@ matrix: os: linux sudo: required dist: xenial + language: python python: "3.6" install: &python-install - - cd cython && python3 -m pip install -r requirements.txt && cd - + - python3 -m pip install -r cython/requirements.txt script: &python-script - cd cython && python3 setup.py test && cd - deploy: @@ -74,8 +73,9 @@ matrix: script: *python-script after_success: # PyPI deployment - - if [ -n "$TRAVIS_TAG" ]; then + - if [ "$TRAVIS_REPO_SLUG" == "KmolYuan/solvespace" && -n "$TRAVIS_TAG" ]; then python3 -m pip install twine; + cd cython; python3 setup.py sdist bdist_wheel; python3 -m twine upload cython/dist/*.whl --skip-existing; fi diff --git a/appveyor.yml b/appveyor.yml index 560492c1..84edf7b7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,17 @@ version: '{build}' clone_depth: 1 +environment: + MSYS_DIR: C:\msys64 + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + PYTHON_DIR: C:\Python36-x64 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + PYTHON_DIR: C:\Python37-x64 for: - - image: Visual Studio 2013 + - matrix: + only: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 before_build: - git submodule update --init - set tag=x%APPVEYOR_REPO_TAG_NAME% @@ -14,6 +24,55 @@ for: - msbuild "build\test\solvespace-testsuite.vcxproj" /verbosity:minimal /property:Configuration=%BUILD_TYPE% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" test_script: - build\bin\%BUILD_TYPE%\solvespace-testsuite.exe + deploy: + - provider: GitHub + auth_token: + secure: P9/pf2nM+jlWKe7pCjMp41HycBNP/+5AsmE/TETrDUoBOa/9WFHelqdVFrbRn9IC + description: "" + artifact: solvespace.exe,solvespace-cli.exe,solvespace.pdb + on: + APPVEYOR_REPO_NAME: solvespace/solvespace + APPVEYOR_REPO_TAG: true + + - matrix: + only: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + PYTHON_DIR: C:\Python36-x64 + install: &python-install + # Environment variables + - set Path=%MSYS_DIR%\mingw64\bin;%MSYS_DIR%\usr\bin;%Path% + - set Path=%PYTHON_DIR%;%PYTHON_DIR%\Scripts;%Path% + # Show Python + - python --version + - pip --version + # Upgrade setuptools + - pip install setuptools -U + # Set Python compiler to MinGW + - cython\platform\set_pycompiler %PYTHON_DIR% + # Install modules + - pip install -r cython\requirements.txt + # Show tool kits + - gcc --version + - mingw32-make --version + build_script: &python-script + - cd cython && python setup.py test && cd .. + deploy_script: &python-deploy + # PyPI deployment + - IF "%APPVEYOR_REPO_TAG%"=="true" + IF "%APPVEYOR_REPO_NAME%"=="KmolYuan/solvespace" ( + pip install twine && + cd cython && + python setup.py bdist_wheel && + twine upload cython\dist\*.whl --skip-existing + ) + + - matrix: + only: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + PYTHON_DIR: C:\Python37-x64 + install: *python-install + build_script: *python-script + deploy_script: *python-deploy artifacts: - path: build\bin\%BUILD_TYPE%\solvespace.exe @@ -22,13 +81,4 @@ artifacts: name: solvespace-cli.exe - path: build\bin\%BUILD_TYPE%\solvespace.pdb name: solvespace.pdb - -deploy: - - provider: GitHub - auth_token: - secure: P9/pf2nM+jlWKe7pCjMp41HycBNP/+5AsmE/TETrDUoBOa/9WFHelqdVFrbRn9IC - description: "" - artifact: solvespace.exe,solvespace-cli.exe,solvespace.pdb - on: - APPVEYOR_REPO_NAME: solvespace/solvespace - APPVEYOR_REPO_TAG: true + - path: cython\dist\*.whl diff --git a/cython/platform/set_pycompiler.bat b/cython/platform/set_pycompiler.bat new file mode 100644 index 00000000..03ec1ff1 --- /dev/null +++ b/cython/platform/set_pycompiler.bat @@ -0,0 +1,18 @@ +echo off + +REM Usage: set_pycompiler C:\Python37 +REM Where %PYTHON_DIR% is the directory of your Python installation. +REM In Pyslvs project. +set HERE=%~dp0 +set PYTHON_DIR=%1 + +REM Create "distutils.cfg" +echo [build]>> "%PYTHON_DIR%\Lib\distutils\distutils.cfg" +echo compiler=mingw32>> "%PYTHON_DIR%\Lib\distutils\distutils.cfg" + +REM Apply the patch of "cygwinccompiler.py". +REM Unix "patch" command of Msys. +patch "%PYTHON_DIR%\lib\distutils\cygwinccompiler.py" "%HERE%patch.diff" + +REM Copy "vcruntime140.dll" to "libs". +copy "%PYTHON_DIR%\vcruntime140.dll" "%PYTHON_DIR%\libs" From 0b2cfc4201b558852d15171ece3b38da407d31a2 Mon Sep 17 00:00:00 2001 From: KmolYuan Date: Mon, 23 Sep 2019 21:20:10 +0800 Subject: [PATCH 2/3] Update badges. --- cython/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cython/README.md b/cython/README.md index 65cebb90..bd8b5fda 100644 --- a/cython/README.md +++ b/cython/README.md @@ -1,6 +1,7 @@ +[![Version](https://img.shields.io/badge/version-3.0.0-yellow.svg)](https://github.com/KmolYuan/solvespace/releases/latest) [![Build status](https://ci.appveyor.com/api/projects/status/b2o8jw7xnfqghqr5?svg=true)](https://ci.appveyor.com/project/KmolYuan/solvespace) -[![Build status](https://travis-ci.org/KmolYuan/solvespace.svg)](https://travis-ci.org/KmolYuan/solvespace) -![OS](https://img.shields.io/badge/OS-Windows%2C%20Mac%20OS%2C%20Ubuntu-blue.svg) +[![Build status](https://img.shields.io/travis/KmolYuan/solvespace.svg?logo=travis)](https://travis-ci.org/KmolYuan/solvespace) +[![PyPI](https://img.shields.io/pypi/v/python-solvespace.svg)](https://pypi.org/project/python-solvespace/) [![GitHub license](https://img.shields.io/badge/license-GPLv3+-blue.svg)](https://raw.githubusercontent.com/KmolYuan/solvespace/master/LICENSE) python-solvespace From 67a87605db895d57bc0da2519aebf4e3834e253b Mon Sep 17 00:00:00 2001 From: KmolYuan Date: Mon, 23 Sep 2019 21:24:08 +0800 Subject: [PATCH 3/3] Fix PyPI readme format. --- .travis.yml | 22 +++++++++++----------- appveyor.yml | 2 +- cython/setup.py | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2d030a9..24ae152b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,16 +38,16 @@ matrix: - python3 -m pip install -r cython/requirements.txt script: &python-script - cd cython && python3 setup.py test && cd - - deploy: - provider: pypi - user: $TWINE_USERNAME - password: $TWINE_PASSWORD - skip_cleanup: true - skip_existing: true - file: cython/dist/*.whl - on: - repo: KmolYuan/solvespace - tags: true + before_deploy: cd cython + after_success: + # PyPI deployment + - if [[ "$TRAVIS_REPO_SLUG" == "KmolYuan/Pyslvs-UI" && -n "$TRAVIS_TAG" ]]; then + python3 -m pip install auditwheel twine; + python3 setup.py sdist bdist_wheel; + mkdir dist-new; + auditwheel repair dist/*.whl -w dist-new; + python3 -m twine upload dist-new/*.whl --skip-existing; + fi - <<: *linux python: "3.7" @@ -77,7 +77,7 @@ matrix: python3 -m pip install twine; cd cython; python3 setup.py sdist bdist_wheel; - python3 -m twine upload cython/dist/*.whl --skip-existing; + python3 -m twine upload dist/*.whl --skip-existing; fi - <<: *osx diff --git a/appveyor.yml b/appveyor.yml index 84edf7b7..6f61c24c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,7 +63,7 @@ for: pip install twine && cd cython && python setup.py bdist_wheel && - twine upload cython\dist\*.whl --skip-existing + twine upload dist\*.whl --skip-existing ) - matrix: diff --git a/cython/setup.py b/cython/setup.py index 14b36ed9..92b63e0f 100644 --- a/cython/setup.py +++ b/cython/setup.py @@ -113,6 +113,7 @@ setup( author_email=__email__, description="Python library of Solvespace", long_description=read("README.md"), + long_description_content_type='text/markdown', url="https://github.com/solvespace/solvespace", packages=find_packages(exclude=('tests',)), package_data={'': ["*.pyi"]},