Skip to content

Commit 7675e2e

Browse files
author
Doug Greiman
committed
Fix style violations
1 parent 8338050 commit 7675e2e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

scripts/local_cloudbuild.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
}
7474

7575
# Use this image for cleanup actions
76-
DEBIAN_IMAGE='gcr.io/google-appengine/debian8'
76+
DEBIAN_IMAGE = 'gcr.io/google-appengine/debian8'
7777

7878
# File template
7979
BUILD_SCRIPT_TEMPLATE = """\
@@ -90,7 +90,7 @@
9090
if [ "${{HOST_WORKSPACE}}" != '/' -a -d "${{HOST_WORKSPACE}}" ]; then
9191
# Expect a single error message about /workspace busy
9292
{cleanup_str} 2>/dev/null || true
93-
# Do not expect error messages here. Display but ignore any that happen.
93+
# Do not expect error messages here. Display but ignore.
9494
rmdir "${{HOST_WORKSPACE}}" || true
9595
fi
9696
}}
@@ -108,7 +108,8 @@
108108

109109

110110
# Validated cloudbuild recipe + flags
111-
CloudBuild = collections.namedtuple('CloudBuild', 'output_script run steps substitutions')
111+
CloudBuild = collections.namedtuple('CloudBuild',
112+
'output_script run steps substitutions')
112113

113114
# Single validated step in a cloudbuild recipe
114115
Step = collections.namedtuple('Step', 'args dir_ env name')
@@ -136,8 +137,7 @@ def sub(match):
136137
# Variables must be set
137138
raise ValueError(
138139
'Variable "{}" used without being defined. Try adding '
139-
'it to the --substitutions flag'.format(
140-
variable_name))
140+
'it to the --substitutions flag'.format(variable_name))
141141
else:
142142
value = substitutions.get(variable_name)
143143
substitutions_used.add(variable_name)
@@ -272,8 +272,9 @@ def generate_script(cloudbuild):
272272
if user_subs_unused:
273273
nice_list = '"' + '", "'.join(sorted(user_subs_unused)) + '"'
274274
raise ValueError(
275-
'User substitution variables {} were defined in the --substitution '
276-
'flag but never used in the cloudbuild file.'.format(nice_list))
275+
'User substitution variables {} were defined in the '
276+
'--substitution flag but never used in the cloudbuild file.'.
277+
format(nice_list))
277278

278279
cleanup_str = ' '.join(cleanup_command)
279280
docker_lines = []
@@ -298,7 +299,7 @@ def make_executable(path):
298299
def write_script(cloudbuild, contents):
299300
"""Write a shell script to a file."""
300301
print('Writing build script to {}'.format(cloudbuild.output_script))
301-
with open(cloudbuild.output_script, 'w', encoding='utf8') as outfile:
302+
with io.open(cloudbuild.output_script, 'w', encoding='utf8') as outfile:
302303
outfile.write(contents)
303304
make_executable(cloudbuild.output_script)
304305

@@ -310,7 +311,7 @@ def local_cloudbuild(args):
310311
args: command line flags as per parse_args
311312
"""
312313
# Load and parse cloudbuild.yaml
313-
with open(args.config, 'r', encoding='utf8') as cloudbuild_file:
314+
with io.open(args.config, 'r', encoding='utf8') as cloudbuild_file:
314315
raw_config = yaml.safe_load(cloudbuild_file)
315316

316317
# Determine configuration

scripts/testdata/cloudbuild_ok.yaml_golden.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function cleanup {
1111
if [ "${HOST_WORKSPACE}" != '/' -a -d "${HOST_WORKSPACE}" ]; then
1212
# Expect a single error message about /workspace busy
1313
docker run --volume /var/run/docker.sock:/var/run/docker.sock --volume /root/.docker:/root/.docker --volume ${HOST_WORKSPACE}:/workspace --workdir /workspace gcr.io/google-appengine/debian8 rm -rf /workspace 2>/dev/null || true
14-
# Do not expect error messages here. Display but ignore any that happen.
14+
# Do not expect error messages here. Display but ignore.
1515
rmdir "${HOST_WORKSPACE}" || true
1616
fi
1717
}

0 commit comments

Comments
 (0)