diff --git a/tldp/doctypes/docbooksgml.py b/tldp/doctypes/docbooksgml.py index 8c3c1e6..315c11a 100644 --- a/tldp/doctypes/docbooksgml.py +++ b/tldp/doctypes/docbooksgml.py @@ -117,11 +117,14 @@ class DocbookSGML(BaseDoctype, SignatureChecker): def cleaned_indexsgml(self): '''clean the junk from the output dir after building the index.sgml''' # -- be super cautious before removing a bunch of files - cwd = os.getcwd() - if not os.path.samefile(cwd, self.output.dirname): - logger.error("%s (cowardly) refusing to clean directory %s", cwd) - logger.error("%s expected to find %s", self.output.dirname) - return False + if not self.config.script: + cwd = os.getcwd() + if not os.path.samefile(cwd, self.output.dirname): + logger.error("%s (cowardly) refusing to clean directory %s", + self.source.stem, cwd) + logger.error("%s expected to find %s", + self.source.stem, self.output.dirname) + return False s = '''find . -mindepth 1 -maxdepth 1 -not -type d -delete -print''' return self.shellscript(s)