View | Details | Raw Unified | Return to bug 256705 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/py-jsonnet/Makefile (+31 lines)
Added Link Here
1
PORTNAME=	jsonnet
2
DISTVERSIONPREFIX=	v
3
DISTVERSION=	0.17.0
4
CATEGORIES=	devel python
5
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
6
7
MAINTAINER=	timp87@FreeBSD.org
8
COMMENT=	Python bindings for Jsonnet - The data templating language
9
10
LICENSE=	APACHE20
11
LICENSE_FILE=	${WRKSRC}/LICENSE
12
13
LIB_DEPENDS=	libjsonnet.so:devel/jsonnet
14
15
TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
16
		${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR}
17
18
USES=		compiler:c++11-lang python:3.6+ localbase
19
20
USE_GITHUB=	yes
21
GH_ACCOUNT=	google
22
23
USE_PYTHON=	distutils autoplist
24
25
post-install:
26
	${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/_jsonnet.cpython-${PYTHON_SUFFIX}.so
27
28
do-test:
29
	@cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs
30
31
.include	<bsd.port.mk>
(-)b/devel/py-jsonnet/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1624332274
2
SHA256 (google-jsonnet-v0.17.0_GH0.tar.gz) = 076b52edf888c01097010ad4299e3b2e7a72b60a41abbc65af364af1ed3c8dbe
3
SIZE (google-jsonnet-v0.17.0_GH0.tar.gz) = 21854054
(-)b/devel/py-jsonnet/files/patch-case__studies_kubernetes_test__same.py (+35 lines)
Added Link Here
1
--- case_studies/kubernetes/test_same.py.orig	2020-11-22 14:19:41 UTC
2
+++ case_studies/kubernetes/test_same.py
3
@@ -15,7 +15,11 @@
4
 import yaml
5
 import json
6
 import sys
7
+import os
8
 
9
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
10
+os.system("jsonnet -m ./ example.jsonnet")
11
+
12
 files = [
13
     'bigquery-controller',
14
     'redis-master',
15
@@ -50,10 +54,10 @@ def canonicalize(doc):
16
 
17
 for filename in files:
18
     with open(filename + '.old.yaml', 'r') as f:
19
-        yaml_doc = canonicalize(yaml.load(f))
20
+        yaml_doc = canonicalize(yaml.load(f, Loader=yaml.SafeLoader))
21
 
22
     with open(filename + '.new.yaml', 'r') as f:
23
-        jsonnet_doc = yaml.load(f)
24
+        jsonnet_doc = yaml.load(f, Loader=yaml.SafeLoader)
25
 
26
     if jsonstr(yaml_doc) == jsonstr(jsonnet_doc):
27
         print('Identical: %s' % filename)
28
@@ -65,6 +69,6 @@ for filename in files:
29
         with open(filename + '.new.yaml.out', 'w') as f:
30
             f.write(jsonstr(jsonnet_doc))
31
 
32
-        
33
+    os.remove(filename + '.new.yaml')
34
 
35
 
(-)b/devel/py-jsonnet/files/patch-setup.py (+52 lines)
Added Link Here
1
--- setup.py.orig	2020-11-22 14:19:41 UTC
2
+++ setup.py
3
@@ -19,18 +19,6 @@ from setuptools.command.build_ext import build_ext as 
4
 from subprocess import Popen
5
 
6
 DIR = os.path.abspath(os.path.dirname(__file__))
7
-LIB_OBJECTS = [
8
-    'core/desugarer.o',
9
-    'core/formatter.o',
10
-    'core/libjsonnet.o',
11
-    'core/lexer.o',
12
-    'core/parser.o',
13
-    'core/pass.o',
14
-    'core/static_analysis.o',
15
-    'core/string_utils.o',
16
-    'core/vm.o',
17
-    'third_party/md5/md5.o'
18
-]
19
 
20
 MODULE_SOURCES = ['python/_jsonnet.c']
21
 
22
@@ -46,19 +34,10 @@ def get_version():
23
                     v_code = v_code[1:]
24
                 return v_code
25
 
26
-class BuildJsonnetExt(BuildExt):
27
-    def run(self):
28
-        p = Popen(['make'] + LIB_OBJECTS, cwd=DIR)
29
-        p.wait()
30
-        if p.returncode != 0:
31
-            raise Exception('Could not build %s' % (', '.join(LIB_OBJECTS)))
32
-        BuildExt.run(self)
33
-
34
 jsonnet_ext = Extension(
35
     '_jsonnet',
36
     sources=MODULE_SOURCES,
37
-    extra_objects=LIB_OBJECTS,
38
-    include_dirs = ['include', 'third_party/md5', 'third_party/json'],
39
+    libraries = ['jsonnet'],
40
     language='c++'
41
 )
42
 
43
@@ -68,9 +47,6 @@ setup(name='jsonnet',
44
       author='David Cunningham',
45
       author_email='dcunnin@google.com',
46
       version=get_version(),
47
-      cmdclass={
48
-          'build_ext': BuildJsonnetExt,
49
-      },
50
       ext_modules=[jsonnet_ext],
51
       test_suite="python._jsonnet_test",
52
 )
(-)b/devel/py-jsonnet/pkg-descr (+7 lines)
Added Link Here
1
Python bindings for Jsonnet - The data templating language.
2
Jsonnet lets you compute fragments of JSON within the structure, bringing
3
the same benefit to structured data that templating languages bring to plain
4
text. The example below illustrates a few features -- referring to another part
5
of the structure, overriding object fields, and string operations.
6
7
WWW: https://github.com/google/jsonnet

Return to bug 256705