about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@vulturis.eu>2014-01-22 21:02:06 +0100
committerPaweł Jastrzębski <pawelj@vulturis.eu>2014-01-22 21:02:06 +0100
commite4750fc965ba7eefae2201de35cc3d8cd61abf22 (patch)
tree70faf5262d256e9ad6ba51719249ebf3f1f62467
parentReverting setup changes (diff)
downloadkcc-e4750fc965ba7eefae2201de35cc3d8cd61abf22.tar.gz
kcc-e4750fc965ba7eefae2201de35cc3d8cd61abf22.tar.bz2
kcc-e4750fc965ba7eefae2201de35cc3d8cd61abf22.zip
OSX: Fixed 7zip parsing
-rw-r--r--kcc/cbxarchive.py9
-rwxr-xr-x[-rw-r--r--]setup.sh0
2 files changed, 8 insertions, 1 deletions
diff --git a/kcc/cbxarchive.py b/kcc/cbxarchive.py
index 5927226..0050704 100644
--- a/kcc/cbxarchive.py
+++ b/kcc/cbxarchive.py
@@ -19,11 +19,12 @@ __license__ = 'ISC'
 __copyright__ = '2012-2013, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@vulturis.eu>'
 __docformat__ = 'restructuredtext en'
 
+import sys
 import os
 import zipfile
 from subprocess import STDOUT, PIPE
 from psutil import Popen
-from shutil import move
+from shutil import move, copy
 from . import rarfile
 
 
@@ -73,6 +74,10 @@ class CBxArchive:
         cbrFile.extractall(targetdir, filelist)
 
     def extractCB7(self, targetdir):
+        # Workaround for some wide UTF-8 + Popen abnormalities
+        if sys.platform.startswith('darwin'):
+            copy(self.origFileName, os.path.join(os.path.dirname(self.origFileName), 'TMP_KCC_TMP'))
+            self.origFileName = os.path.join(os.path.dirname(self.origFileName), 'TMP_KCC_TMP')
         output = Popen('7za x "' + self.origFileName + '" -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -o"'
                        + targetdir + '"', stdout=PIPE, stderr=STDOUT, shell=True)
         extracted = False
@@ -81,6 +86,8 @@ class CBxArchive:
                 extracted = True
         if not extracted:
             raise OSError
+        if sys.platform.startswith('darwin'):
+            os.remove(self.origFileName)
 
     def extract(self, targetdir):
         if self.compressor == 'rar':
diff --git a/setup.sh b/setup.sh
index 0190722..0190722 100644..100755
--- a/setup.sh
+++ b/setup.sh