commit:     1804e49c36651ab7b99c3464bef821adafca91d1
Author:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 20:27:31 2016 +0000
Commit:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 20:27:31 2016 +0000
URL:        https://gitweb.gentoo.org/dev/dev-zero.git/commit/?id=1804e49c

dev-python/py-unrar2: required for SiCKRAGE

 dev-python/py-unrar2/Manifest                      |   1 +
 ...-unrar2-0.99.6-fix-tabs-and-unrar-version.patch | 184 +++++++++++++++++++++
 dev-python/py-unrar2/py-unrar2-0.99.6.ebuild       |  33 ++++
 3 files changed, 218 insertions(+)

diff --git a/dev-python/py-unrar2/Manifest b/dev-python/py-unrar2/Manifest
new file mode 100644
index 0000000..e40ce79
--- /dev/null
+++ b/dev-python/py-unrar2/Manifest
@@ -0,0 +1 @@
+DIST py-unrar2-0.99.6.tar.gz 731321 SHA256 
1aa6c67870a60224baea9fc8dbd72ad0bd1452ca4c90415bf54768e1463002bb SHA512 
f8704977202c482eee071d1e35ceb3654d72d9de53854d4b4ce4c5c789525b02d2b82cc76fde3e2d341289da9cd48c33fc0e93101ff45a67767ee0743dfe6c17
 WHIRLPOOL 
fdf2decddd83dc56a22d0078107e85dcc5aadcbc1211384d7ceac82e60cb6577025faed99b9ccc9c3fc25beef828fe50b56a63d18ab92a39254f00c6a8ca8d39

