Skip to content

Commit f1a1fc0

Browse files
authored
Build wheels as a github action (#957)
Co-Authored by: @JeanChristopheMorinPerso * Added pyproject.toml for python build environment * Added python wheel build action * Added workaround to setup.py disabling PYBIND11_FINDPYTHON for the cibuildwheel linux environment
1 parent afd2994 commit f1a1fc0

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

.github/workflows/python-package.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
env:
2727
OTIO_CXX_COVERAGE_BUILD: ON
2828
OTIO_CXX_BUILD_TMP_DIR: ${{ github.workspace }}/build
29-
29+
3030
steps:
3131
- uses: actions/[email protected]
3232
with:
@@ -64,3 +64,34 @@ jobs:
6464
flags: unittests
6565
name: opentimelineio-codecov
6666
fail_ci_if_error: true
67+
68+
package_wheels:
69+
name: Package wheels on ${{ matrix.os }}
70+
needs: build
71+
runs-on: ${{ matrix.os }}
72+
strategy:
73+
matrix:
74+
os: [ubuntu-latest, macOS-latest]
75+
python-build: [cp27*, cp37*, cp38*]
76+
77+
steps:
78+
- uses: actions/checkout@v2
79+
80+
# Used to host cibuildwheel
81+
- uses: actions/setup-python@v2
82+
83+
- name: Install cibuildwheel
84+
run: python -m pip install cibuildwheel==1.10.0
85+
86+
- name: Build wheels
87+
run: python -m cibuildwheel --output-dir wheelhouse
88+
# TODO: Solve for the 32-bit errors in windows python 2.7:
89+
# https://github.com/pybind/cmake_example/blob/master/.github/workflows/wheels.yml#L66
90+
env:
91+
CIBW_SKIP: cp27-win*
92+
CIBW_BUILD: ${{ matrix.python-build }}
93+
94+
- uses: actions/upload-artifact@v2
95+
with:
96+
name: wheels
97+
path: ./wheelhouse/*.whl

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
"wheel",
5+
"cmake>=3.12",
6+
]
7+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,14 @@ def cmake_generate(self):
112112
'-DOTIO_PYTHON_INSTALL:BOOL=ON',
113113
'-DOTIO_CXX_INSTALL:BOOL=ON',
114114
'-DCMAKE_BUILD_TYPE=' + self.build_config,
115-
'-DPYBIND11_FINDPYTHON=ON', # Smart tool to find python's libs
116-
] # https://pybind11.readthedocs.io/en/latest/compiling.html#findpython-mode
115+
]
116+
117+
# Within the manylinux docker containers used for linux wheel builds
118+
# pybind's findpython does not work for some reason
119+
if not os.environ.get("CIBUILDWHEEL") or platform.system() != "Linux":
120+
# Smart tool to find python's libs
121+
# https://pybind11.readthedocs.io/en/latest/compiling.html#findpython-mode
122+
cmake_args.append('-DPYBIND11_FINDPYTHON=ON')
117123

118124
# install the C++ into the opentimelineio/cxx-sdk directory under the
119125
# python installation

0 commit comments

Comments
 (0)