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

Skip to content

Commit 246beb2

Browse files
committed
Don't use tempfile.mktemp(), since it produces annoying warnings, and
usually isn't what we want anyway.
1 parent e20131e commit 246beb2

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Doc/tools/mkhowto

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import re
4343
import shutil
4444
import string
4545
import sys
46-
import tempfile
4746

4847

4948
if not hasattr(os.path, "abspath"):
@@ -265,10 +264,12 @@ class Job:
265264
self.log_filename = os.path.abspath(self.doc + ".how")
266265
if os.path.exists(self.log_filename):
267266
os.unlink(self.log_filename)
268-
if os.path.exists(self.doc + ".l2h"):
269-
self.l2h_aux_init_file = tempfile.mktemp()
270-
else:
271-
self.l2h_aux_init_file = self.doc + ".l2h"
267+
l2hconf = self.doc + ".l2h"
268+
if os.path.exists(l2hconf):
269+
if os.path.exists(l2hconf + "~"):
270+
os.unlink(l2hconf + "~")
271+
os.rename(l2hconf, l2hconf + "~")
272+
self.l2h_aux_init_file = self.doc + ".l2h"
272273
self.write_l2h_aux_init_file()
273274

274275
def build(self):

0 commit comments

Comments
 (0)