1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 13:33:33 +02:00

Removed patheq function

This commit is contained in:
2020-06-14 16:09:08 +02:00
parent dd60a1cd26
commit 372899739d
2 changed files with 23 additions and 47 deletions

View File

@@ -45,14 +45,6 @@ def to_unicode(raw, encoding='utf-8', errors='strict'):
return raw.decode(encoding, errors)
def patheq(p1, p2):
p = os.path
d = lambda x : p.normcase(p.normpath(p.realpath(p.normpath(x))))
if not p1 or not p2:
return False
return d(p1) == d(p2)
def unicode_path(path, abs=False):
if isinstance(path, bytes):
path = path.decode(filesystem_encoding)
@@ -61,15 +53,6 @@ def unicode_path(path, abs=False):
return path
def osx_version():
if isosx:
import platform
src = platform.mac_ver()[0]
m = re.match(r'(\d+)\.(\d+)\.(\d+)', src)
if m:
return int(m.group(1)), int(m.group(2)), int(m.group(3))
def confirm_config_name(name):
return name + '_again'
@@ -107,21 +90,21 @@ def sanitize_file_name(name, substitute='_'):
def prints(*args, **kwargs):
'''
"""
Print unicode arguments safely by encoding them to preferred_encoding
Has the same signature as the print function from Python 3, except for the
additional keyword argument safe_encode, which if set to True will cause the
function to use repr when encoding fails.
Returns the number of bytes written.
'''
"""
file = kwargs.get('file', sys.stdout)
file = getattr(file, 'buffer', file)
enc = 'utf-8' if os.getenv('CALIBRE_WORKER') else preferred_encoding
sep = kwargs.get('sep', ' ')
sep = kwargs.get('sep', ' ')
if not isinstance(sep, bytes):
sep = sep.encode(enc)
end = kwargs.get('end', '\n')
end = kwargs.get('end', '\n')
if not isinstance(end, bytes):
end = end.encode(enc)
safe_encode = kwargs.get('safe_encode', False)
@@ -175,10 +158,6 @@ def prints(*args, **kwargs):
return count
class CommandLineError(Exception):
pass
def setup_cli_handlers(logger, level):
import logging
if os.getenv('CALIBRE_WORKER') and logger.handlers: