Mailinglist Archive: opensuse-buildservice (239 mails)

< Previous Next >
Re: [opensuse-buildservice] Re: [opensuse-svn] r7335 - in trunk/buildservice/src/clientlib/python/osc: . osc
  • From: Pavol Rusnak <prusnak@xxxxxxx>
  • Date: Fri, 15 May 2009 14:31:38 +0200
  • Message-id: <4A0D60AA.2000502@xxxxxxx>
Michal Čihař wrote:
Hi

Dne Fri, 15 May 2009 05:40:54 -0600 (MDT)
"Novell Forge SVN" <noreply@xxxxxxxxxxxxxxxx> napsal(a):

print 'Getting buildinfo from server'
- bi_file = NamedTemporaryFile(suffix='.xml', prefix='buildinfo.', dir =
'/tmp')
+ tempdir = '/tmp'
+ if sys.platform[:3] == 'win':
+ tempdir = os.getenv('TEMP')
+ bi_file = NamedTemporaryFile(suffix='.xml', prefix='buildinfo.', dir =
tempdir)

Would not be better to use tempfile.gettempdir() regardless current
platform?

My first version of the change just removed dir as optional parameter
(module should figure it out by itself what the tempdir is, regardless
of platform). But later in the code (function delete_tmpdir) there is an
explicit check if the path starts with '/tmp' and this couldn't be
guaranteed anymore (module could use '/var/tmp').

What do you think about rewriting the code so it doesn't explicitly set
tempdir in these calls and removing the check in delete_tmpdir ?


--
Best Regards / S pozdravom,

Pavol RUSNAK SUSE LINUX, s.r.o
Package Maintainer Lihovarska 1060/12
PGP 0xA6917144 19000 Praha 9, CR
prusnak[at]suse.cz http://www.suse.cz
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References