aboutsummaryrefslogtreecommitdiff
path: root/hwpack
diff options
context:
space:
mode:
authorMichael Hudson <michael.hudson@linaro.org>2010-12-17 15:21:16 +1300
committerMichael Hudson <michael.hudson@linaro.org>2010-12-17 15:21:16 +1300
commit7dbf5f97de69119f5d427565349da6b00d54f08e (patch)
tree94335f556fb86074bbe37ebd0f7cd8e2f1efa58c /hwpack
parent3f0973c6f29ad4741d515fc272140a2d84e87420 (diff)
support different extensions in HardwarePack.filename
Diffstat (limited to 'hwpack')
-rw-r--r--hwpack/hardwarepack.py6
-rw-r--r--hwpack/tests/test_hardwarepack.py5
2 files changed, 8 insertions, 3 deletions
diff --git a/hwpack/hardwarepack.py b/hwpack/hardwarepack.py
index 2891eba..176211e 100644
--- a/hwpack/hardwarepack.py
+++ b/hwpack/hardwarepack.py
@@ -115,7 +115,7 @@ class HardwarePack(object):
self.sources = {}
self.packages = []
- def filename(self):
+ def filename(self, extension=".tar.gz"):
"""The filename that this hardware pack should have.
Returns the filename that the hardware pack should have, according
@@ -128,9 +128,9 @@ class HardwarePack(object):
support_suffix = ""
else:
support_suffix = "_%s" % self.metadata.support
- return "hwpack_%s_%s_%s%s.tar.gz" % (
+ return "hwpack_%s_%s_%s%s%s" % (
self.metadata.name, self.metadata.version,
- self.metadata.architecture, support_suffix)
+ self.metadata.architecture, support_suffix, extension)
def add_apt_sources(self, sources):
"""Add APT sources to the hardware pack.
diff --git a/hwpack/tests/test_hardwarepack.py b/hwpack/tests/test_hardwarepack.py
index 786d985..9a7003d 100644
--- a/hwpack/tests/test_hardwarepack.py
+++ b/hwpack/tests/test_hardwarepack.py
@@ -128,6 +128,11 @@ class HardwarePackTests(TestCase):
self.assertEqual(
"hwpack_ahwpack_4_armel_supported.tar.gz", hwpack.filename())
+ def test_filename_with_extension(self):
+ hwpack = HardwarePack(self.metadata)
+ self.assertEqual(
+ "hwpack_ahwpack_4_armel.txt", hwpack.filename('.txt'))
+
def get_tarfile(self, hwpack):
fileobj = StringIO()
hwpack.to_file(fileobj)