diff --git 
a/dev-python/py-unrar2/files/py-unrar2-0.99.6-fix-tabs-and-unrar-version.patch 
b/dev-python/py-unrar2/files/py-unrar2-0.99.6-fix-tabs-and-unrar-version.patch
new file mode 100644
index 0000000..8fa9d2b
--- /dev/null
+++ 
b/dev-python/py-unrar2/files/py-unrar2-0.99.6-fix-tabs-and-unrar-version.patch
@@ -0,0 +1,184 @@
+From adc3f2e0268c7f02bbf32a6a439a066dab023bcd Mon Sep 17 00:00:00 2001
+From: Dustyn Gibson <miig...@gmail.com>
+Date: Sat, 3 Oct 2015 22:11:33 -0700
+Subject: [PATCH] Try new date formats on strptime valueError exception, Fixes
+ yk4ever/py-unrar2/issues/14
+
+---
+ unix.py | 65 +++++++++++++++++++++++++++++++++++------------------------------
+ 1 file changed, 35 insertions(+), 30 deletions(-)
+
+diff --git a/unix.py b/unix.py
+index 12cced4..72c9eaf 100644
+--- a/unix.py
++++ b/unix.py
+@@ -48,7 +48,7 @@ def call_unrar(params):
+                 pass
+         if rar_executable_cached is None:
+             raise UnpackerNotInstalled("No suitable RAR unpacker installed")
+-            
++
+     assert type(params) == list, "params must be list"
+     args = [rar_executable_cached] + params
+     try:
+@@ -62,15 +62,15 @@ class RarFileImplementation(object):
+     def init(self, password=None):
+         global rar_executable_version
+         self.password = password
+-        
+-        
++
++
+         stdoutdata, stderrdata = self.call('v', []).communicate()
+-        
++
+         for line in stderrdata.splitlines():
+             if line.strip().startswith("Cannot open"):
+                 raise FileOpenError
+             if line.find("CRC failed")>=0:
+-                raise IncorrectRARPassword   
++                raise IncorrectRARPassword
+         accum = []
+         source = iter(stdoutdata.splitlines())
+         line = ''
+@@ -107,28 +107,28 @@ def init(self, password=None):
+             else:
+                 self.comment = None
+         else:
+-            raise UnpackerNotInstalled("Unsupported RAR version, expected 4.x 
or 5.x, found: " 
++            raise UnpackerNotInstalled("Unsupported RAR version, expected 4.x 
or 5.x, found: "
+                     + signature.split(" ")[1])
+-                
+-                
++
++
+     def escaped_password(self):
+         return '-' if self.password == None else self.password
+-        
+-        
++
++
+     def call(self, cmd, options=[], files=[]):
+         options2 = options + ['p'+self.escaped_password()]
+         soptions = ['-'+x for x in options2]
+         return call_unrar([cmd]+soptions+['--',self.archiveName]+files)
+ 
+     def infoiter(self):
+-        
++
+         command = "v" if rar_executable_version == 4 else "l"
+         stdoutdata, stderrdata = self.call(command, ['c-']).communicate()
+-        
++
+         for line in stderrdata.splitlines():
+             if line.strip().startswith("Cannot open"):
+                 raise FileOpenError
+-            
++
+         accum = []
+         source = iter(stdoutdata.splitlines())
+         line = ''
+@@ -136,7 +136,7 @@ def infoiter(self):
+             if line.strip().endswith('is not RAR archive'):
+                 raise InvalidRARArchive
+             if line.startswith("CRC failed") or line.startswith("Checksum 
error"):
+-                raise IncorrectRARPassword  
++                raise IncorrectRARPassword
+             line = source.next()
+         line = source.next()
+         i = 0
+@@ -153,7 +153,11 @@ def infoiter(self):
+                     data['size'] = int(fields[0])
+                     attr = fields[5]
+                     data['isdir'] = 'd' in attr.lower()
+-                    data['datetime'] = time.strptime(fields[3]+" "+fields[4], 
'%d-%m-%y %H:%M')
++                    try:
++                        data['datetime'] = time.strptime(fields[3]+" 
"+fields[4], '%d-%m-%y %H:%M')
++                    except ValueError:
++                        data['datetime'] = time.strptime(fields[3]+" 
"+fields[4], '%Y-%m-%d %H:%M')
++
+                     data['comment'] = None
+                     data['volume'] = None
+                     yield data
+@@ -169,13 +173,16 @@ def infoiter(self):
+                 data['size'] = int(fields[1])
+                 attr = fields[0]
+                 data['isdir'] = 'd' in attr.lower()
+-                data['datetime'] = time.strptime(fields[2]+" "+fields[3], 
'%d-%m-%y %H:%M')
++                try:
++                    data['datetime'] = time.strptime(fields[2]+" "+fields[3], 
'%d-%m-%y %H:%M')
++                except ValueError:
++                    data['datetime'] = time.strptime(fields[2]+" "+fields[3], 
'%Y-%m-%d %H:%M')
+                 data['comment'] = None
+-              data['volume'] = None
++                data['volume'] = None
+                 yield data
+                 i += 1
+                 line = source.next()
+-            
++
+ 
+     def read_files(self, checker):
+         res = []
+@@ -184,9 +191,9 @@ def read_files(self, checker):
+             if checkres==True and not info.isdir:
+                 pipe = self.call('p', ['inul'], [info.filename]).stdout
+                 res.append((info, pipe.read()))
+-        return res            
++        return res
++
+ 
+-          
+     def extract(self, checker, path, withSubpath, overwrite):
+         res = []
+         command = 'x'
+@@ -211,27 +218,27 @@ def extract(self, checker, path, withSubpath, overwrite):
+         proc = self.call(command, options, names)
+         stdoutdata, stderrdata = proc.communicate()
+         if stderrdata.find("CRC failed")>=0 or stderrdata.find("Checksum 
error")>=0:
+-            raise IncorrectRARPassword  
+-        return res            
+-            
++            raise IncorrectRARPassword
++        return res
++
+     def destruct(self):
+         pass
+-        
++
+     def get_volume(self):
+         command = "v" if rar_executable_version == 4 else "l"
+         stdoutdata, stderrdata = self.call(command, ['c-']).communicate()
+-        
++
+         for line in stderrdata.splitlines():
+             if line.strip().startswith("Cannot open"):
+                 raise FileOpenError
+-            
++
+         source = iter(stdoutdata.splitlines())
+         line = ''
+         while not line.startswith('-----------'):
+             if line.strip().endswith('is not RAR archive'):
+                 raise InvalidRARArchive
+             if line.startswith("CRC failed") or line.startswith("Checksum 
error"):
+-                raise IncorrectRARPassword  
++                raise IncorrectRARPassword
+             line = source.next()
+         line = source.next()
+         if rar_executable_version == 4:
+@@ -243,7 +250,7 @@ def get_volume(self):
+                 return int(items[5]) - 1
+             else:
+                 return None
+-                
++
+         elif rar_executable_version == 5:
+             while not line.startswith('-----------'):
+                 line = source.next()
+@@ -253,5 +260,3 @@ def get_volume(self):
+                 return int(items[2]) - 1
+             else:
+                 return None
+-
+-    

diff --git a/dev-python/py-unrar2/py-unrar2-0.99.6.ebuild 
b/dev-python/py-unrar2/py-unrar2-0.99.6.ebuild
new file mode 100644
index 0000000..210b80c
--- /dev/null
+++ b/dev-python/py-unrar2/py-unrar2-0.99.6.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1
+
+DESCRIPTION="Improved Python wrapper around the free UnRAR.dll"
+HOMEPAGE="https://pypi.python.org/pypi/py-unrar2/ 
http://code.google.com/py-unrar2";
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="app-arch/unrar"
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-fix-tabs-and-unrar-version.patch" )
+
+python_prepare_all() {
+       # do not install crap
+       rm -rf UnRARDLL windows.py *.r* *.txt *~ *.html MANIFEST* *.orig *.bin 
.hg* *.swp || die
+       
+       distutils-r1_python_prepare_all
+}
+
+python_test() {
+       python test_UnRAR2.py || die
+}

Reply via email to