VOL-1554 Updated to use LOCAL_PROTOS for including protos. Also changed to a single base dockerfile.
Cleaned out some stuff that was used for building protos, that we no longer need

Change-Id: Ibfe88bba8e553e8d6c4d9d5b6a59a9860a6f2651
diff --git a/python/Makefile b/python/Makefile
index ec8b91d..a78ecda 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -43,6 +43,10 @@
 	 --rm --force-rm \
 	$(DOCKER_BUILD_EXTRA_ARGS)
 
+DOCKER_BUILD_EXTRA_ARGS = \
+	--build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+	--build-arg LOCAL_PROTOS=$(LOCAL_PROTOS)
+
 DOCKER_IMAGE_LIST = \
 	voltha-openonu-adapter-base \
 	voltha-openonu-adapter
@@ -75,15 +79,16 @@
 containers: base openonu_adapter
 
 base:
+	mkdir -p local_imports
 ifdef LOCAL_PYVOLTHA
-	mkdir -p pyvoltha/dist
-	cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
-	mkdir -p voltha-protos/dist
-	cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openonu-adapter-base:${TAG} -f docker/Dockerfile.base_local .
-else
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openonu-adapter-base:${TAG} -f docker/Dockerfile.base .
+	mkdir -p local_imports/pyvoltha/dist
+	cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
 endif
+ifdef LOCAL_PROTOS
+	mkdir -p local_imports/voltha-protos/dist
+	cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+endif
+	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openonu-adapter-base:${TAG} -f docker/Dockerfile.base .
 
 openonu_adapter: base
 ifdef PYVOLTHA_BASE_IMAGE
@@ -108,8 +113,7 @@
 	docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG}
 
 clean:
-	rm -rf pyvoltha
-	rm -rf voltha-protos
+	rm -rf local_imports
 	find . -name '*.pyc' | xargs rm -f
 
 distclean: clean
@@ -137,12 +141,15 @@
 	    fi
 
 ifdef LOCAL_PYVOLTHA
-	mkdir -p pyvoltha/dist
-	cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
-	mkdir -p voltha-protos/dist
-	cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
+	mkdir -p local_imports/pyvoltha/dist
+	cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
 	. ${VENVDIR}/bin/activate && \
-	    pip install pyvoltha/dist/*.tar.gz && \
-	    pip install voltha-protos/dist/*.tar.gz
+	    pip install local_imports/pyvoltha/dist/*.tar.gz
+endif
+ifdef LOCAL_PROTOS
+	mkdir -p local_imports/voltha-protos/dist
+	cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+	. ${VENVDIR}/bin/activate && \
+	    pip install local_protos/voltha-protos/dist/*.tar.gz
 endif
 # end file