@@ -47,6 +47,7 @@ import tempfile
4747
4848
4949if not hasattr (os .path , "abspath" ):
50+ # Python 1.5.1 or earlier
5051 def abspath (path ):
5152 """Return an absolute path."""
5253 if not os .path .isabs (path ):
@@ -214,6 +215,8 @@ class Options:
214215 os .path .join (TOPDIR , "paper-" + self .paper ),
215216 os .path .join (TOPDIR , "texinputs" ),
216217 ] + texinputs
218+ if self .builddir :
219+ self .builddir = os .path .abspath (self .builddir )
217220
218221
219222class Job :
@@ -223,7 +226,10 @@ class Job:
223226 self .options = options
224227 self .doctype = get_doctype (path )
225228 self .filedir , self .doc = split_pathname (path )
226- self .log_filename = self .doc + ".how"
229+ 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" )
227233 if os .path .exists (self .log_filename ):
228234 os .unlink (self .log_filename )
229235 if os .path .exists (self .doc + ".l2h" ):
@@ -243,7 +249,7 @@ class Job:
243249 self .build_ps ()
244250 if "html" in formats :
245251 self .require_temps ()
246- self .build_html (self .options . builddir or self . doc )
252+ self .build_html (self .builddir )
247253 if self .options .icon_server == "." :
248254 pattern = os .path .join (TOPDIR , "html" , "icons" ,
249255 "*." + self .options .image_type )
@@ -346,7 +352,7 @@ class Job:
346352
347353 def build_html (self , builddir = None , max_split_depth = None ):
348354 if builddir is None :
349- builddir = self .doc
355+ builddir = self .builddir
350356 if max_split_depth is None :
351357 max_split_depth = self .options .max_split_depth
352358 texfile = None
@@ -520,7 +526,7 @@ def safe_unlink(path):
520526
521527
522528def split_pathname (path ):
523- path = os .path .normpath ( os . path . join ( os . getcwd (), path ) )
529+ path = os .path .abspath ( path )
524530 dirname , basename = os .path .split (path )
525531 if basename [- 4 :] == ".tex" :
526532 basename = basename [:- 4 ]
0 commit comments