Python fixes
Change-Id: I3c7dbad535f07a36360ea4939cc2b484c002fd2e
diff --git a/Makefile b/Makefile
index 5db361c..393c6fa 100644
--- a/Makefile
+++ b/Makefile
@@ -36,8 +36,8 @@
PROTO_GO_DEST_DIR := go
PROTO_GO_PB:= $(foreach f, $(PROTO_FILES), $(patsubst protos/dmi/%.proto,$(PROTO_GO_DEST_DIR)/$(call if_package_path,$(f))/%.pb.go,$(f)))
-PROTO_PYTHON_DEST_DIR := python
-PROTO_PYTHON_PB:= $(foreach f, $(PROTO_FILES), $(patsubst protos/dmi/%.proto,$(PROTO_PYTHON_DEST_DIR)/$(call if_package_path,$(f))/%.pb2.py,$(f)))
+PROTO_PYTHON_DEST_DIR := python/dmi
+PROTO_PYTHON_PB2 := $(foreach f, $(PROTO_FILES), $(patsubst protos/dmi/%.proto,$(PROTO_PYTHON_DEST_DIR)/%_pb2.py,$(f)))
# Force pb file to be regenrated every time. Otherwise the make process assumes generated version is still valid
.PHONY: dmi.pb
@@ -60,21 +60,19 @@
source ./$@/bin/activate ; set -u ;\
pip install grpcio-tools googleapis-common-protos
-# python targets
-python-protos: venv_protos
- @echo "Creating *.pb2.pv and *.pb2_grpc.py files"
+# Python targets
+python-protos: $(PROTO_PYTHON_PB2)
+
+$(PROTO_PYTHON_DEST_DIR)/%_pb2.py: protos/dmi/%.proto Makefile venv_protos
source ./venv_protos/bin/activate ; set -u ;\
- for x in $(PROTO_FILES) ; do \
- echo $$x; \
- python -m grpc_tools.protoc \
- -I protos \
- --python_out=python \
- --grpc_python_out=python \
- --descriptor_set_out=$(PROTO_PYTHON_DEST_DIR)/$(basename $(notdir $<)).desc \
- --include_imports \
- --include_source_info \
- $$x;\
- done
+ python -m grpc_tools.protoc \
+ -I protos \
+ --python_out=python \
+ --grpc_python_out=python \
+ --descriptor_set_out=$(PROTO_PYTHON_DEST_DIR)/$(basename $(notdir $<)).desc \
+ --include_imports \
+ --include_source_info \
+ $<
# Go targets
go-protos: dmi.pb
@@ -99,4 +97,8 @@
python-test: tox.ini
test/test-python-proto-consistency.sh
- tox
+ tox
+
+python-build: setup.py python-protos
+ rm -rf dist/
+ python ./setup.py sdist
diff --git a/VERSION b/VERSION
index dc9bff9..f374f66 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.9.1-dev
+0.9.1
diff --git a/python/__init__.py b/python/__init__.py
new file mode 100644
index 0000000..19d1424
--- /dev/null
+++ b/python/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/python/dmi/__init__.py b/python/dmi/__init__.py
new file mode 100644
index 0000000..19d1424
--- /dev/null
+++ b/python/dmi/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/setup.py b/setup.py
index de91cad..444c5aa 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@
description='Protobuf interface definitions',
author='VOLTHA project',
author_email='voltha-dev@opencord.org',
- url='https://otti@gerrit.opencord.org/a/device-management-interface',
+ url='https://gerrit.opencord.org/plugins/gitiles/device-management-interface',
license='Apache Software License',
classifiers=[
'Development Status :: 5 - Production/Stable',
@@ -34,7 +34,7 @@
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.6',
],
- keywords='protobuf voltha',
+ keywords='protobuf device-management-interface voltha',
packages = find_packages(where="python"),
package_dir = {"": "python"},
install_requires = [
diff --git a/test/test-python-proto-consistency.sh b/test/test-python-proto-consistency.sh
index 27e6f15..a10d821 100755
--- a/test/test-python-proto-consistency.sh
+++ b/test/test-python-proto-consistency.sh
@@ -33,7 +33,11 @@
fi
# delete and regenerate python protos
-rm -rf python/dmi/*
+rm -rf python/*.desc
+rm -rf python/dmi/*.egg-info
+rm -rf python/dmi/*_pb2.py
+rm -rf python/dmi/*_pb2_grpc.py
+rm -rf python/dmi/*.desc
make python-protos
# Running git status ensures correct git diff-index picks up changes