git: 77b227822e08 - main - devel/py-dm-tree: New port: Library for working with nested data structures

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 07 Apr 2024 18:38:14 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=77b227822e08da9adb6504f0ff2ed83ae21b2df0

commit 77b227822e08da9adb6504f0ff2ed83ae21b2df0
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-04-07 05:46:00 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-04-07 18:37:58 +0000

    devel/py-dm-tree: New port: Library for working with nested data structures
---
 devel/Makefile                                   |  1 +
 devel/py-dm-tree/Makefile                        | 23 ++++++++
 devel/py-dm-tree/distinfo                        |  3 +
 devel/py-dm-tree/files/patch-tree_CMakeLists.txt | 71 ++++++++++++++++++++++++
 devel/py-dm-tree/pkg-descr                       |  3 +
 devel/py-dm-tree/pkg-plist                       | 13 +++++
 6 files changed, 114 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 23fce0037399..c6ca8af6c5b9 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -4642,6 +4642,7 @@
     SUBDIR += py-dj42-django-rq
     SUBDIR += py-dj42-graphene-django
     SUBDIR += py-django-rq
+    SUBDIR += py-dm-tree
     SUBDIR += py-docformatter
     SUBDIR += py-dockerpty
     SUBDIR += py-docopt
diff --git a/devel/py-dm-tree/Makefile b/devel/py-dm-tree/Makefile
new file mode 100644
index 000000000000..137635994a01
--- /dev/null
+++ b/devel/py-dm-tree/Makefile
@@ -0,0 +1,23 @@
+PORTNAME=	dm-tree
+DISTVERSION=	0.1.8
+CATEGORIES=	devel
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Library for working with nested data structures
+WWW=		https://tree.readthedocs.io/en/latest/
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	cmake:devel/cmake-core \
+		pybind11>0:devel/pybind11
+LIB_DEPENDS=	libabsl_strings.so:devel/abseil
+
+USES=		localbase python
+USE_PYTHON=	distutils concurrent
+
+MAKE_ENV=	FREEBSD_LOCALBASE=${LOCALBASE}
+
+.include <bsd.port.mk>
diff --git a/devel/py-dm-tree/distinfo b/devel/py-dm-tree/distinfo
new file mode 100644
index 000000000000..9e63509bbe76
--- /dev/null
+++ b/devel/py-dm-tree/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1712465713
+SHA256 (dm-tree-0.1.8.tar.gz) = 0fcaabbb14e7980377439e7140bd05552739ca5e515ecb3119f234acee4b9430
+SIZE (dm-tree-0.1.8.tar.gz) = 35384
diff --git a/devel/py-dm-tree/files/patch-tree_CMakeLists.txt b/devel/py-dm-tree/files/patch-tree_CMakeLists.txt
new file mode 100644
index 000000000000..ae4dc5952ab4
--- /dev/null
+++ b/devel/py-dm-tree/files/patch-tree_CMakeLists.txt
@@ -0,0 +1,71 @@
+--- tree/CMakeLists.txt.orig	2022-12-18 09:35:42 UTC
++++ tree/CMakeLists.txt
+@@ -52,17 +52,18 @@ set(PYBIND_VER v2.10.1)
+ 
+ # Fetch pybind to be able to use pybind11_add_module symbol.
+ set(PYBIND_VER v2.10.1)
+-include(FetchContent)
+-FetchContent_Declare(
+-  pybind11
+-  GIT_REPOSITORY https://github.com/pybind/pybind11
+-  GIT_TAG        ${PYBIND_VER}
+-)
+-if(NOT pybind11_POPULATED)
+-    FetchContent_Populate(pybind11)
+-    add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
+-    include_directories(${pybind11_INCLUDE_DIR})
+-endif()
++#include(FetchContent)
++#FetchContent_Declare(
++#  pybind11
++#  GIT_REPOSITORY https://github.com/pybind/pybind11
++#  GIT_TAG        ${PYBIND_VER}
++#)
++#if(NOT pybind11_POPULATED)
++#    FetchContent_Populate(pybind11)
++#    add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
++#    include_directories(${pybind11_INCLUDE_DIR})
++#endif()
++find_package(pybind11)
+ 
+ # Needed to disable Abseil tests.
+ set (BUILD_TESTING OFF)
+@@ -83,27 +84,28 @@ endif()
+         ${ABSEIL_CMAKE_ARGS}
+         "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
+ endif()
+-ExternalProject_Add(abseil-cpp
+-  GIT_REPOSITORY    https://github.com/abseil/abseil-cpp.git
+-  GIT_TAG           ${ABSEIL_VER}
+-  PREFIX            ${CMAKE_SOURCE_DIR}/abseil-cpp
+-  CMAKE_ARGS        ${ABSEIL_CMAKE_ARGS}
+-)
+-ExternalProject_Get_Property(abseil-cpp install_dir)
+-set(abseil_install_dir ${install_dir})
++#ExternalProject_Add(abseil-cpp
++#  GIT_REPOSITORY    https://github.com/abseil/abseil-cpp.git
++#  GIT_TAG           ${ABSEIL_VER}
++#  PREFIX            ${CMAKE_SOURCE_DIR}/abseil-cpp
++#  CMAKE_ARGS        ${ABSEIL_CMAKE_ARGS}
++#)
++#ExternalProject_Get_Property(abseil-cpp install_dir)
++find_package(absl REQUIRED)
++set(abseil_install_dir $ENV{FREEBSD_LOCALBASE})
+ include_directories (${abseil_install_dir}/include)
+ 
+ 
+ # Define pybind11 tree module.
+ pybind11_add_module(_tree tree.h tree.cc)
+-add_dependencies(_tree abseil-cpp)
++add_dependencies(_tree absl::strings absl::config)
+ 
+ if (WIN32 OR MSVC)
+     set(ABSEIL_LIB_PREF "absl")
+     set(LIB_SUFF "lib")
+ else()
+     set(ABSEIL_LIB_PREF "libabsl")
+-    set(LIB_SUFF "a")
++    set(LIB_SUFF "so")
+ endif()
+ 
+ # Link abseil static libs.
diff --git a/devel/py-dm-tree/pkg-descr b/devel/py-dm-tree/pkg-descr
new file mode 100644
index 000000000000..f40931a013f0
--- /dev/null
+++ b/devel/py-dm-tree/pkg-descr
@@ -0,0 +1,3 @@
+tree is a library for working with nested data structures. In a way, tree
+generalizes the builtin map function which only supports flat sequences, and
+allows to apply a function to each "leaf" preserving the overall structure.
diff --git a/devel/py-dm-tree/pkg-plist b/devel/py-dm-tree/pkg-plist
new file mode 100644
index 000000000000..1ed1e87e2530
--- /dev/null
+++ b/devel/py-dm-tree/pkg-plist
@@ -0,0 +1,13 @@
+%%PYTHON_SITELIBDIR%%/tree/__init__.py
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/sequence%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/sequence%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/tree_benchmark%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/tree_benchmark%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/tree_test%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/tree/__pycache__/tree_test%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/tree/_tree%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON_SITELIBDIR%%/tree/sequence.py
+%%PYTHON_SITELIBDIR%%/tree/tree_benchmark.py
+%%PYTHON_SITELIBDIR%%/tree/tree_test.py