1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-01-03 01:04:12 +01:00

Removing polyglot getcwd and getenv

This commit is contained in:
2020-04-20 20:33:25 +02:00
parent c867f0321b
commit 3ca3f08054
29 changed files with 89 additions and 99 deletions

View File

@@ -5,7 +5,7 @@ from ebook_converter.constants import isosx, isfrozen, filesystem_encoding, ispy
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 iteritems, environ_item, native_string_type, getcwd
from ebook_converter.polyglot.builtins import iteritems, environ_item, native_string_type
from ebook_converter.polyglot.binary import as_hex_unicode
try:
import win32process
@@ -183,7 +183,7 @@ class Worker(object):
exe = self.gui_executable if self.gui else self.executable
env = self.env
try:
origwd = cwd or os.path.abspath(getcwd())
origwd = cwd or os.path.abspath(os.getcwd())
except EnvironmentError:
# cwd no longer exists
origwd = cwd or os.path.expanduser('~')

View File

@@ -9,7 +9,7 @@ from struct import calcsize, unpack, pack
from collections import namedtuple, OrderedDict
from tempfile import SpooledTemporaryFile
from ebook_converter.polyglot.builtins import itervalues, getcwd
from ebook_converter.polyglot.builtins import itervalues
__license__ = 'GPL v3'
@@ -243,7 +243,7 @@ def extractall(path_or_stream, path=None):
f = open(f, 'rb')
close_at_end = True
if path is None:
path = getcwd()
path = os.getcwd()
pos = f.tell()
try:
_extractall(f, path)
@@ -290,7 +290,7 @@ class LocalZipFile(object):
def extractall(self, path=None):
self.stream.seek(0)
_extractall(self.stream, path=(path or getcwd()))
_extractall(self.stream, path=(path or os.getcwd()))
def close(self):
pass

View File

@@ -10,7 +10,7 @@ from tempfile import SpooledTemporaryFile
from ebook_converter import sanitize_file_name
from ebook_converter.constants import filesystem_encoding
from ebook_converter.ebooks.chardet import detect
from ebook_converter.polyglot.builtins import getcwd, as_bytes
from ebook_converter.polyglot.builtins import as_bytes
try:
import zlib # We may need its compression method
@@ -1085,7 +1085,7 @@ class ZipFile:
member = self.getinfo(member)
if path is None:
path = getcwd()
path = os.getcwd()
return self._extract_member(member, path, pwd)