diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 0000000..cb8ce7d --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,41 @@ +steps: +- label: ":package: Build" + key: build + env: + CIBW_BEFORE_ALL: mkdir openexr/build && cd openexr/build && cmake .. -DCMAKE_INSTALL_PREFIX=../../openexr-install && make all install + CIBW_ENVIRONMENT: LD_LIBRARY_PATH=/project/openexr-install/lib64:/project/openexr-install/lib + CIBW_BUILD: cp37-*_x86_64 cp38-*_x86_64 cp39-*_x86_64 cp310-*_x86_64 + command: | + echo "--- Install tools" + python -m pip install cibuildwheel + curl -o /docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz + tar --strip-components 1 -C /usr/local/bin -xzvf /docker.tgz docker/docker + chmod +x /usr/local/bin/docker + echo "+++ Build sdist" + python setup.py sdist + echo "+++ Build wheels" + python -m cibuildwheel --platform linux + mv wheelhouse/*.whl dist/ + artifact_paths: + - dist/**/* + plugins: + - coderanger/k8s#next: + image: python:3.10 + mount-hostpath: /var/run/docker-dind/docker.sock:/var/run/docker.sock:Socket + mount-secret: + - buildkite:/secrets + resources-request-cpu: 2000m + patch: | + function(job) job { + spec+: { + template+: { + spec+:{ + serviceAccountName: "docker-push", + tolerations: [{ key: "docker-build", value: "true", operator: "Equal", effect: "NoSchedule" }], + nodeSelector: {"cloud.google.com/gke-nodepool": "docker-build"}, + }, + }, + }, + } +- wait +- gm_snippet: py-upload diff --git a/.gitignore b/.gitignore index a58a8c5..096e7a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.pyc out*.exr build/ +wheelhouse/ +dist/ +MANIFEST diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4188ccc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "openexr"] + path = openexr + url = https://github.com/AcademySoftwareFoundation/openexr.git diff --git a/openexr b/openexr new file mode 160000 index 0000000..8bc3741 --- /dev/null +++ b/openexr @@ -0,0 +1 @@ +Subproject commit 8bc3741131db146ad08a5b83af9e6e48f0e94a03 diff --git a/setup.py b/setup.py index 4d307ee..ec7f965 100644 --- a/setup.py +++ b/setup.py @@ -1,41 +1,60 @@ -from distutils.core import setup -from distutils.extension import Extension +import os +import platform +import sys from distutils.command.build_py import build_py as _build_py +from distutils.core import Extension, setup +from distutils.extension import Extension from distutils.sysconfig import get_config_var from distutils.version import LooseVersion -import sys -import os -import platform -from distutils.core import setup, Extension +version = "1.3.2+geomagical.3" +compiler_args = ["-g", '-DVERSION="%s"' % version] -version = "1.3.2" -compiler_args = ['-g', '-DVERSION="%s"' % version] +openexr_lib = "openexr-install/lib64" +if not os.path.exists(openexr_lib): + openexr_lib = "openexr-install/lib" -if sys.platform == 'darwin': - compiler_args.append('-std=c++14') - if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ: +lib_suffix = ".so.25" +link_args = [f"-Wl,-rpath,$ORIGIN/{openexr_lib}"] +if sys.platform == "darwin": + lib_suffix = ".25.dylib" + link_args = [] + compiler_args.append("-std=c++14") + if "MACOSX_DEPLOYMENT_TARGET" not in os.environ: current_system = LooseVersion(platform.mac_ver()[0]) - python_target = LooseVersion( - get_config_var('MACOSX_DEPLOYMENT_TARGET')) - if python_target < '10.9' and current_system >= '10.9': - os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9' + python_target = LooseVersion(str(get_config_var("MACOSX_DEPLOYMENT_TARGET"))) + if python_target < "10.9" and current_system >= "10.9": + os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9" - -setup(name='OpenEXR', - author = 'James Bowman', - author_email = 'jamesb@excamera.com', - url = 'http://www.excamera.com/sphinx/articles-openexr.html', - description = "Python bindings for ILM's OpenEXR image file format", - long_description = "Python bindings for ILM's OpenEXR image file format", - version=version, - ext_modules=[ - Extension('OpenEXR', - ['OpenEXR.cpp'], - include_dirs=['/usr/include/OpenEXR', '/usr/local/include/OpenEXR', '/opt/local/include/OpenEXR'], - library_dirs=['/usr/local/lib', '/opt/local/lib'], - libraries=['Iex', 'Half', 'Imath', 'IlmImf', 'z'], - extra_compile_args=compiler_args) - ], - py_modules=['Imath'], +setup( + name="OpenEXR", + author="James Bowman", + author_email="jamesb@excamera.com", + url="http://www.excamera.com/sphinx/articles-openexr.html", + description="Python bindings for ILM's OpenEXR image file format", + long_description="Python bindings for ILM's OpenEXR image file format", + version=version, + ext_modules=[ + Extension( + "OpenEXR", + ["OpenEXR.cpp"], + include_dirs=["openexr-install/include/OpenEXR"], + library_dirs=[openexr_lib], + libraries=["Iex", "Half", "Imath", "IlmImf", "z"], + extra_compile_args=compiler_args, + extra_link_args=link_args, + ) + ], + py_modules=["Imath"], + packages=[""], + package_data={ + "": [ + f"{openexr_lib}/libIex-2_5{lib_suffix}", + f"{openexr_lib}/libHalf-2_5{lib_suffix}", + f"{openexr_lib}/libImath-2_5{lib_suffix}", + f"{openexr_lib}/libIlmImf-2_5{lib_suffix}", + f"{openexr_lib}/libIexMath-2_5{lib_suffix}", + f"{openexr_lib}/libIlmThread-2_5{lib_suffix}", + ] + }, )