Skip to content

Commit 067169d

Browse files
committed
updating packages
1 parent 9d4203a commit 067169d

File tree

8 files changed

+25
-22
lines changed

8 files changed

+25
-22
lines changed

singularity/cli/main/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
2525
'''
2626

27-
import singularity
2827
import argparse
2928
import sys
3029
import os
@@ -44,7 +43,6 @@ def get_parser():
4443
help="If using Docker or shub image, you can change size (default is 1024)",
4544
type=int, default=1024)
4645

47-
4846
subparsers = parser.add_subparsers(help='shub actions',
4947
title='actions',
5048
description='actions for Singularity Hub tools',
@@ -170,7 +168,6 @@ def main():
170168

171169
parser = get_parser()
172170
subparsers = get_subparsers(parser)
173-
print("Singularity Python Version: %s" % singularity.__version__)
174171

175172
try:
176173
args = parser.parse_args()
@@ -183,6 +180,11 @@ def main():
183180
# if environment logging variable not set, make silent
184181
if args.debug is False:
185182
os.environ['MESSAGELEVEL'] = "CRITICAL"
183+
184+
# Always print the version
185+
from singularity.logger import bot
186+
import singularity
187+
bot.info("Singularity Python Version: %s" % singularity.__version__)
186188

187189
if args.command == "create":
188190
from .create import main

singularity/package/build.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def build_from_spec(spec_file=None,
112112
def package(image_path,
113113
spec_path=None,
114114
output_folder=None,
115-
software=True,
116115
remove_image=False,
117116
verbose=False,
118117
S=None):
@@ -155,12 +154,11 @@ def package(image_path,
155154
bot.warning("Trouble extracting container metadata with inspect.")
156155

157156

158-
if software == True:
159-
bot.info("Adding software list to package.")
160-
files = [x.path for x in members if x.isfile()]
161-
folders = [x.path for x in members if x.isdir()]
162-
to_package["files.txt"] = files
163-
to_package["folders.txt"] = folders
157+
bot.info("Adding software list to package.")
158+
files = [x.path for x in members if x.isfile()]
159+
folders = [x.path for x in members if x.isdir()]
160+
to_package["files.txt"] = files
161+
to_package["folders.txt"] = folders
164162

165163
# Do zip up here - let's start with basic structures
166164
zipfile = zip_up(to_package,zip_name=zip_name,output_folder=output_folder)

singularity/tests/data/README

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
The cirros and busybox images were produced with Singularity 2.4, which has a much smaller image footprint. The file extractions for the package are from 2016, and were remade as one had become corrupt. More evidence for squashfs
44

5+
Singularity Python version 1.2.1 with Singularity Version 2.4
6+
7+
## Images
58
```
69
sudo singularity build cirros-2017-10-21.simg docker://cirros
710
sudo singularity build busybox-2017-10-21.simg docker://busybox
11+
```
12+
13+
## Packages
814

15+
16+
```
17+
shub package --image cirros-2017-10-21.simg
18+
shub package --image busybox-2017-10-21.simg
919
```
-565 KB
Binary file not shown.
858 Bytes
Binary file not shown.
-3.46 MB
Binary file not shown.
2.25 KB
Binary file not shown.

singularity/tests/test_package.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def setUp(self):
5858
self.tmpdir = tempfile.mkdtemp()
5959
self.image1 = "%s/tests/data/busybox-2017-10-21.simg" %(self.pwd)
6060
self.image2 = "%s/tests/data/cirros-2017-10-21.simg" %(self.pwd)
61-
self.pkg1 = "%s/tests/data/busybox-2016-02-16.img.zip" %(self.pwd)
62-
self.pkg2 = "%s/tests/data/cirros-2016-01-04.img.zip" %(self.pwd)
61+
self.pkg1 = "%s/tests/data/busybox-2017-10-21.zip" %(self.pwd)
62+
self.pkg2 = "%s/tests/data/cirros-2017-10-21.zip" %(self.pwd)
6363

6464

6565
def tearDown(self):
@@ -72,21 +72,14 @@ def test_packaging(self):
7272
self.pkg1_includes = list_package(self.pkg1)
7373
self.pkg2_includes = list_package(self.pkg2)
7474

75-
includes = ['files.txt', 'VERSION', 'NAME', 'folders.txt']
75+
includes = ['files.txt', 'runscript', 'folders.txt'] # VERSION only with spec_file
7676
for pkg_includes in [self.pkg1_includes,self.pkg2_includes]:
7777
[self.assertTrue(x in pkg_includes) for x in includes]
78-
self.assertTrue(os.path.basename(self.image1) in self.pkg1_includes)
79-
self.assertTrue(os.path.basename(self.image2) in self.pkg2_includes)
8078

8179
print("TESTING loading packages...")
8280
pkg1_loaded = load_package(self.pkg1)
83-
self.assertTrue(len(pkg1_loaded["files.txt"])==12)
84-
self.assertTrue(len(pkg1_loaded["folders.txt"])==18)
85-
86-
# Did it extract successfully?
87-
image1_extraction = pkg1_loaded[os.path.basename(self.image1)]
88-
self.assertTrue(os.path.exists(image1_extraction))
89-
shutil.rmtree(os.path.dirname(image1_extraction))
81+
self.assertEqual(len(pkg1_loaded["files.txt"]),20)
82+
self.assertEqual(len(pkg1_loaded["folders.txt"]),20)
9083

9184

9285

0 commit comments

Comments
 (0)