mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-01-21 12:34:10 +01:00
Get rid of environ_item function
This commit is contained in:
@@ -5,7 +5,6 @@ import locale
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ebook_converter.polyglot.builtins import environ_item
|
||||
|
||||
__appname__ = 'calibre'
|
||||
numeric_version = (4, 12, 0)
|
||||
@@ -40,7 +39,7 @@ is64bit = sys.maxsize > (1 << 32)
|
||||
isworker = any([os.getenv('CALIBRE_WORKER') or
|
||||
os.getenv('CALIBRE_SIMPLE_WORKER')])
|
||||
if isworker:
|
||||
os.environ.pop(environ_item('CALIBRE_FORCE_ANSI'), None)
|
||||
os.environ.pop('CALIBRE_FORCE_ANSI', None)
|
||||
FAKE_PROTOCOL, FAKE_HOST = 'clbr', 'internal.invalid'
|
||||
VIEWER_APP_UID = 'com.calibre-ebook.viewer'
|
||||
EDITOR_APP_UID = 'com.calibre-ebook.edit-book'
|
||||
|
||||
@@ -20,12 +20,6 @@ def error_message(exc):
|
||||
return str(exc)
|
||||
|
||||
|
||||
def environ_item(x):
|
||||
if isinstance(x, bytes):
|
||||
x = x.decode('utf-8')
|
||||
return x
|
||||
|
||||
|
||||
def exec_path(path, ctx=None):
|
||||
ctx = ctx or {}
|
||||
with open(path, 'rb') as f:
|
||||
|
||||
@@ -5,7 +5,6 @@ from ebook_converter.constants_old import isosx, isfrozen, filesystem_encoding
|
||||
from ebook_converter.utils.config import prefs
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile, base_dir
|
||||
from ebook_converter.utils.serialize import msgpack_dumps
|
||||
from ebook_converter.polyglot.builtins import environ_item
|
||||
from ebook_converter.polyglot.binary import as_hex_unicode
|
||||
try:
|
||||
import win32process
|
||||
@@ -83,10 +82,11 @@ class Worker(object):
|
||||
|
||||
@property
|
||||
def env(self):
|
||||
__import__('pdb').set_trace()
|
||||
env = os.environ.copy()
|
||||
env['CALIBRE_WORKER'] = environ_item('1')
|
||||
env['CALIBRE_WORKER'] = '1'
|
||||
td = as_hex_unicode(msgpack_dumps(base_dir()))
|
||||
env['CALIBRE_WORKER_TEMP_DIR'] = environ_item(td)
|
||||
env['CALIBRE_WORKER_TEMP_DIR'] = td
|
||||
env.update(self._env)
|
||||
return env
|
||||
|
||||
@@ -149,7 +149,7 @@ class Worker(object):
|
||||
except EnvironmentError:
|
||||
# cwd no longer exists
|
||||
origwd = cwd or os.path.expanduser('~')
|
||||
env['ORIGWD'] = environ_item(as_hex_unicode(msgpack_dumps(origwd)))
|
||||
env['ORIGWD'] = as_hex_unicode(msgpack_dumps(origwd))
|
||||
_cwd = cwd
|
||||
if priority is None:
|
||||
priority = prefs['worker_process_priority']
|
||||
|
||||
Reference in New Issue
Block a user