Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Update for python 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
hwright committed Dec 5, 2017
1 parent 6524945 commit 07d386c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ py_binary(
visibility = ["//visibility:public"],
deps = [
":utils",
"@bazel_tools//third_party/py/six",
"@containerregistry",
],
)
Expand Down
10 changes: 6 additions & 4 deletions container/create_image_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import json
import sys

import six

from container import utils
from containerregistry.transform.v2_2 import metadata as v2_2_metadata

Expand Down Expand Up @@ -112,7 +114,7 @@ def Stamp(inp):
layers.append(utils.ExtractValue(layer))

labels = KeyValueToDict(args.labels)
for label, value in labels.iteritems():
for label, value in six.iteritems(labels):
if value.startswith('@'):
with open(value[1:], 'r') as f:
labels[label] = f.read()
Expand All @@ -121,11 +123,11 @@ def Stamp(inp):

output = v2_2_metadata.Override(data, v2_2_metadata.Overrides(
author='Bazel', created_by='bazel build ...',
layers=layers, entrypoint=map(Stamp, fix_dashdash(args.entrypoint)),
cmd=map(Stamp, fix_dashdash(args.command)), user=Stamp(args.user),
layers=layers, entrypoint=list(map(Stamp, fix_dashdash(args.entrypoint))),
cmd=list(map(Stamp, fix_dashdash(args.command))), user=Stamp(args.user),
labels=labels, env={
k: Stamp(v)
for (k, v) in KeyValueToDict(args.env).iteritems()
for (k, v) in six.iteritems(KeyValueToDict(args.env))
},
ports=args.ports, volumes=args.volumes, workdir=Stamp(args.workdir)),
architecture=_PROCESSOR_ARCHITECTURE,
Expand Down

0 comments on commit 07d386c

Please sign in to comment.