ePub: use None instead of an empty string.

This commit is contained in:
Thibaut Cuvelier 2021-02-07 20:52:50 +01:00
parent e95513c823
commit bf976cb0ae

View File

@ -31,9 +31,9 @@ class DocBookToEpub:
sys.exit(1)
self.own_path = sys.argv[0]
self.java_path = sys.argv[1] if sys.argv[1] != '' and sys.argv[1] != 'none' else ''
self.xsltproc_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else ''
self.xslt_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else ''
self.java_path = sys.argv[1] if sys.argv[1] != '' and sys.argv[1] != 'none' else None
self.xsltproc_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else None
self.xslt_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else None
self.input = sys.argv[4]
self.output = sys.argv[5]
self.script_folder = os.path.dirname(self.own_path) + '/../'
@ -50,7 +50,7 @@ class DocBookToEpub:
self.package_opf = self.output_dir + '/OEBPS/package.opf' # Does not exist yet,
print('Temporary output directory: %s' % self.output_dir)
if self.xslt_path == '':
if self.xslt_path is None:
self.xslt = self.script_folder + 'docbook/epub3/chunk.xsl'
else:
self.xslt = self.xslt_path + '/epub3/chunk.xsl'
@ -67,9 +67,9 @@ class DocBookToEpub:
def start_xslt_transformation(self):
command = None
if self.xsltproc_path != '':
if self.xsltproc_path is not None:
command = self.start_xslt_transformation_xsltproc()
elif self.java_path != '':
elif self.java_path is not None:
command = self.start_xslt_transformation_saxon6()
if command is None: