Open the file descriptor returned from mkstemp().

We get a file descriptor as returned by os.open() when calling
tempfile.mkstemp(), so we need to pass that value to os.fdopen()
before we can write text to it (easily, anyway).
This commit is contained in:
David Cantrell 2008-10-04 20:29:59 -10:00
parent 649e87ae5f
commit fcb8d0f1ab

View File

@ -113,7 +113,8 @@ def writeYumConf(cachedir=None, repo=None, extrarepos=[], mirrorlist=[]):
return None
tmpdir = tempfile.gettempdir()
(f, yumconf) = tempfile.mkstemp(prefix='yum.conf', dir=tmpdir)
(fd, yumconf) = tempfile.mkstemp(prefix='yum.conf', dir=tmpdir)
f = os.fdopen(fd, 'w')
f.write("[main]\n")
f.write("cachedir=%s\n" % (cachedir,))
@ -146,6 +147,7 @@ def writeYumConf(cachedir=None, repo=None, extrarepos=[], mirrorlist=[]):
n += 1
f.close()
fd.close()
return yumconf
def getBuildArch(yumconf=None):