aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2025-10-03 06:43:45 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2025-10-03 09:27:32 +0000
commitb9f9e89cce1ca9886e8d9faeb7c5d15ee39b7ee4 (patch)
treec34ce55121ecce3fd4ea309feebb7045ff24fc3a
parent882dd1fe5508e1a115eaa9ad14d5eb5995f7f2e8 (diff)
devel/py-cgen: New port: C/C++ source generation from an AST
-rw-r--r--devel/Makefile1
-rw-r--r--devel/py-cgen/Makefile27
-rw-r--r--devel/py-cgen/distinfo3
-rw-r--r--devel/py-cgen/pkg-descr10
4 files changed, 41 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 154d5c7e7fa9..3594aabda146 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -4646,6 +4646,7 @@
SUBDIR += py-cfgv
SUBDIR += py-cfn-lint
SUBDIR += py-cftime
+ SUBDIR += py-cgen
SUBDIR += py-chai
SUBDIR += py-chainmap
SUBDIR += py-characteristic
diff --git a/devel/py-cgen/Makefile b/devel/py-cgen/Makefile
new file mode 100644
index 000000000000..9c194c2749a5
--- /dev/null
+++ b/devel/py-cgen/Makefile
@@ -0,0 +1,27 @@
+PORTNAME= cgen
+DISTVERSION= 2025.1
+CATEGORIES= devel python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= C/C++ source generation from an AST
+WWW= https://github.com/inducer/cgen
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}numpy>=1.6,1:math/py-numpy@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pytools>=2022.1.14:devel/py-pytools@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.5:devel/py-typing-extensions@${PY_FLAVOR}
+TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}ruff>0:devel/py-ruff@${PY_FLAVOR}
+
+USES= python
+USE_PYTHON= pep517 autoplist concurrent pytest
+
+NO_ARCH= yes
+
+# tests as of 2025.1: 1 passed in 2.02s
+
+.include <bsd.port.mk>
diff --git a/devel/py-cgen/distinfo b/devel/py-cgen/distinfo
new file mode 100644
index 000000000000..1150810e9a33
--- /dev/null
+++ b/devel/py-cgen/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1734976997
+SHA256 (cgen-2025.1.tar.gz) = 79f01e010d49c13e58b4ca8f2d4996a6b7178968f5f2d906262733480ae7a2d4
+SIZE (cgen-2025.1.tar.gz) = 19236
diff --git a/devel/py-cgen/pkg-descr b/devel/py-cgen/pkg-descr
new file mode 100644
index 000000000000..ea1150c484a5
--- /dev/null
+++ b/devel/py-cgen/pkg-descr
@@ -0,0 +1,10 @@
+cgen offers a simple abstract syntax tree for C and related languages
+(C++/CUDA/OpenCL) to allow structured code generation from Python.
+
+cgen can be used to generate C code programmatically, which is useful for:
+- Code generators
+- Domain-specific language compilers
+- High-performance computing applications
+- GPU kernel generation (CUDA/OpenCL)
+
+To represent mathematical expressions, cgen can be used with pymbolic.