From 2a4cd9fa9b251283485c1570f87ef71ff101ef9d Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Tue, 9 Feb 2021 22:33:27 -0800 Subject: [PATCH 01/11] Support for newer macOS where MACOSX_DEPLOYMENT_TARGET is an int (11) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4d307ee..6a2f133 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ: current_system = LooseVersion(platform.mac_ver()[0]) python_target = LooseVersion( - get_config_var('MACOSX_DEPLOYMENT_TARGET')) + str(get_config_var('MACOSX_DEPLOYMENT_TARGET'))) if python_target < '10.9' and current_system >= '10.9': os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9' From c1bd124bc1729bf48134eb8b7389f4cfee83c7cc Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 01:13:01 -0800 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20A=20CI=20pipeline=20and=20setup=20with=20cibuildwheel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 32 +++++++++++++++++ .gitignore | 1 + .gitmodules | 3 ++ openexr | 1 + setup.py | 77 +++++++++++++++++++++++------------------ 5 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 .buildkite/pipeline.yml create mode 100644 .gitmodules create mode 160000 openexr diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 0000000..8867756 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,32 @@ +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 + CIBW_BUILD: cp37-*_x86_64 cp38-*_x86_64 cp39-*_x86_64 cp310-*_x86_64 + command: | + python -m cibuildwheel --platform linux + artifact_paths: + - wheelhouse/**/* + 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..4e086f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc out*.exr build/ +wheelhouse/ 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 6a2f133..fe7c43f 100644 --- a/setup.py +++ b/setup.py @@ -1,41 +1,52 @@ -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" -compiler_args = ['-g', '-DVERSION="%s"' % version] +version = "1.3.2-geomagical1" +compiler_args = ["-g", '-DVERSION="%s"' % version] -if sys.platform == 'darwin': - compiler_args.append('-std=c++14') - if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ: +if sys.platform == "darwin": + compiler_args.append("-std=c++14") + if "MACOSX_DEPLOYMENT_TARGET" not in os.environ: current_system = LooseVersion(platform.mac_ver()[0]) - 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' + 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-install/lib64"], + libraries=["Iex", "Half", "Imath", "IlmImf", "z"], + extra_compile_args=compiler_args, + extra_link_args=["-Wl,-rpath,openexr-install/lib64"], + ) + ], + py_modules=["Imath"], + packages=[""], + package_data={ + "": [ + "openexr-install/lib64/libIex-2_5.so.25", + "openexr-install/lib64/libHalf-2_5.so.25", + "openexr-install/lib64/libImath-2_5.so.25", + "openexr-install/lib64/libIlmImf-2_5.so.25", + "openexr-install/lib64/libIexMath-2_5.so.25", + "openexr-install/lib64/libIlmThread-2_5.so.25", + ] + }, ) From 126a170c72487cadb729412df9750091d10f190e Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 01:18:29 -0800 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20It=20helps=20to=20actually=20install=20the=20tool=20first.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8867756..937a0fb 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -6,6 +6,7 @@ steps: CIBW_ENVIRONMENT: LD_LIBRARY_PATH=/project/openexr-install/lib64 CIBW_BUILD: cp37-*_x86_64 cp38-*_x86_64 cp39-*_x86_64 cp310-*_x86_64 command: | + python -m pip install cibuildwheel python -m cibuildwheel --platform linux artifact_paths: - wheelhouse/**/* From 0343eebf9bf095749ac0ca18b40bee164aedae12 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 01:25:33 -0800 Subject: [PATCH 04/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20Install=20the=20docker=20client=20too.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 937a0fb..a65da8c 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -7,6 +7,9 @@ steps: CIBW_BUILD: cp37-*_x86_64 cp38-*_x86_64 cp39-*_x86_64 cp310-*_x86_64 command: | python -m pip install cibuildwheel + curl -o /docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz + tar xzvf /docker.tgz docker/docker --strip-components 1 -C /usr/local/bin + chmod +x /usr/local/bin/docker python -m cibuildwheel --platform linux artifact_paths: - wheelhouse/**/* From 3a600621e0896bc1ce71612c66b1ac923ff38c0f Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 01:30:25 -0800 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20I=20know=20how=20to=20use=20tar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a65da8c..08c77b2 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,7 +8,7 @@ steps: command: | python -m pip install cibuildwheel curl -o /docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz - tar xzvf /docker.tgz docker/docker --strip-components 1 -C /usr/local/bin + tar --strip-components 1 -C /usr/local/bin -xzvf /docker.tgz docker/docker chmod +x /usr/local/bin/docker python -m cibuildwheel --platform linux artifact_paths: From 3281039118eebceb843d0386ec3f22902b9700db Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 01:40:14 -0800 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=8E=A8=20Have=20a=20PEP=20440=20com?= =?UTF-8?q?patible=20version.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fe7c43f..2c77646 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from distutils.sysconfig import get_config_var from distutils.version import LooseVersion -version = "1.3.2-geomagical1" +version = "1.3.2+geomagical.0" compiler_args = ["-g", '-DVERSION="%s"' % version] if sys.platform == "darwin": From 466e66ac19d268d1096d651e12790190b98b198c Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 02:21:29 -0800 Subject: [PATCH 07/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20The=20musl=20builds=20use=20lib=20instead=20of=20lib64.=20Wh?= =?UTF-8?q?y=3F=20Because=20fuck=20me=20that's=20why.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 2 +- setup.py | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 08c77b2..aa19ec2 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -3,7 +3,7 @@ steps: 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 + 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: | python -m pip install cibuildwheel diff --git a/setup.py b/setup.py index 2c77646..e855cbf 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,10 @@ version = "1.3.2+geomagical.0" 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: @@ -31,22 +35,22 @@ "OpenEXR", ["OpenEXR.cpp"], include_dirs=["openexr-install/include/OpenEXR"], - library_dirs=["openexr-install/lib64"], + library_dirs=[openexr_lib], libraries=["Iex", "Half", "Imath", "IlmImf", "z"], extra_compile_args=compiler_args, - extra_link_args=["-Wl,-rpath,openexr-install/lib64"], + extra_link_args=["-Wl,-rpath," + openexr_lib], ) ], py_modules=["Imath"], packages=[""], package_data={ "": [ - "openexr-install/lib64/libIex-2_5.so.25", - "openexr-install/lib64/libHalf-2_5.so.25", - "openexr-install/lib64/libImath-2_5.so.25", - "openexr-install/lib64/libIlmImf-2_5.so.25", - "openexr-install/lib64/libIexMath-2_5.so.25", - "openexr-install/lib64/libIlmThread-2_5.so.25", + openexr_lib + "/libIex-2_5.so.25", + openexr_lib + "/libHalf-2_5.so.25", + openexr_lib + "/libImath-2_5.so.25", + openexr_lib + "/libIlmImf-2_5.so.25", + openexr_lib + "/libIexMath-2_5.so.25", + openexr_lib + "/libIlmThread-2_5.so.25", ] }, ) From 4954e7f2c8ea6e13db4c5edd5a9d39f3673cc27a Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 02:50:17 -0800 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20Just=20put=20things=20in=20the=20normal=20place.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index aa19ec2..a16e9ca 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,8 +11,9 @@ steps: tar --strip-components 1 -C /usr/local/bin -xzvf /docker.tgz docker/docker chmod +x /usr/local/bin/docker python -m cibuildwheel --platform linux + mv wheelhouse/ dist/ artifact_paths: - - wheelhouse/**/* + - dist/**/* plugins: - coderanger/k8s#next: image: python:3.10 From c3ee328150e2c822fa4a9c23175ca737dbc202fd Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 03:19:13 -0800 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20Also=20build=20an=20sdist.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should never get used but until I figured out mac and windows builds, it might be. --- .buildkite/pipeline.yml | 6 +++++- .gitignore | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a16e9ca..cb8ce7d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -6,12 +6,16 @@ steps: 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/ dist/ + mv wheelhouse/*.whl dist/ artifact_paths: - dist/**/* plugins: diff --git a/.gitignore b/.gitignore index 4e086f1..096e7a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ out*.exr build/ wheelhouse/ +dist/ +MANIFEST From 987d63cea9303f910160a4d3ef7f14af01176557 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 03:40:07 -0800 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=8E=A8=20Bump=20the=20version=20for?= =?UTF-8?q?=20a=20clean=20upload.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e855cbf..e4e0ed2 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from distutils.sysconfig import get_config_var from distutils.version import LooseVersion -version = "1.3.2+geomagical.0" +version = "1.3.2+geomagical.1" compiler_args = ["-g", '-DVERSION="%s"' % version] openexr_lib = "openexr-install/lib64" From 9328164816e5a9d1a8f45a1791aac5879fdf8602 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Jan 2022 15:00:17 -0800 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=8E=A8=20Trying=20to=20fix=20some?= =?UTF-8?q?=20rpath=20issues.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index e4e0ed2..ec7f965 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,18 @@ from distutils.sysconfig import get_config_var from distutils.version import LooseVersion -version = "1.3.2+geomagical.1" +version = "1.3.2+geomagical.3" compiler_args = ["-g", '-DVERSION="%s"' % version] openexr_lib = "openexr-install/lib64" if not os.path.exists(openexr_lib): openexr_lib = "openexr-install/lib" +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]) @@ -38,19 +42,19 @@ library_dirs=[openexr_lib], libraries=["Iex", "Half", "Imath", "IlmImf", "z"], extra_compile_args=compiler_args, - extra_link_args=["-Wl,-rpath," + openexr_lib], + extra_link_args=link_args, ) ], py_modules=["Imath"], packages=[""], package_data={ "": [ - openexr_lib + "/libIex-2_5.so.25", - openexr_lib + "/libHalf-2_5.so.25", - openexr_lib + "/libImath-2_5.so.25", - openexr_lib + "/libIlmImf-2_5.so.25", - openexr_lib + "/libIexMath-2_5.so.25", - openexr_lib + "/libIlmThread-2_5.so.25", + 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}", ] }, )