git: 5c23643be7e8 - main - textproc/py-grep-ast: new port - grep AST of source files

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Wed, 22 May 2024 13:57:29 UTC
The branch main has been updated by dch:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5c23643be7e87f18150e95fcd66dfc1891972309

commit 5c23643be7e87f18150e95fcd66dfc1891972309
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2024-05-22 13:57:17 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2024-05-22 13:57:17 +0000

    textproc/py-grep-ast: new port - grep AST of source files
---
 textproc/Makefile              |  1 +
 textproc/py-grep-ast/Makefile  | 33 +++++++++++++++++++++++++++++++++
 textproc/py-grep-ast/distinfo  |  3 +++
 textproc/py-grep-ast/pkg-descr | 12 ++++++++++++
 4 files changed, 49 insertions(+)

diff --git a/textproc/Makefile b/textproc/Makefile
index fc1d4d6774f7..505f3ddb7225 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -1376,6 +1376,7 @@
     SUBDIR += py-gensim
     SUBDIR += py-gi-docgen
     SUBDIR += py-grapheme
+    SUBDIR += py-grep-ast
     SUBDIR += py-griffe
     SUBDIR += py-guess-language
     SUBDIR += py-hashids
diff --git a/textproc/py-grep-ast/Makefile b/textproc/py-grep-ast/Makefile
new file mode 100644
index 000000000000..a78043b63882
--- /dev/null
+++ b/textproc/py-grep-ast/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	grep-ast
+DISTVERSION=	0.3.2
+CATEGORIES=	textproc python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+DISTNAME=	grep_ast-${PORTVERSION}
+
+MAINTAINER=	dch@FreeBSD.org
+COMMENT=	Pythonic grep through AST of source files
+WWW=		https://github.com/paul-gauthier/grep-ast
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pathspec>=0:devel/py-pathspec@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-languages>0:devel/py-tree-sitter-languages@${PY_FLAVOR}
+
+USES=		python shebangfix
+USE_PYTHON=	autoplist concurrent distutils
+
+NO_ARCH=	yes
+
+PORTDOCS=	README.md
+
+OPTIONS_DEFINE=	DOCS
+
+post-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_MAN} ${PORTDOCS:S|^|${WRKSRC}/|} \
+		${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/textproc/py-grep-ast/distinfo b/textproc/py-grep-ast/distinfo
new file mode 100644
index 000000000000..76296c149aa1
--- /dev/null
+++ b/textproc/py-grep-ast/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1716362443
+SHA256 (grep_ast-0.3.2.tar.gz) = d53bc7d25dfefafe77643fec189ab38e3cbd839d546c070a950ebedad82ee164
+SIZE (grep_ast-0.3.2.tar.gz) = 11143
diff --git a/textproc/py-grep-ast/pkg-descr b/textproc/py-grep-ast/pkg-descr
new file mode 100644
index 000000000000..96568918b5e2
--- /dev/null
+++ b/textproc/py-grep-ast/pkg-descr
@@ -0,0 +1,12 @@
+Grep source code files and see matching lines with useful context that
+show how they fit into the code. See the loops, functions, methods,
+classes, etc that contain all the matching lines. Get a sense of what's
+inside a matched class or function definition. You see relevant code from
+every layer of the abstract syntax tree, above and below the matches.
+
+By default, grep-AST recurses the current directory to search all source
+code files. It respects .gitignore, so it will usually "do the right
+thing" in most repos if you just do grep-ast <regex> without specifying
+any filenames.
+
+You can also invoke grep-ast as gast for convenience.