diff --git a/devel/Makefile b/devel/Makefile index 9d073d2c84ca..7a08e006ac52 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -4837,6 +4837,7 @@ SUBDIR += py-proselint SUBDIR += py-proto-plus SUBDIR += py-protobuf + SUBDIR += py-protobuf-compiler SUBDIR += py-proxmoxer SUBDIR += py-ptable SUBDIR += py-ptpython diff --git a/devel/py-protobuf-compiler/Makefile b/devel/py-protobuf-compiler/Makefile new file mode 100644 index 000000000000..1a0582b589ad --- /dev/null +++ b/devel/py-protobuf-compiler/Makefile @@ -0,0 +1,49 @@ +# $FreeBSD$ + +PORTNAME= protobuf-compiler +DISTVERSION= 1.0.20 +CATEGORIES= devel python +MASTER_SITES= CHEESESHOP +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} +DISTNAME= ${PORTNAME:S/-/_/}-${DISTVERSION} +DISTFILES= ${DISTNAME}${EXTRACT_SUFX} + +MAINTAINER= 0mp@FreeBSD.org +COMMENT= Compile all protobuf files and create package distributions + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC_tests}/LICENSE + +BUILD_DEPENDS= ${_MY_DEPENDS} +RUN_DEPENDS= ${_MY_DEPENDS} + +USES= python:3.6+ shebangfix +USE_GITHUB= nodefault +GH_TUPLE= netsaj:python-${PORTNAME}:7cb32ab8188cbfecb91034cbf7803394ed1c25b6:tests +USE_PYTHON= autoplist concurrent distutils +SHEBANG_GLOB= *.py + +TEST_ENV= PYTHONPATH="${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}" +NO_ARCH= yes +TEST_WRKSRC= ${WRKSRC_tests} + +_MY_DEPENDS= ${PYTHON_PKGNAMEPREFIX}bleach>=2.1.0:www/py-bleach@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}colorama>=0.3.3:devel/py-colorama@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}grpcio-tools>=1.18.0:devel/py-grpcio-tools@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}grpcio>=1.18.0:devel/py-grpcio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}termcolor>=1.1.0:devel/py-termcolor@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}tqdm>=4.31.1:misc/py-tqdm@${PY_FLAVOR} + +post-patch: + ${REINPLACE_CMD} 's|%%PYTHON_CMD%%|${PYTHON_CMD}|g' \ + ${WRKSRC}/protobuf_compiler/main.py + +do-test: +# Loosely based on the upstream test_protopy.py. + ${RM} -r ${TEST_WRKSRC}/run_test + cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} \ + ${PYTHON_CMD} ${STAGEDIR}${PREFIX}/bin/protopy \ + -o ./run_test -d ./test -p mytesting -v 1.0.1 + ${TEST} -e ${TEST_WRKSRC}/run_test/mytesting-1.0.1.tar.gz + +.include diff --git a/devel/py-protobuf-compiler/distinfo b/devel/py-protobuf-compiler/distinfo new file mode 100644 index 000000000000..48ab9ff2984b --- /dev/null +++ b/devel/py-protobuf-compiler/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1614156744 +SHA256 (protobuf_compiler-1.0.20.tar.gz) = ac8daa7187fb9cac7752008368b79d8d8e44dd1b154423fa7afd227a31d062f6 +SIZE (protobuf_compiler-1.0.20.tar.gz) = 5296 +SHA256 (netsaj-python-protobuf-compiler-7cb32ab8188cbfecb91034cbf7803394ed1c25b6_GH0.tar.gz) = 72b8f59ef6ee9999701b09b2611fc3d79d7c500821fbb2edc4e8a1d4db864771 +SIZE (netsaj-python-protobuf-compiler-7cb32ab8188cbfecb91034cbf7803394ed1c25b6_GH0.tar.gz) = 7499 diff --git a/devel/py-protobuf-compiler/files/patch-protobuf__compiler_main.py b/devel/py-protobuf-compiler/files/patch-protobuf__compiler_main.py new file mode 100644 index 000000000000..75833d441a48 --- /dev/null +++ b/devel/py-protobuf-compiler/files/patch-protobuf__compiler_main.py @@ -0,0 +1,20 @@ +--- protobuf_compiler/main.py.orig 2021-02-24 09:06:33 UTC ++++ protobuf_compiler/main.py +@@ -100,7 +100,7 @@ def main(): + for f in files: + file_name = f.split(os.path.sep)[-1] + folder = f.replace(file_name,"").replace(input_dir + os.path.sep, "") +- command = "python3 -m grpc_tools.protoc -I. \ ++ command = "%%PYTHON_CMD%% -m grpc_tools.protoc -I. \ + --proto_path=" + input_dir + " \ + --python_out=" + os.path.join(output_dir, package_name) + " \ + --grpc_python_out=" + os.path.join(output_dir, package_name) + " \ +@@ -130,7 +130,7 @@ setup( + description='' + ) + """) +- command = "cd " + os.path.join(output_dir, package_name) + " && python3 setup.py sdist" ++ command = "cd " + os.path.join(output_dir, package_name) + " && %%PYTHON_CMD%% setup.py sdist" + out = os.system(command) + # print(out) + if args.repository != '': diff --git a/devel/py-protobuf-compiler/files/patch-setup.py b/devel/py-protobuf-compiler/files/patch-setup.py new file mode 100644 index 000000000000..655529de5cd8 --- /dev/null +++ b/devel/py-protobuf-compiler/files/patch-setup.py @@ -0,0 +1,21 @@ +--- setup.py.orig 2021-02-24 08:56:12 UTC ++++ setup.py +@@ -24,12 +24,12 @@ setup( + "Programming Language :: Python :: 3.6", + ], + install_requires=[ +- 'grpcio==1.18.0', +- 'grpcio-tools==1.18.0', +- 'colorama==0.3.3', +- 'termcolor==1.1.0', +- 'tqdm==4.31.1', +- 'bleach==2.1.0' ++ 'grpcio>=1.18.0', ++ 'grpcio-tools>=1.18.0', ++ 'colorama>=0.3.3', ++ 'termcolor>=1.1.0', ++ 'tqdm>=4.31.1', ++ 'bleach>=2.1.0' + ], + entry_points={ + 'console_scripts': [ diff --git a/devel/py-protobuf-compiler/pkg-descr b/devel/py-protobuf-compiler/pkg-descr new file mode 100644 index 000000000000..9315db4d9bb3 --- /dev/null +++ b/devel/py-protobuf-compiler/pkg-descr @@ -0,0 +1,4 @@ +Python protobuf compiler can be used to compile collections protobuf files and +create a single package distribution suitable for installing with pip. + +WWW: https://github.com/netsaj/python-protobuf-compiler