git: e6eed9e9dfac - main - math/py-dgl: New port: Deep Graph Library
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 May 2023 04:21:06 UTC
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=e6eed9e9dfac32f38fe14a050c10a3b650ec9db9 commit e6eed9e9dfac32f38fe14a050c10a3b650ec9db9 Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2023-05-10 04:20:04 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2023-05-10 04:21:01 +0000 math/py-dgl: New port: Deep Graph Library --- math/Makefile | 1 + math/py-dgl/Makefile | 75 ++++++++++++++++++++++ math/py-dgl/distinfo | 3 + math/py-dgl/files/patch-dgl___ffi_base.py | 11 ++++ math/py-dgl/files/patch-dgl_sparse_____init____.py | 11 ++++ math/py-dgl/files/patch-setup.py | 20 ++++++ math/py-dgl/pkg-descr | 2 + 7 files changed, 123 insertions(+) diff --git a/math/Makefile b/math/Makefile index 89cacac3a106..8a575f445e3a 100644 --- a/math/Makefile +++ b/math/Makefile @@ -905,6 +905,7 @@ SUBDIR += py-cyipopt SUBDIR += py-cypari2 SUBDIR += py-deap + SUBDIR += py-dgl SUBDIR += py-dionysus SUBDIR += py-disjoint-set SUBDIR += py-docplex diff --git a/math/py-dgl/Makefile b/math/py-dgl/Makefile new file mode 100644 index 000000000000..29ca98e069fe --- /dev/null +++ b/math/py-dgl/Makefile @@ -0,0 +1,75 @@ +PORTNAME= dgl +DISTVERSION= 1.1.0 +CATEGORIES= math python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Deep Graph Library +WWW= https://www.dgl.ai/ + +LICENSE= BSD3CLAUSE + +BUILD_DEPENDS= ${PY_SETUPTOOLS} \ + ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} \ + ${BACKEND_DEPENDS} +LIB_DEPENDS= libdgl.so:math/dgl +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}networkx>=2.2:math/py-networkx@${PY_FLAVOR} \ + ${PYNUMPY} \ + ${PYTHON_PKGNAMEPREFIX}psutil>=5.8.0:sysutils/py-psutil@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}requests>=2.19.0:www/py-requests@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}scipy>=1.1.0:science/py-scipy@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR} \ + ${BACKEND_DEPENDS} + +USES= python:3.7+ localbase +USE_PYTHON= distutils cython autoplist + +WRKSRC_SUBDIR= python + +USE_GITHUB= yes +GH_ACCOUNT= dmlc + +MAKE_ENV= DGL_LIBRARY_PATH=${LOCALBASE}/lib + +POST_PLIST= rm-tests-from-plist + +OPTIONS_RADIO= BACKEND +OPTIONS_RADIO_BACKEND= PYTORCH TENSORFLOW MXNET +OPTIONS_DEFAULT= PYTORCH + +PYTORCH_DESC= Use PyTorch backend +PYTORCH_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}pytorch>0:misc/py-pytorch@${PY_FLAVOR} +PYTORCH_MAKE_ENV= DGLBACKEND=pytorch + +TENSORFLOW_DESC= Use TensorFlow backend +TENSORFLOW_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}tensorflow>0:science/py-tensorflow@${PY_FLAVOR} +TENSORFLOW_MAKE_ENV= DGLBACKEND=tensorflow + +MXNET_DESC= Use MXNET backend +MXNET_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}mxnet>0:misc/py-mxnet@${PY_FLAVOR} +MXNET_MAKE_ENV= DGLBACKEND=mxnet + +post-install: + # workaround for https://github.com/dmlc/dgl/issues/5665 + @${RM} ${STAGEDIR}${PREFIX}/dgl/libdgl.so + # remove empty dirs + @${RMDIR} \ + ${STAGEDIR}${PREFIX}/dgl/tensoradapter/pytorch \ + ${STAGEDIR}${PREFIX}/dgl/tensoradapter \ + ${STAGEDIR}${PREFIX}/dgl/dgl_sparse \ + ${STAGEDIR}${PREFIX}/dgl + # strip binaries + @${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/dgl/_ffi/_cy3/core${PYTHON_EXT_SUFFIX}.so + +rm-tests-from-plist: + # workaround for https://github.com/dmlc/dgl/issues/5665 + @${REINPLACE_CMD} ' \ + /dgl\/libdgl.so/d ; \ + ' ${TMPPLIST} + # remove empty dirs + @${REINPLACE_CMD} ' \ + /dgl\/tensoradapter\/pytorch/d ; \ + /dgl\/dgl_sparse/d ; \ + ' ${TMPPLIST} + +.include <bsd.port.mk> diff --git a/math/py-dgl/distinfo b/math/py-dgl/distinfo new file mode 100644 index 000000000000..df6d90d4640c --- /dev/null +++ b/math/py-dgl/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1683572138 +SHA256 (dmlc-dgl-1.1.0_GH0.tar.gz) = 71c8ba7777ffdca37638bc796524d42c51006fad385967fa140235b60aac0252 +SIZE (dmlc-dgl-1.1.0_GH0.tar.gz) = 5536874 diff --git a/math/py-dgl/files/patch-dgl___ffi_base.py b/math/py-dgl/files/patch-dgl___ffi_base.py new file mode 100644 index 000000000000..c602b49f29dc --- /dev/null +++ b/math/py-dgl/files/patch-dgl___ffi_base.py @@ -0,0 +1,11 @@ +--- dgl/_ffi/base.py.orig 2023-05-09 03:27:48 UTC ++++ dgl/_ffi/base.py +@@ -137,6 +137,8 @@ def load_tensor_adapter(backend, version): + version = version.split("+")[0] + if sys.platform.startswith("linux"): + basename = "libtensoradapter_%s_%s.so" % (backend, version) ++ elif sys.platform.startswith("freebsd"): ++ basename = "libtensoradapter_%s_%s.so" % (backend, version) + elif sys.platform.startswith("darwin"): + basename = "libtensoradapter_%s_%s.dylib" % (backend, version) + elif sys.platform.startswith("win"): diff --git a/math/py-dgl/files/patch-dgl_sparse_____init____.py b/math/py-dgl/files/patch-dgl_sparse_____init____.py new file mode 100644 index 000000000000..e4ef984e8187 --- /dev/null +++ b/math/py-dgl/files/patch-dgl_sparse_____init____.py @@ -0,0 +1,11 @@ +--- dgl/sparse/__init__.py.orig 2023-05-09 03:28:28 UTC ++++ dgl/sparse/__init__.py +@@ -22,6 +22,8 @@ def load_dgl_sparse(): + + if sys.platform.startswith("linux"): + basename = f"libdgl_sparse_pytorch_{version}.so" ++ elif sys.platform.startswith("freebsd"): ++ basename = f"libdgl_sparse_pytorch_{version}.so" + elif sys.platform.startswith("darwin"): + basename = f"libdgl_sparse_pytorch_{version}.dylib" + elif sys.platform.startswith("win"): diff --git a/math/py-dgl/files/patch-setup.py b/math/py-dgl/files/patch-setup.py new file mode 100644 index 000000000000..91c3c627d541 --- /dev/null +++ b/math/py-dgl/files/patch-setup.py @@ -0,0 +1,20 @@ +--- setup.py.orig 2023-05-08 19:54:39 UTC ++++ setup.py +@@ -49,6 +49,8 @@ def get_lib_path(): + def get_ta_lib_pattern(): + if sys.platform.startswith("linux"): + ta_lib_pattern = "libtensoradapter_*.so" ++ elif sys.platform.startswith("freebsd"): ++ ta_lib_pattern = "libtensoradapter_*.so" + elif sys.platform.startswith("darwin"): + ta_lib_pattern = "libtensoradapter_*.dylib" + elif sys.platform.startswith("win"): +@@ -60,6 +62,8 @@ def get_ta_lib_pattern(): + + def get_dgl_sparse_pattern(): + if sys.platform.startswith("linux"): ++ dgl_sparse_lib_pattern = "libdgl_sparse_*.so" ++ elif sys.platform.startswith("freebsd"): + dgl_sparse_lib_pattern = "libdgl_sparse_*.so" + elif sys.platform.startswith("darwin"): + dgl_sparse_lib_pattern = "libdgl_sparse_*.dylib" diff --git a/math/py-dgl/pkg-descr b/math/py-dgl/pkg-descr new file mode 100644 index 000000000000..459fb5664e85 --- /dev/null +++ b/math/py-dgl/pkg-descr @@ -0,0 +1,2 @@ +DGL is a Python package built to ease deep learning on graphs +on top of existing DL frameworks.