[svn r38828] Try harder to get the logic right to avoid regenerating html files for
unmodified txts. --HG-- branch : trunk
This commit is contained in:
parent
96355656ce
commit
79a17fa4ef
|
@ -126,12 +126,16 @@ class Project:
|
||||||
def get_docpath(self):
|
def get_docpath(self):
|
||||||
return get_docpath()
|
return get_docpath()
|
||||||
|
|
||||||
|
def get_htmloutputpath(self, txtpath):
|
||||||
|
docpath = self.get_docpath()
|
||||||
|
reloutputpath = txtpath.new(ext='.html').relto(self.mydir)
|
||||||
|
return docpath.join(reloutputpath)
|
||||||
|
|
||||||
def process(self, txtpath):
|
def process(self, txtpath):
|
||||||
encoding = self.encoding
|
encoding = self.encoding
|
||||||
content = self.get_content(txtpath, encoding)
|
content = self.get_content(txtpath, encoding)
|
||||||
docpath = self.get_docpath()
|
docpath = self.get_docpath()
|
||||||
reloutputpath = txtpath.new(ext='.html').relto(self.mydir)
|
outputpath = self.get_htmloutputpath(txtpath)
|
||||||
outputpath = docpath.join(reloutputpath)
|
|
||||||
|
|
||||||
stylesheet = self.stylesheet
|
stylesheet = self.stylesheet
|
||||||
if isinstance(self.stylesheet, py.path.local):
|
if isinstance(self.stylesheet, py.path.local):
|
||||||
|
|
|
@ -73,7 +73,6 @@ def restcheck(path):
|
||||||
localpath = path
|
localpath = path
|
||||||
if hasattr(path, 'localpath'):
|
if hasattr(path, 'localpath'):
|
||||||
localpath = path.localpath
|
localpath = path.localpath
|
||||||
_checkskip(localpath)
|
|
||||||
checkdocutils()
|
checkdocutils()
|
||||||
import docutils.utils
|
import docutils.utils
|
||||||
|
|
||||||
|
@ -82,11 +81,14 @@ def restcheck(path):
|
||||||
for x in cur.parts(reverse=True):
|
for x in cur.parts(reverse=True):
|
||||||
confrest = x.dirpath('confrest.py')
|
confrest = x.dirpath('confrest.py')
|
||||||
if confrest.check(file=1):
|
if confrest.check(file=1):
|
||||||
confrest = confrest.pyimport()
|
confrest = confrest.pyimport()
|
||||||
confrest.Project().process(path)
|
project = confrest.Project()
|
||||||
|
_checkskip(path, project.get_htmloutputpath(path))
|
||||||
|
project.process(path)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# defer to default processor
|
# defer to default processor
|
||||||
|
_checkskip(path)
|
||||||
rest.process(path)
|
rest.process(path)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
|
@ -94,10 +96,10 @@ def restcheck(path):
|
||||||
# we assume docutils printed info on stdout
|
# we assume docutils printed info on stdout
|
||||||
py.test.fail("docutils processing failed, see captured stderr")
|
py.test.fail("docutils processing failed, see captured stderr")
|
||||||
|
|
||||||
def _checkskip(lpath):
|
def _checkskip(lpath, htmlpath=None):
|
||||||
if not option.forcegen:
|
if not option.forcegen:
|
||||||
if lpath.ext == '.txt':
|
if lpath.ext == '.txt':
|
||||||
htmlpath = get_docpath().join(lpath.new(ext='.html').relto(mypath))
|
htmlpath = htmlpath or lpath.new(ext='.html')
|
||||||
if htmlpath.check(file=1) and htmlpath.mtime() >= lpath.mtime():
|
if htmlpath.check(file=1) and htmlpath.mtime() >= lpath.mtime():
|
||||||
py.test.skip("html file is up to date, use --forcegen to regenerate")
|
py.test.skip("html file is up to date, use --forcegen to regenerate")
|
||||||
#return [] # no need to rebuild
|
#return [] # no need to rebuild
|
||||||
|
@ -105,7 +107,6 @@ def _checkskip(lpath):
|
||||||
class ReSTSyntaxTest(py.test.collect.Item):
|
class ReSTSyntaxTest(py.test.collect.Item):
|
||||||
def run(self):
|
def run(self):
|
||||||
mypath = self.fspath
|
mypath = self.fspath
|
||||||
_checkskip(mypath)
|
|
||||||
restcheck(py.path.svnwc(mypath))
|
restcheck(py.path.svnwc(mypath))
|
||||||
|
|
||||||
class DoctestText(py.test.collect.Item):
|
class DoctestText(py.test.collect.Item):
|
||||||
|
|
Loading…
Reference in New Issue