Skip to content

Commit 9c7cf64

Browse files
committed
modified: setup.py
modified: singularity/build/google.py modified: singularity/build/scripts/singularity-build-latest.sh modified: singularity/package.py
1 parent f4fc005 commit 9c7cf64

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name="singularity",
88

99
# Version number:
10-
version="0.48",
10+
version="0.49",
1111

1212
# Application author details:
1313
author="Vanessa Sochat",

singularity/build/google.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,12 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
195195
# If size is None, get from image + 50 padding
196196
if params['size'] == None:
197197
bot.logger.info("Size not detected for build. Will estimate with 50MB padding.")
198-
params['size'] = estimate_image_size(spec_file=params['spec_file'],
198+
params['size'] = estimate_image_size(spec_file=os.path.abspath(params['spec_file']),
199199
sudopw='')
200200

201201
image = build_from_spec(spec_file=params['spec_file'], # default will package the image
202202
size=params['size'],
203203
sudopw='', # with root should not need sudo
204-
output_folder=build_dir,
205204
build_dir=build_dir)
206205

207206
# Compress image

singularity/build/scripts/singularity-build-latest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sudo pip3 install --upgrade google-api-python-client
1111
sudo pip3 install --upgrade google
1212
sudo pip3 install oauth2client==3.0.0
1313
sudo pip3 install gitpython
14-
sudo pip3 install singularity
14+
sudo pip3 install singularity --upgrade
1515
python3 -c "from singularity.build.google import run_build; run_build()" > /tmp/.shub-log 2>&1
1616
export command=$(echo "from singularity.build.google import finish_build; finish_build()")
1717
python3 -c "$command"

singularity/package.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,22 @@ def estimate_image_size(spec_file,sudopw=None,padding=50):
3131
:param spec_file: the spec file, called "Singuarity"
3232
:param padding: the padding (MB) to add to the image
3333
'''
34-
size_dir = tempfile.mkdtemp()
35-
tmp_dir = tempfile.mkdtemp()
3634
image_folder = build_from_spec(spec_file=spec_file, # default will package the image
3735
sudopw=sudopw, # with root should not need sudo
38-
output_folder=size_dir,
39-
build_dir=tmp_dir,
4036
build_folder=True)
4137
original_size = calculate_folder_size(image_folder)
4238
bot.logger.debug("Original image size calculated as %s",original_size)
4339
padded_size = original_size + padding
4440
bot.logger.debug("Size with padding will be %s",padded_size)
45-
shutil.rmtree(size_dir)
46-
os.system('sudo rm -rf %s' %tmp_dir)
4741
return padded_size
4842

4943

50-
def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,
51-
output_folder=None,build_folder=False):
44+
def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,build_folder=False):
5245
'''build_from_spec will build a "spec" file in a "build_dir" and return the directory
5346
:param spec_file: the spec file, called "Singuarity"
5447
:param sudopw: the sudopw for Singularity, root should provide ''
5548
:param build_dir: the directory to build in. If not defined, will use tmpdir.
5649
:param size: the size of the image
57-
:param output_folder: where to output the image package
5850
:param build_folder: "build" the image into a folder instead. Default False
5951
'''
6052
if spec_file == None:
@@ -64,7 +56,11 @@ def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,
6456
bot.logger.debug("Building in directory %s",build_dir)
6557

6658
# Copy the spec to a temporary directory
59+
bot.logger.debug("Spec file set to %s",spec_file)
6760
spec_path = "%s/%s" %(build_dir,os.path.basename(spec_file))
61+
bot.logger.debug("Spec file for build should be in %s",spec_path)
62+
63+
# If it's not already there
6864
if not os.path.exists(spec_path):
6965
shutil.copyfile(spec_file,spec_path)
7066

0 commit comments

Comments
 (0)