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

Removed check for python version

This commit is contained in:
2020-04-21 21:06:48 +02:00
parent 3234e4de27
commit de4f8a444b
21 changed files with 54 additions and 246 deletions

View File

@@ -1,7 +1,7 @@
import copy, traceback
from ebook_converter import prints
from ebook_converter.constants import DEBUG, ispy3
from ebook_converter.constants import DEBUG
from ebook_converter.ebooks.metadata.book import (SC_COPYABLE_FIELDS,
SC_FIELDS_COPY_NOT_NULL, STANDARD_METADATA_FIELDS,
TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS)
@@ -789,13 +789,7 @@ class Metadata(object):
ans[i] = '<tr><td><b>%s</b></td><td>%s</td></tr>'%x
return '<table>%s</table>'%'\n'.join(ans)
if ispy3:
__str__ = __unicode__representation__
else:
__unicode__ = __unicode__representation__
def __str__(self):
return self.__unicode__().encode('utf-8')
__str__ = __unicode__representation__
def __nonzero__(self):
return bool(self.title or self.author or self.comments or self.tags)

View File

@@ -16,7 +16,7 @@ import uuid
from lxml import etree
from ebook_converter.ebooks import escape_xpath_attr
from ebook_converter.constants import __appname__, __version__, filesystem_encoding, ispy3
from ebook_converter.constants import __appname__, __version__, filesystem_encoding
from ebook_converter.ebooks.metadata.toc import TOC
from ebook_converter.ebooks.metadata.utils import parse_opf, pretty_print_opf as _pretty_print
from ebook_converter.ebooks.metadata import string_to_authors, MetaInformation, check_isbn
@@ -212,13 +212,7 @@ class ManifestItem(Resource): # {{{
def __unicode__representation__(self):
return u'<item id="%s" href="%s" media-type="%s" />'%(self.id, self.href(), self.media_type)
if ispy3:
__str__ = __unicode__representation__
else:
__unicode__ = __unicode__representation__
def __str__(self):
return str(self).encode('utf-8')
__str__ = __unicode__representation__
def __repr__(self):
return str(self)

View File

@@ -5,7 +5,7 @@ import os, subprocess, shutil, re
from functools import partial
from ebook_converter import prints
from ebook_converter.constants import iswindows, ispy3
from ebook_converter.constants import iswindows
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.ebooks.metadata import (
MetaInformation, string_to_authors, check_isbn, check_doi)
@@ -101,8 +101,6 @@ def page_images(pdfpath, outputdir='.', first=1, last=1, image_format='jpeg', pr
def is_pdf_encrypted(path_to_pdf):
if not ispy3 and not isinstance(path_to_pdf, bytes):
path_to_pdf = path_to_pdf.encode('mbcs' if iswindows else 'utf-8')
pdfinfo = get_tools()[0]
raw = subprocess.check_output([pdfinfo, path_to_pdf])
q = re.search(br'^Encrypted:\s*(\S+)', raw, flags=re.MULTILINE)