create BaseDoctype with features needed by all

each document processor will need to know about its
sources, outputs and the platform details
the generate() method is a temporary model for operation
This commit is contained in:
Martin A. Brown 2016-02-15 13:58:32 -08:00
parent 169d6872f6
commit f1c40c1e8c
1 changed files with 23 additions and 0 deletions

View File

@ -2,6 +2,7 @@
from __future__ import absolute_import, division, print_function
import os
from ..utils import logger
@ -22,5 +23,27 @@ class SignatureChecker(object):
sig, f.name, cls.__name__)
return None
class BaseDoctype(object):
def __init__(self, *args, **kwargs):
self.source = kwargs.get('source')
self.output = kwargs.get('output')
self.platform = kwargs.get('platform')
self.logdir = os.path.join(self.output.dirname, 'logs')
if os.path.exists(self.logdir):
logger.warning("Found existing logs directory: %s", self.logdir)
else:
os.mkdir(self.logdir)
def generate(self):
os.chdir(self.output.dirname)
self.output.clear()
self.platform_check()
self.create_htmls()
self.create_pdf()
self.create_txt()
self.create_html()
#
# -- end of file