Skip to content

Commit f302067

Browse files
committed
user should have less control over changing name of spec file, this is a simple standard
1 parent 228efdd commit f302067

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

singularity/build.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,
238238
:: note: this function is currently configured to work with Google Compute
239239
Engine metadata api, and should (will) be customized if needed to work elsewhere
240240
'''
241-
# Default spec file is Singularity
242-
if spec_file == None:
243-
spec_file = "Singularity"
244-
245241
# If no build directory is specified, make a temporary one
246242
if build_dir == None:
247243
build_dir = tempfile.mkdtemp()
@@ -256,10 +252,13 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,
256252
{'key': 'response_url', 'value': response_url, 'return_text': True },
257253
{'key': 'token', 'value': token, 'return_text': False },
258254
{'key': 'commit', 'value': commit, 'return_text': True },
259-
{'key': 'spec_file', 'value': spec_file, 'return_text': True },
260255
{'key': 'size', 'value': size, 'return_text': True },
261256
{'key': 'logfile', 'value': logfile, 'return_text': True }]
262257

258+
# Default spec file is Singularity
259+
if spec_file == None:
260+
spec_file = "Singularity"
261+
263262
# Obtain values from build
264263
params = get_build_params(metadata)
265264

@@ -278,9 +277,9 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,
278277
logging.warning("commit still not found in build, setting unique id to %s",params['commit'])
279278

280279

281-
if os.path.exists(params['spec_file']):
282-
logging.info("Found spec file %s in repository",params['spec_file'])
283-
image_package = build_from_spec(spec=params['spec_file'],
280+
if os.path.exists(spec_file):
281+
logging.info("Found spec file %s in repository",spec_file)
282+
image_package = build_from_spec(spec=spec_file,
284283
name=params['commit'],
285284
size=params['size'],
286285
sudopw='', # with root should not need sudo
@@ -342,7 +341,7 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,
342341
else:
343342
# Tell the user what is actually there
344343
present_files = glob("*")
345-
logging.error("Build file %s not found in repository",params['spec_file'])
344+
logging.error("Build file %s not found in repository",spec_file)
346345
logging.info("Found files are %s","\n".join(present_files))
347346

348347

0 commit comments

Comments
 (0)