diff --git a/.github/workflows/pypi-deploy.yml b/.github/workflows/pypi-deploy.yml index eced054..a1cf301 100644 --- a/.github/workflows/pypi-deploy.yml +++ b/.github/workflows/pypi-deploy.yml @@ -7,9 +7,20 @@ on: jobs: + build_setup: + name: Prepare environment for wheel builds + runs-on: ubuntu-20.04 + steps: + -name: Install make + run: apt-get install make + - name: Prepare files + run: make setup + working-directory: python/ + build_wheels: name: Build binary wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + needs: [build_setup] strategy: matrix: os: [ubuntu-20.04, windows-2019, macOS-10.15] @@ -24,10 +35,13 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse working-directory: python/ + # env: + # CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-* build_sdist: name: Build source distribution runs-on: ubuntu-latest + needs: [build_setup] steps: - uses: actions/checkout@v2 - name: Install cython diff --git a/.gitignore b/.gitignore index 13306cc..0532fd2 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ python/dist python/*.soc python/lib/ python/*.cpp +python/wheelhouse/ diff --git a/README.md b/README.md index 9f6f8b8..7136a89 100644 --- a/README.md +++ b/README.md @@ -224,3 +224,7 @@ can be found in the `python/examples` folder. - https://github.com/Apollo3zehn/ImcFamosFile - https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html - https://pypi.org/help/#apitoken +- https://sgoel.dev/posts/uploading-binary-wheels-to-pypi-from-github-actions/ +- https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun +- https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml +- https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/ diff --git a/python/pyproject.toml b/python/pyproject.toml index 89ac503..0e657f5 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,4 +4,3 @@ build-backend = "setuptools.build_meta" [tool.cibuildwheel] before-all = "" - diff --git a/python/setup.cfg b/python/setup.cfg index c8ff6e1..5f059f6 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -7,7 +7,7 @@ version = file: VERSION author = Record Evolution GmbH author_email = mario.fink@record-evolution.de maintainer = Record Evolution GmbH -url= 'https://github.com/RecordEvolution/IMCtermite.git' +url= https://github.com/RecordEvolution/IMCtermite.git license = MIT License license_files = LICENSE keywords = IMC, raw, imcFAMOS, imcSTUDIO, imcCRONOS @@ -15,5 +15,7 @@ classifiers = Programming Language :: Python :: 3, License :: OSI Approved :: MIT License, Operating System :: OS Independent + Topic :: Scientific/Engineering + Topic :: Software Development :: Libraries :: Python Modules [options] diff --git a/python/setup.py b/python/setup.py index 43250c9..6341dcd 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,6 +1,22 @@ -from setuptools import setup +from setuptools import Extension, setup from Cython.Build import cythonize +import os +import sys + +print("building on platform: "+sys.platform) + +cmpArgs = { + "linux": ['-std=c++17','-Wno-unused-variable'], + "darwin": ['-std=c++17','-Wno-unused-variable'], + "win32": ['/EHsc','/std:c++17'] +} + +extension = Extension( + "IMCtermite", + sources=["IMCtermite.pyx"], + extra_compile_args=cmpArgs[sys.platform] +) setup( - ext_modules=cythonize(["IMCtermite.pyx"],language_level=3) + ext_modules=cythonize(extension,language_level=3) )