mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-11 03:55:45 +01:00
Removing polyglot getcwd and getenv
This commit is contained in:
@@ -27,7 +27,7 @@ from ebook_converter import prints, guess_type
|
||||
from ebook_converter.utils.cleantext import clean_ascii_chars, clean_xml_chars
|
||||
from ebook_converter.utils.config import tweaks
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
from ebook_converter.polyglot.builtins import iteritems, getcwd
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class Resource(object): # {{{
|
||||
:method:`href`
|
||||
'''
|
||||
|
||||
def __init__(self, href_or_path, basedir=getcwd(), is_path=True):
|
||||
def __init__(self, href_or_path, basedir=os.getcwd(), is_path=True):
|
||||
self.orig = href_or_path
|
||||
self._href = None
|
||||
self._basedir = basedir
|
||||
@@ -109,7 +109,7 @@ class Resource(object): # {{{
|
||||
if self._basedir:
|
||||
basedir = self._basedir
|
||||
else:
|
||||
basedir = getcwd()
|
||||
basedir = os.getcwd()
|
||||
if self.path is None:
|
||||
return self._href
|
||||
frag = ('#' + self.fragment) if self.fragment else ''
|
||||
@@ -400,7 +400,7 @@ class Guide(ResourceCollection): # {{{
|
||||
return ans + '/>'
|
||||
|
||||
@staticmethod
|
||||
def from_opf_guide(references, base_dir=getcwd()):
|
||||
def from_opf_guide(references, base_dir=os.getcwd()):
|
||||
coll = Guide()
|
||||
for ref in references:
|
||||
try:
|
||||
@@ -589,7 +589,7 @@ class OPF(object): # {{{
|
||||
author_link_map = MetadataField('author_link_map', is_dc=False,
|
||||
formatter=json.loads, renderer=dump_dict)
|
||||
|
||||
def __init__(self, stream, basedir=getcwd(), unquote_urls=True,
|
||||
def __init__(self, stream, basedir=os.getcwd(), unquote_urls=True,
|
||||
populate_spine=True, try_to_guess_cover=True, preparsed_opf=None, read_toc=True):
|
||||
self.try_to_guess_cover = try_to_guess_cover
|
||||
self.basedir = self.base_dir = basedir
|
||||
@@ -1756,7 +1756,7 @@ b'''\
|
||||
</package>
|
||||
'''
|
||||
)
|
||||
self.opf = OPF(self.stream, getcwd())
|
||||
self.opf = OPF(self.stream, os.getcwd())
|
||||
|
||||
def testReading(self, opf=None):
|
||||
if opf is None:
|
||||
@@ -1787,11 +1787,11 @@ b'''\
|
||||
self.opf.render()
|
||||
|
||||
def testCreator(self):
|
||||
opf = OPFCreator(getcwd(), self.opf)
|
||||
opf = OPFCreator(os.getcwd(), self.opf)
|
||||
buf = io.BytesIO()
|
||||
opf.render(buf)
|
||||
raw = buf.getvalue()
|
||||
self.testReading(opf=OPF(io.BytesIO(raw), getcwd()))
|
||||
self.testReading(opf=OPF(io.BytesIO(raw), os.getcwd()))
|
||||
|
||||
def testSmartUpdate(self):
|
||||
self.opf.smart_update(MetaInformation(self.opf))
|
||||
@@ -1818,7 +1818,7 @@ def test_user_metadata():
|
||||
}
|
||||
mi.set_all_user_metadata(um)
|
||||
raw = metadata_to_opf(mi)
|
||||
opfc = OPFCreator(getcwd(), other=mi)
|
||||
opfc = OPFCreator(os.getcwd(), other=mi)
|
||||
out = io.BytesIO()
|
||||
opfc.render(out)
|
||||
raw2 = out.getvalue()
|
||||
|
||||
Reference in New Issue
Block a user