Skip to content

Commit 2ed5798

Browse files
committed
fixing misnamed variable in calculate_image_size function
1 parent e80ad89 commit 2ed5798

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

singularity/build/google.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
157157
{'key': 'secret', 'value': secret, 'return_text': True },
158158
{'key': 'size', 'value': size, 'return_text': True },
159159
{'key': 'branch', 'value': branch, 'return_text': True },
160-
{'key': 'container_id', 'value': None, 'return_text': True }]
160+
{'key': 'container_id', 'value': None, 'return_text': True },
161+
{'key': 'spec_file', 'value': spec_file, 'return_text': True }]
161162

162163
# Default spec file is Singularity
163164
if spec_file == None:
@@ -194,10 +195,10 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
194195
# If size is None, get from image + 200 padding
195196
if params['size'] == None:
196197
bot.logger.info("Size not detected for build. Will estimate with 200MB padding.")
197-
params['size'] = estimate_image_size(spec=spec_file,
198+
params['size'] = estimate_image_size(spec_file=spec_file,
198199
sudopw='')
199200

200-
image = build_from_spec(spec=spec_file, # default will package the image
201+
image = build_from_spec(spec_file=spec_file, # default will package the image
201202
size=params['size'],
202203
sudopw='', # with root should not need sudo
203204
output_folder=build_dir,

singularity/package.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
import os
2525

2626

27-
def estimate_image_size(spec=None,sudopw=None,padding=200):
27+
def estimate_image_size(spec_file=None,sudopw=None,padding=200):
2828
'''estimate_image_size will generate an image in a directory, and add
2929
some padding to it to estimate the size of the image file to generate
3030
:param sudopw: the sudopw for Singularity, root should provide ''
31-
:param spec: the spec file, called "Singuarity"
31+
:param spec_file: the spec file, called "Singuarity"
3232
:param padding: the padding (MB) to add to the image
3333
'''
3434
size_dir = tempfile.mkdtemp()
3535
tmp_dir = tempfile.mkdtemp()
36-
image_folder = build_from_spec(spec=spec_file, # default will package the image
36+
image_folder = build_from_spec(spec_file=spec_file, # default will package the image
3737
sudopw=sudopw, # with root should not need sudo
3838
output_folder=size_dir,
3939
build_dir=tmp_dir,
@@ -47,26 +47,26 @@ def estimate_image_size(spec=None,sudopw=None,padding=200):
4747
return padded_size
4848

4949

50-
def build_from_spec(spec=None,build_dir=None,size=None,sudopw=None,
50+
def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,
5151
output_folder=None,build_folder=False):
5252
'''build_from_spec will build a "spec" file in a "build_dir" and return the directory
53-
:param spec: the spec file, called "Singuarity"
53+
:param spec_file: the spec file, called "Singuarity"
5454
:param sudopw: the sudopw for Singularity, root should provide ''
5555
:param build_dir: the directory to build in. If not defined, will use tmpdir.
5656
:param size: the size of the image
5757
:param output_folder: where to output the image package
5858
:param build_folder: "build" the image into a folder instead. Default False
5959
'''
60-
if spec == None:
61-
spec = "Singularity"
60+
if spec_file == None:
61+
spec_file = "Singularity"
6262
if build_dir == None:
6363
build_dir = tempfile.mkdtemp()
6464
bot.logger.debug("Building in directory %s",build_dir)
6565

6666
# Copy the spec to a temporary directory
67-
spec_path = "%s/%s" %(build_dir,spec)
67+
spec_path = "%s/%s" %(build_dir,spec_file)
6868
if not os.path.exists(spec_path):
69-
shutil.copyfile(spec,spec_path)
69+
shutil.copyfile(spec_file,spec_path)
7070
# If name isn't provided, call it Singularity
7171
image_path = "%s/image" %(build_dir)
7272
# Run create image and bootstrap with Singularity command line tool.

0 commit comments

Comments
 (0)