Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aebbca3

Browse files
committed
Job.__init__(): Only create the builddir directory if it will be used (by
building the HTML or text documentation). There is no need to create it for other formats. Job.build_html(): The builddir parameter is always passed in, so it need not be optional.
1 parent 1b776a2 commit aebbca3

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Doc/tools/mkhowto

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,12 @@ class Job:
227227
self.doctype = get_doctype(path)
228228
self.filedir, self.doc = split_pathname(path)
229229
self.builddir = os.path.abspath(options.builddir or self.doc)
230-
if not os.path.exists(self.builddir):
231-
os.mkdir(self.builddir)
232-
self.log_filename = os.path.join(self.builddir, self.doc + ".how")
230+
if ("html" in options.formats or "text" in options.formats):
231+
if not os.path.exists(self.builddir):
232+
os.mkdir(self.builddir)
233+
self.log_filename = os.path.join(self.builddir, self.doc + ".how")
234+
else:
235+
self.log_filename = os.path.abspath(self.doc + ".how")
233236
if os.path.exists(self.log_filename):
234237
os.unlink(self.log_filename)
235238
if os.path.exists(self.doc + ".l2h"):
@@ -350,9 +353,7 @@ class Job:
350353
def build_ps(self):
351354
self.run("%s -N0 -o %s.ps %s" % (DVIPS_BINARY, self.doc, self.doc))
352355

353-
def build_html(self, builddir=None, max_split_depth=None):
354-
if builddir is None:
355-
builddir = self.builddir
356+
def build_html(self, builddir, max_split_depth=None):
356357
if max_split_depth is None:
357358
max_split_depth = self.options.max_split_depth
358359
texfile = None

0 commit comments

Comments
 (0)