Skip to content

Commit

Permalink
devel/py-dm-tree: New port: Library for working with nested data stru…
Browse files Browse the repository at this point in the history
…ctures
  • Loading branch information
yurivict committed Apr 7, 2024
1 parent 6a6bcdb commit 77b2278
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions devel/Makefile
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions 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>
3 changes: 3 additions & 0 deletions 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
71 changes: 71 additions & 0 deletions 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.
3 changes: 3 additions & 0 deletions 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.
13 changes: 13 additions & 0 deletions 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

0 comments on commit 77b2278

Please sign in to comment.