Skip to content

Commit

Permalink
fix: on OS X too we need to strip lzma suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
examachine committed Feb 23, 2017
1 parent abe669b commit 0e69f53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 4 additions & 8 deletions pisi/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ def add_to_archive(self, file_name, arc_name=None):
wmode = 'w:bz2'
elif self.type == 'tarlzma':
wmode = 'w:'
if not util.is_osx():
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
else:
raise ArchiveError(_("Archive type not recognized"))
self.tar = tarfile.open(self.file_path, wmode)
Expand All @@ -163,15 +162,12 @@ def close(self):
if self.tar.mode == 'w' and self.type == 'tarlzma':
batch = None
if util.is_osx():
lzma = "lzma"
lzma = "lzma -z"
else:
lzma = "lzmash"
if ctx.config.values.build.compressionlevel:
batch = "%s -%s %s" % (lzma, ctx.config.values.build.compressionlevel, self.file_path)
else:
batch = "%s %s" % (lzma, self.file_path)

ret, out, err = util.run_batch(batch)
lzma += " -%d" % ctx.config.values.build.compressionlevel
ret, out, err = util.run_batch("%s %s" % (lzma, self.file_path))
if ret != 0:
raise LZMAError(err)

Expand Down
4 changes: 3 additions & 1 deletion tests/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ def setUp(self, comar = False, database = True, options = None):
options = pisi.config.Options()
options.ignore_build_no = False
options.destdir = 'tmp'
#options.debug = True #TODO: make these into options for run.py
#options.verbose = True
pisi.api.init(options = options, comar = comar,
database = database, write = database)

def tearDown(self, ):
def tearDown(self):
pisi.api.finalize()

0 comments on commit 0e69f53

Please sign in to comment.