From: Miroslav Los Date: Wed, 13 Nov 2019 10:15:40 +0000 (+0100) Subject: Update distribution scripts to python3 X-Git-Tag: 0.7.0~5 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=ccsdk%2Fdistribution.git;a=commitdiff_plain;h=fc4bb348c8a8b4a5d5f77065b8ebbca16d6ce5b8 Update distribution scripts to python3 Also use python3 packages in Dockerfiles. Make python2 also available for OpenDaylight until they migrate Signed-off-by: Miroslav Los Issue-ID: CCSDK-1923 Change-Id: I3d4453ccbfe191c545ba574695387dd33c129e25 --- diff --git a/alpine/src/main/docker/Dockerfile b/alpine/src/main/docker/Dockerfile index 6cbceaf4..2e29c4db 100644 --- a/alpine/src/main/docker/Dockerfile +++ b/alpine/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -# Base ubuntu with added packages needed for open ecomp +# Base alpine with added packages needed for open ecomp FROM alpine:3.8 MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org) @@ -11,4 +11,4 @@ ENV HTTPS_PROXY ${HTTPS_PROXY} ENV https_proxy ${HTTPS_PROXY} # Add tools needed for OpenDaylight -RUN apk update && apk --no-cache add bash git openjdk8 maven mysql-client nodejs py-pip graphviz unzip rsync nss +RUN apk update && apk --no-cache add bash git openjdk8 maven mysql-client nodejs python3 graphviz unzip rsync nss diff --git a/ansible-server/src/main/Dockerfile b/ansible-server/src/main/Dockerfile index 5a1c394d..2751a482 100644 --- a/ansible-server/src/main/Dockerfile +++ b/ansible-server/src/main/Dockerfile @@ -10,7 +10,6 @@ COPY ansible-server/requirements.txt ansible-server/requirements.txt RUN apk add --no-cache curl \ iputils \ bash \ - py3-pip \ openssh-client \ python3 &&\ apk add --no-cache --virtual .build-deps build-base \ diff --git a/dgbuilder/tools/formatXml.py b/dgbuilder/tools/formatXml.py index 913456a1..7d7d7b6c 100644 --- a/dgbuilder/tools/formatXml.py +++ b/dgbuilder/tools/formatXml.py @@ -8,4 +8,4 @@ xml_fname=sys.argv[1] #print pretty_xml_as_string x = etree.parse(xml_fname) -print etree.tostring(x, pretty_print = True) +print(etree.tostring(x, pretty_print = True)) diff --git a/dgbuilder/tools/format_json.sh b/dgbuilder/tools/format_json.sh index f86ad3cf..5432e7d3 100755 --- a/dgbuilder/tools/format_json.sh +++ b/dgbuilder/tools/format_json.sh @@ -1,6 +1,7 @@ +#!/bin/bash if [ "$#" != "1" ] then echo "Usage: $0 jsonFileFullPath" exit fi -cat $1|python -m json.tool +python3 -m json.tool "$1" diff --git a/dgbuilder/tools/format_xml.sh b/dgbuilder/tools/format_xml.sh index c66153ed..fbe368e1 100755 --- a/dgbuilder/tools/format_xml.sh +++ b/dgbuilder/tools/format_xml.sh @@ -1,3 +1,4 @@ +#!/bin/bash if [ "$#" != "1" ] then echo "Usage: $0 xmlFileFullPath" @@ -10,7 +11,7 @@ then fi if [ -e "$1" ] then - python $PROJECT_HOME/tools/formatXml.py $1 + python3 $PROJECT_HOME/tools/formatXml.py "$1" else - echo "File $1 does not exist" + echo "File $1 does not exist" fi diff --git a/dgbuilder/tools/getRpcsClassFromYang.sh b/dgbuilder/tools/getRpcsClassFromYang.sh index 3944ed25..d32456b0 100755 --- a/dgbuilder/tools/getRpcsClassFromYang.sh +++ b/dgbuilder/tools/getRpcsClassFromYang.sh @@ -59,7 +59,7 @@ done echo "module.exports = {" echo "\"moduleName\" : \"${module}\"," echo "'${module}_VALUES' : " -echo "[ $allProps ]"|python -m json.tool +echo "[ $allProps ]"|python3 -m json.tool echo "," echo "'${module}_RPCS' : [" diff --git a/opendaylight/neon/neon-alpine/src/main/docker/Dockerfile b/opendaylight/neon/neon-alpine/src/main/docker/Dockerfile index 950dba69..9d518af3 100644 --- a/opendaylight/neon/neon-alpine/src/main/docker/Dockerfile +++ b/opendaylight/neon/neon-alpine/src/main/docker/Dockerfile @@ -1,9 +1,11 @@ -# Base ubuntu with added packages needed for open ecomp FROM onap/ccsdk-alpine-image:${project.docker.latestfulltag.version} MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org) ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk ENV ODL_HOME /opt/opendaylight/current +# make python2 also available up until OpenDaylight migrates to python3 +RUN apk add --no-cache py2-pip + # copy the opendaylight tar and expand COPY ${odl.karaf.artifactId}-${ccsdk.opendaylight.version}.tar.gz /tmp/ RUN mkdir -p /opt/odl \ @@ -12,7 +14,6 @@ RUN mkdir -p /opt/odl \ && mv /opt/odl/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} /opt/opendaylight \ && ln -s /opt/opendaylight /opt/opendaylight/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} \ && ln -s /opt/opendaylight /opt/opendaylight/current - # workaround till we get proxy working RUN mkdir -p /opt/opendaylight/system/org/mariadb/jdbc/mariadb-java-client/${ccsdk.mariadb-connector-java.version} diff --git a/platform-logic/installer/src/main/scripts/install.sh b/platform-logic/installer/src/main/scripts/install.sh index 167c0718..18f145a1 100644 --- a/platform-logic/installer/src/main/scripts/install.sh +++ b/platform-logic/installer/src/main/scripts/install.sh @@ -30,7 +30,7 @@ $BASEDIR/bin/svclogic.sh install $BASEDIR $BASEDIR/config/svclogic.properties end=$(date +%s.%N) echo "Load and activate finished at $(date)" -runtime=$(python -c "print(${end} - ${start})") +runtime=$(python3 -c "print(${end} - ${start})") echo "Load and activate took $runtime seconds" diff --git a/ubuntu/src/main/docker/Dockerfile b/ubuntu/src/main/docker/Dockerfile index e2eb9b5a..7dfe2443 100644 --- a/ubuntu/src/main/docker/Dockerfile +++ b/ubuntu/src/main/docker/Dockerfile @@ -12,4 +12,4 @@ RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\ if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi # Add tools needed for OpenDaylight -RUN apt-get update && apt-get install -y git openjdk-8-jdk maven mysql-client nodejs nodejs-legacy python-pip graphviz npm unzip +RUN apt-get update && apt-get install -y git openjdk-8-jdk maven mysql-client nodejs nodejs-legacy python3-pip graphviz npm unzip