mirror of
https://github.com/ciromattia/kcc
synced 2025-12-18 12:11:46 +00:00
Merge branch 'master' into kcc-panelview
This commit is contained in:
@@ -73,7 +73,7 @@ __all__ = ['is_rarfile', 'RarInfo', 'RarFile', 'RarExtFile']
|
|||||||
## Imports and compat - support both Python 2.x and 3.x
|
## Imports and compat - support both Python 2.x and 3.x
|
||||||
##
|
##
|
||||||
|
|
||||||
import sys, os, struct
|
import sys, os, struct, errno
|
||||||
from struct import pack, unpack
|
from struct import pack, unpack
|
||||||
from binascii import crc32
|
from binascii import crc32
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
@@ -320,6 +320,8 @@ class RarMemoryError(RarExecError):
|
|||||||
"""Memory error"""
|
"""Memory error"""
|
||||||
class RarCreateError(RarExecError):
|
class RarCreateError(RarExecError):
|
||||||
"""Create error"""
|
"""Create error"""
|
||||||
|
class RarNoFilesError(RarExecError):
|
||||||
|
"""No files that match pattern were found"""
|
||||||
class RarUserBreak(RarExecError):
|
class RarUserBreak(RarExecError):
|
||||||
"""User stop"""
|
"""User stop"""
|
||||||
class RarUnknownError(RarExecError):
|
class RarUnknownError(RarExecError):
|
||||||
@@ -1757,8 +1759,15 @@ def custom_popen(cmd):
|
|||||||
creationflags = 0x08000000 # CREATE_NO_WINDOW
|
creationflags = 0x08000000 # CREATE_NO_WINDOW
|
||||||
|
|
||||||
# run command
|
# run command
|
||||||
p = Popen(cmd, bufsize = 0, stdout = PIPE, stdin = PIPE, stderr = STDOUT,
|
try:
|
||||||
|
p = Popen(cmd, bufsize = 0,
|
||||||
|
stdout = PIPE, stdin = PIPE, stderr = STDOUT,
|
||||||
creationflags = creationflags)
|
creationflags = creationflags)
|
||||||
|
except OSError:
|
||||||
|
ex = sys.exc_info()[1]
|
||||||
|
if ex.errno == errno.ENOENT:
|
||||||
|
raise RarExecError("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
|
||||||
|
raise
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def check_returncode(p, out):
|
def check_returncode(p, out):
|
||||||
@@ -1772,7 +1781,7 @@ def check_returncode(p, out):
|
|||||||
errmap = [None,
|
errmap = [None,
|
||||||
RarWarning, RarFatalError, RarCRCError, RarLockedArchiveError,
|
RarWarning, RarFatalError, RarCRCError, RarLockedArchiveError,
|
||||||
RarWriteError, RarOpenError, RarUserError, RarMemoryError,
|
RarWriteError, RarOpenError, RarUserError, RarMemoryError,
|
||||||
RarCreateError] # codes from rar.txt
|
RarCreateError, RarNoFilesError] # codes from rar.txt
|
||||||
if code > 0 and code < len(errmap):
|
if code > 0 and code < len(errmap):
|
||||||
exc = errmap[code]
|
exc = errmap[code]
|
||||||
elif code == 255:
|
elif code == 255:
|
||||||
|
|||||||
Reference in New Issue
Block a user