diff --git a/core-builder/Dockerfile b/core-builder/Dockerfile index 128f1739a4..812b2c4987 100644 --- a/core-builder/Dockerfile +++ b/core-builder/Dockerfile @@ -27,9 +27,10 @@ RUN \ # dependencies for release script RUN \ + # install env for python3 apt-get update -y && \ - apt-get install -y python-pip && \ - pip install pyyaml && \ + apt-get install -y python3-pip && \ + pip3 install pyyaml && \ apt-get remove -y --auto-remove && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* WORKDIR /work diff --git a/core-builder/Makefile b/core-builder/Makefile index 678ee03bb3..2af9fad769 100644 --- a/core-builder/Makefile +++ b/core-builder/Makefile @@ -1,5 +1,5 @@ DOCKER_IMAGE_NAME=seldonio/core-builder -DOCKER_IMAGE_VERSION=0.2 +DOCKER_IMAGE_VERSION=0.3 build_docker_image: docker build --force-rm=true -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION) . diff --git a/release b/release index c356c89fc1..9874e82f68 100755 --- a/release +++ b/release @@ -9,5 +9,5 @@ STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )" docker run --rm -it \ -v ${HOME}/.m2:/root/.m2 \ -v "${STARTUP_DIR}":/work \ - seldonio/core-builder:0.2 python release.py "$@" + seldonio/core-builder:0.3 python3 release.py "$@" diff --git a/release.py b/release.py index 783fce6bad..5512b8e19c 100644 --- a/release.py +++ b/release.py @@ -3,7 +3,7 @@ # import yaml -import StringIO +from io import StringIO import pprint from subprocess import Popen, PIPE import os @@ -27,13 +27,13 @@ def dict_to_yaml(d): return yaml.dump(d, default_flow_style=False) def yaml_to_dict(yaml_data): - return yaml.load(StringIO.StringIO(yaml_data)) + return yaml.load(StringIO(yaml_data)) def run_command(args, debug=False): err, out = None, None if debug: - print "cwd[{}]".format(os.getcwd()) - print "Executing: " + repr(args) + print("cwd[{}]".format(os.getcwd())) + print("Executing: " + repr(args)) p = Popen(args, stdout=PIPE, stderr=PIPE) if p.wait() == 0: out = p.stdout.read() @@ -51,7 +51,7 @@ def run_command(args, debug=False): def update_pom_file(fpath, seldon_core_version, debug=False): fpath = os.path.realpath(fpath) if debug: - print "processing [{}]".format(fpath) + print("processing [{}]".format(fpath)) comp_dir_path = os.path.dirname(fpath) os.chdir(comp_dir_path) args = ["mvn", "versions:set", "-DnewVersion={seldon_core_version}".format(**locals())] @@ -59,15 +59,15 @@ def update_pom_file(fpath, seldon_core_version, debug=False): ##pp(out) ##pp(err) if err == None: - print "updated {fpath}".format(**locals()) + print("updated {fpath}".format(**locals())) else: - print "error {fpath}".format(**locals()) - print err + print("error {fpath}".format(**locals())) + print(err) def update_chart_yaml_file(fpath, seldon_core_version, debug=False): fpath = os.path.realpath(fpath) if debug: - print "processing [{}]".format(fpath) + print("processing [{}]".format(fpath)) f = open(fpath) yaml_data = f.read() f.close() @@ -78,13 +78,13 @@ def update_chart_yaml_file(fpath, seldon_core_version, debug=False): with open(fpath, 'w') as f: f.write(dict_to_yaml(d)) - print "updated {fpath}".format(**locals()) + print("updated {fpath}".format(**locals())) def update_values_yaml_file(fpath, seldon_core_version, debug=False): fpath = os.path.realpath(fpath) if debug: - print "processing [{}]".format(fpath) + print("processing [{}]".format(fpath)) f = open(fpath) yaml_data = f.read() f.close() @@ -97,7 +97,7 @@ def update_values_yaml_file(fpath, seldon_core_version, debug=False): with open(fpath, 'w') as f: f.write(dict_to_yaml(d)) - print "updated {fpath}".format(**locals()) + print("updated {fpath}".format(**locals())) def update_core_jsonnet(fpath, seldon_core_version, debug=False): # eg. @@ -113,7 +113,7 @@ def get_output_line(raw_line, srch_str): fpath = os.path.realpath(fpath) if debug: - print "processing [{}]".format(fpath) + print("processing [{}]".format(fpath)) tmpfpath = fpath+'.tmp' with open(fpath, 'r') as f: @@ -125,9 +125,9 @@ def get_output_line(raw_line, srch_str): output_line = get_output_line(raw_line, srch_str) ftmp.write(output_line) if debug: - print "created {tmpfpath}".format(**locals()) + print("created {tmpfpath}".format(**locals())) shutil.move(tmpfpath, fpath) # move created tmp file to original file - print "updated {fpath}".format(**locals()) + print("updated {fpath}".format(**locals())) def set_version(seldon_core_version, pom_files, chart_yaml_files, values_yaml_file, core_jsonnet_file, debug=False): # Normalize file paths @@ -161,7 +161,7 @@ def main(argv): if opts.debug: pp(opts) set_version(opts.seldon_core_version, POM_FILES, CHART_YAML_FILES, VALUES_YAML_FILE, CORE_JSONNET_FILE, opts.debug) - print "done" + print("done") if __name__ == "__main__": main(sys.argv)