mirror of https://github.com/tLDP/python-tldp
adding OutputDir to outputs.py
This commit is contained in:
parent
5adbb9af4c
commit
035ff36afb
|
@ -1,20 +1,39 @@
|
|||
#! /usr/bin/python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
def getLogger(opts):
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
|
||||
logger = logging.getLogger()
|
||||
return logger
|
||||
from .utils import logger
|
||||
|
||||
class SourceDocument(object):
|
||||
|
||||
def __init__(self, filename):
|
||||
self.filename = fname
|
||||
self.stem =
|
||||
class OutputDir(object):
|
||||
|
||||
def __init__(self, dirname):
|
||||
self.dirname = os.path.abspath(dirname)
|
||||
self.stem = os.path.basename(dirname)
|
||||
self.members = list()
|
||||
|
||||
def mkdir(self):
|
||||
if not os.path.exists(self.parent):
|
||||
raise OSError("Missing parent directory: " + self.parent)
|
||||
os.mkdir(self.dirname)
|
||||
|
||||
@property
|
||||
def txt_name(self):
|
||||
return os.path.join(self.dirname, self.stem, '.txt')
|
||||
|
||||
@property
|
||||
def pdf_name(self):
|
||||
return os.path.join(self.dirname, self.stem, '.pdf')
|
||||
|
||||
@property
|
||||
def html_name(self):
|
||||
return os.path.join(self.dirname, self.stem, '.html')
|
||||
|
||||
@property
|
||||
def htmls_name(self):
|
||||
return os.path.join(self.dirname, self.stem, '-single.html')
|
||||
|
||||
def
|
||||
|
||||
# -- end of file
|
||||
|
|
Loading…
Reference in New Issue