From owner-dev-commits-ports-all@freebsd.org Sat Jun 26 06:32:58 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B7E364C942; Sat, 26 Jun 2021 06:32:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBkZf3Pdtz3hCW; Sat, 26 Jun 2021 06:32:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D7C519FD9; Sat, 26 Jun 2021 06:32:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15Q6WwNt041472; Sat, 26 Jun 2021 06:32:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15Q6WwvL041471; Sat, 26 Jun 2021 06:32:58 GMT (envelope-from git) Date: Sat, 26 Jun 2021 06:32:58 GMT Message-Id: <202106260632.15Q6WwvL041471@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Kevin Bowling Subject: git: f09116668740 - main - devel/py-jsonnet: Python bindings for Jsonnet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f091166687409804b91a1a041fb715d24f25c028 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2021 06:32:58 -0000 The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/ports/commit/?id=f091166687409804b91a1a041fb715d24f25c028 commit f091166687409804b91a1a041fb715d24f25c028 Author: Pavel Timofeev AuthorDate: 2021-06-26 06:22:32 +0000 Commit: Kevin Bowling CommitDate: 2021-06-26 06:32:53 +0000 devel/py-jsonnet: Python bindings for Jsonnet Jsonnet lets you compute fragments of JSON within the structure, bringing the same benefit to structured data that templating languages bring to plain text. WWW: https://github.com/google/jsonnet PR: 256705 Reviewed by: koobs Approved by: new maintainer --- devel/Makefile | 1 + devel/py-jsonnet/Makefile | 31 +++++++++++++ devel/py-jsonnet/distinfo | 3 ++ .../patch-case__studies_kubernetes_test__same.py | 35 +++++++++++++++ devel/py-jsonnet/files/patch-setup.py | 52 ++++++++++++++++++++++ devel/py-jsonnet/pkg-descr | 6 +++ 6 files changed, 128 insertions(+) diff --git a/devel/Makefile b/devel/Makefile index 50de76449f46..88b20d931a18 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -4580,6 +4580,7 @@ SUBDIR += py-jsondiff SUBDIR += py-jsonform SUBDIR += py-jsonlines + SUBDIR += py-jsonnet SUBDIR += py-jsonpatch SUBDIR += py-jsonpath-rw SUBDIR += py-jsonpickle diff --git a/devel/py-jsonnet/Makefile b/devel/py-jsonnet/Makefile new file mode 100644 index 000000000000..ec2e80a7380a --- /dev/null +++ b/devel/py-jsonnet/Makefile @@ -0,0 +1,31 @@ +PORTNAME= jsonnet +DISTVERSIONPREFIX= v +DISTVERSION= 0.17.0 +CATEGORIES= devel python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= timp87@FreeBSD.org +COMMENT= Python bindings for Jsonnet - The data templating language + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libjsonnet.so:devel/jsonnet + +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR} + +USES= compiler:c++11-lang python:3.6+ localbase + +USE_GITHUB= yes +GH_ACCOUNT= google + +USE_PYTHON= distutils autoplist + +post-install: + ${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/_jsonnet${PYTHON_EXT_SUFFIX}.so + +do-test: + @cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs + +.include diff --git a/devel/py-jsonnet/distinfo b/devel/py-jsonnet/distinfo new file mode 100644 index 000000000000..7c119ac87f8a --- /dev/null +++ b/devel/py-jsonnet/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1624332274 +SHA256 (google-jsonnet-v0.17.0_GH0.tar.gz) = 076b52edf888c01097010ad4299e3b2e7a72b60a41abbc65af364af1ed3c8dbe +SIZE (google-jsonnet-v0.17.0_GH0.tar.gz) = 21854054 diff --git a/devel/py-jsonnet/files/patch-case__studies_kubernetes_test__same.py b/devel/py-jsonnet/files/patch-case__studies_kubernetes_test__same.py new file mode 100644 index 000000000000..0365b2ee1740 --- /dev/null +++ b/devel/py-jsonnet/files/patch-case__studies_kubernetes_test__same.py @@ -0,0 +1,35 @@ +--- case_studies/kubernetes/test_same.py.orig 2020-11-22 14:19:41 UTC ++++ case_studies/kubernetes/test_same.py +@@ -15,7 +15,11 @@ + import yaml + import json + import sys ++import os + ++os.chdir(os.path.dirname(os.path.abspath(__file__))) ++os.system("jsonnet -m ./ example.jsonnet") ++ + files = [ + 'bigquery-controller', + 'redis-master', +@@ -50,10 +54,10 @@ def canonicalize(doc): + + for filename in files: + with open(filename + '.old.yaml', 'r') as f: +- yaml_doc = canonicalize(yaml.load(f)) ++ yaml_doc = canonicalize(yaml.load(f, Loader=yaml.SafeLoader)) + + with open(filename + '.new.yaml', 'r') as f: +- jsonnet_doc = yaml.load(f) ++ jsonnet_doc = yaml.load(f, Loader=yaml.SafeLoader) + + if jsonstr(yaml_doc) == jsonstr(jsonnet_doc): + print('Identical: %s' % filename) +@@ -65,6 +69,6 @@ for filename in files: + with open(filename + '.new.yaml.out', 'w') as f: + f.write(jsonstr(jsonnet_doc)) + +- ++ os.remove(filename + '.new.yaml') + + diff --git a/devel/py-jsonnet/files/patch-setup.py b/devel/py-jsonnet/files/patch-setup.py new file mode 100644 index 000000000000..41665ee85474 --- /dev/null +++ b/devel/py-jsonnet/files/patch-setup.py @@ -0,0 +1,52 @@ +--- setup.py.orig 2020-11-22 14:19:41 UTC ++++ setup.py +@@ -19,18 +19,6 @@ from setuptools.command.build_ext import build_ext as + from subprocess import Popen + + DIR = os.path.abspath(os.path.dirname(__file__)) +-LIB_OBJECTS = [ +- 'core/desugarer.o', +- 'core/formatter.o', +- 'core/libjsonnet.o', +- 'core/lexer.o', +- 'core/parser.o', +- 'core/pass.o', +- 'core/static_analysis.o', +- 'core/string_utils.o', +- 'core/vm.o', +- 'third_party/md5/md5.o' +-] + + MODULE_SOURCES = ['python/_jsonnet.c'] + +@@ -46,19 +34,10 @@ def get_version(): + v_code = v_code[1:] + return v_code + +-class BuildJsonnetExt(BuildExt): +- def run(self): +- p = Popen(['make'] + LIB_OBJECTS, cwd=DIR) +- p.wait() +- if p.returncode != 0: +- raise Exception('Could not build %s' % (', '.join(LIB_OBJECTS))) +- BuildExt.run(self) +- + jsonnet_ext = Extension( + '_jsonnet', + sources=MODULE_SOURCES, +- extra_objects=LIB_OBJECTS, +- include_dirs = ['include', 'third_party/md5', 'third_party/json'], ++ libraries = ['jsonnet'], + language='c++' + ) + +@@ -68,9 +47,6 @@ setup(name='jsonnet', + author='David Cunningham', + author_email='dcunnin@google.com', + version=get_version(), +- cmdclass={ +- 'build_ext': BuildJsonnetExt, +- }, + ext_modules=[jsonnet_ext], + test_suite="python._jsonnet_test", + ) diff --git a/devel/py-jsonnet/pkg-descr b/devel/py-jsonnet/pkg-descr new file mode 100644 index 000000000000..30a6d0c6c195 --- /dev/null +++ b/devel/py-jsonnet/pkg-descr @@ -0,0 +1,6 @@ +Python bindings for Jsonnet - The data templating language. +Jsonnet lets you compute fragments of JSON within the structure, bringing +the same benefit to structured data that templating languages bring to plain +text. + +WWW: https://github.com/google/jsonnet