1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-19 12:43:35 +02:00

Removed Windows bits.

This commit is contained in:
2020-06-17 19:23:52 +02:00
parent cd93b85eb0
commit 1a09e3db84
34 changed files with 147 additions and 820 deletions

View File

@@ -8,7 +8,6 @@ import os
import re
import shutil
import sys
import time
import unicodedata
import urllib.parse
import uuid
@@ -18,7 +17,6 @@ from lxml import etree
from ebook_converter import constants as const
from ebook_converter import CurrentDir, walk
from ebook_converter.constants_old import iswindows
from ebook_converter.customize.ui import plugin_for_input_format, plugin_for_output_format
from ebook_converter.ebooks import escape_xpath_attr
from ebook_converter.ebooks.chardet import xml_to_unicode
@@ -109,10 +107,7 @@ def href_to_name(href, root, base=None):
if purl.scheme or not purl.path:
return None
href = oeb_base.urlunquote(purl.path)
if iswindows and ':' in href:
# path manipulations on windows fail for paths with : in them, so we
# assume all such paths are invalid/absolute paths.
return None
fullpath = os.path.join(base, *href.split('/'))
return unicodedata.normalize('NFC', abspath_to_name(fullpath, root))
@@ -1040,10 +1035,8 @@ class Container(ContainerBase): # {{{
try:
os.unlink(path)
except EnvironmentError:
if not iswindows:
raise
time.sleep(1) # Wait for whatever has locked the file to release it
os.unlink(path)
raise
os.rename(temp, path)
return path

View File

@@ -9,7 +9,6 @@ from xml.sax import saxutils
from ebook_converter import constants as const
from ebook_converter.utils import date
from ebook_converter.constants_old import iswindows
from ebook_converter.ebooks.oeb import base
from ebook_converter.ebooks.oeb.base import XPath, xml2text, urlnormalize
from ebook_converter.library.comments import comments_to_html, markdown
@@ -419,7 +418,5 @@ def referenced_images(root):
src = img.get('src')
if src.startswith('file://'):
path = src[7:]
if iswindows and path.startswith('/'):
path = path[1:]
if os.path.exists(path):
yield img, path