diff --git a/misc/py-onnx/Makefile b/misc/py-onnx/Makefile index 09c41dcc6110..f39307b4743f 100644 --- a/misc/py-onnx/Makefile +++ b/misc/py-onnx/Makefile @@ -1,37 +1,43 @@ PORTNAME= onnx -DISTVERSION= 1.14.1 -PORTREVISION= 1 +DISTVERSION= 1.16.0 CATEGORIES= misc # machine-learning MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Open Neural Network eXchange WWW= https://onnx.ai/ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= bash:shells/bash \ cmake:devel/cmake-core \ protoc-gen-mypy:devel/py-mypy-protobuf@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pybind11>0:devel/py-pybind11@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} -LIB_DEPENDS= libprotobuf.so:devel/protobuf + ${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} \ + ${PY_SETUPTOOLS} \ + ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} +LIB_DEPENDS= libabsl_base.so:devel/abseil \ + libprotobuf.so:devel/protobuf RUN_DEPENDS= ${PYNUMPY} \ ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>=3.6.2.1:devel/py-typing-extensions@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}parameterized>0:devel/py-parameterized@${PY_FLAVOR} USES= compiler:c++17-lang python shebangfix -USE_PYTHON= distutils concurrent autoplist +USE_PYTHON= pep517 concurrent autoplist pytest CXXFLAGS+= -Dstat64=stat SHEBANG_FILES= tools/protoc-gen-mypy.sh.in +TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +TEST_WRKSRC= ${WRKSRC}/onnx/test + BINARY_ALIAS= python=${PYTHON_CMD} post-install: @${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/onnx/onnx_cpp2py_export*.so .include diff --git a/misc/py-onnx/distinfo b/misc/py-onnx/distinfo index 32b8f3c1aa76..1e6ebb954add 100644 --- a/misc/py-onnx/distinfo +++ b/misc/py-onnx/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1693031876 -SHA256 (onnx-1.14.1.tar.gz) = 70903afe163643bd71195c78cedcc3f4fa05a2af651fd950ef3acbb15175b2d1 -SIZE (onnx-1.14.1.tar.gz) = 11328774 +TIMESTAMP = 1713580433 +SHA256 (onnx-1.16.0.tar.gz) = 237c6987c6c59d9f44b6136f5819af79574f8d96a760a1fa843bede11f3822f7 +SIZE (onnx-1.16.0.tar.gz) = 12303017 diff --git a/misc/py-onnx/files/patch-CMakeLists.txt b/misc/py-onnx/files/patch-CMakeLists.txt index 07e389904c09..c658385d91e3 100644 --- a/misc/py-onnx/files/patch-CMakeLists.txt +++ b/misc/py-onnx/files/patch-CMakeLists.txt @@ -1,20 +1,11 @@ ---- CMakeLists.txt.orig 2023-08-08 18:33:06 UTC +--- CMakeLists.txt.orig 2024-03-05 00:46:58 UTC +++ CMakeLists.txt -@@ -18,7 +18,7 @@ project(onnx C CXX) +@@ -19,7 +19,7 @@ option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using option(ONNX_BUILD_BENCHMARKS "Build ONNX micro-benchmarks" OFF) option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using protobuf shared library. Sets PROTOBUF_USE_DLLS CMAKE Flag and Protobuf_USE_STATIC_LIBS. " OFF) -option(BUILD_ONNX_PYTHON "Build Python binaries" OFF) +option(BUILD_ONNX_PYTHON "Build Python binaries" ON) option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON) option(ONNX_WERROR "Build with Werror" OFF) option(ONNX_COVERAGE "Build with coverage instrumentation" OFF) -@@ -58,7 +58,7 @@ endif() - # Required to use /std:c++17 or higher on Windows - # For other platforms, set C++11 as standard for the whole project - if(NOT MSVC) -- set(CMAKE_CXX_STANDARD 11) -+ set(CMAKE_CXX_STANDARD 17) - else() - string(APPEND CMAKE_CXX_FLAGS " /std:c++17") - endif() diff --git a/misc/py-onnx/files/patch-pyproject.toml b/misc/py-onnx/files/patch-pyproject.toml new file mode 100644 index 000000000000..03d073137dca --- /dev/null +++ b/misc/py-onnx/files/patch-pyproject.toml @@ -0,0 +1,11 @@ +--- pyproject.toml.orig 2024-03-05 06:23:47 UTC ++++ pyproject.toml +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: Apache-2.0 + + [build-system] +-requires = ["setuptools>=64", "protobuf>=3.20.2", "cmake"] ++requires = ["setuptools", "protobuf>=3.20.2"] + build-backend = "setuptools.build_meta" + + [project] diff --git a/misc/py-onnx/files/patch-setup.py b/misc/py-onnx/files/patch-setup.py index 550ecb070c95..0c28f53ef277 100644 --- a/misc/py-onnx/files/patch-setup.py +++ b/misc/py-onnx/files/patch-setup.py @@ -1,20 +1,44 @@ ---- setup.py.orig 2023-04-12 23:29:42 UTC +--- setup.py.orig 2024-03-25 14:15:57 UTC +++ setup.py -@@ -59,11 +59,12 @@ COVERAGE = bool(os.getenv("COVERAGE", "0") == "1") +@@ -65,11 +65,12 @@ try: ################################################################################ try: -- git_version = ( +- _git_version = ( - subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=TOP_DIR) - .decode("ascii") - .strip() - ) -+ #git_version = ( ++ #_git_version = ( + # subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=TOP_DIR) + # .decode("ascii") + # .strip() + #) -+ git_version = None ++ _git_version = "" except (OSError, subprocess.CalledProcessError): - git_version = None + _git_version = "" +@@ -227,10 +228,7 @@ class BuildPy(setuptools.command.build_py.build_py): + + class BuildPy(setuptools.command.build_py.build_py): + def run(self): +- if self.editable_mode: +- dst_dir = TOP_DIR +- else: +- dst_dir = self.build_lib ++ dst_dir = self.build_lib + create_version(dst_dir) + return super().run() + +@@ -273,10 +271,7 @@ class BuildExt(setuptools.command.build_ext.build_ext) + self.copy_file(src, dst) + + # Copy over the generated python files to build/source dir depending on editable mode +- if self.editable_mode: +- dst_dir = TOP_DIR +- else: +- dst_dir = build_lib ++ dst_dir = build_lib + + generated_py_files = glob.glob(os.path.join(CMAKE_BUILD_DIR, "onnx", "*.py")) + generated_pyi_files = glob.glob(os.path.join(CMAKE_BUILD_DIR, "onnx", "*.pyi"))