[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix gen-make.py Python 1.5.2 compatability

From: David Summers <david_at_summersoft.fay.ar.us>
Date: 2004-01-19 17:51:20 CET

kfogel@collab.net wrote:

>subversion@millenix.mailshell.com writes:
>
>
>>David Summers wrote:
>>
>>
>>>* gen-make.py : Fix issue with Python 1.5.2 compatability.
>>>Index: gen-make.py
>>>===================================================================
>>>--- gen-make.py (revision 8372)
>>>+++ gen-make.py (working copy)
>>>@@ -156,9 +156,9 @@
>>> # Remember all options so other scripts can use them
>>> opt_conf = open('gen-make.opts', 'w')
>>>- print >> opt_conf, "[options]"
>>>+ opt_conf.write( '[options]' )
>>> for opt, val in rest.list:
>>>- print >> opt_conf, opt, '=', val
>>>+ opt_conf.writeline( opt, '=', val )
>>> opt_conf.close()
>>> if gentype not in gen_modules.keys():
>>>
>>>
>>This patch cannot possibly be correct. To replace a single construct
>>("print >> opt_conf"), you use 2 different new constructs,
>>opt_conf.write() and opt_conf.writeline(). Which is it?
>>Perhaps someone with python experience can clear this up.
>>
>>
>
>Careful throwing around words like "cannot possibly" :-). The patch
>is not correct, but not for the reasons you imply. See
>
> http://www.python.org/doc/1.5.2p2/lib/typesother.html#l2h-69
>
>Summary: write() writes one string to the file, writelines() takes a
>list of strings.
>
>There are bugs here, though. Neither write() nor writelines() has
>print's auto-padding behavior, so any spaces and newlines need to be
>included explicitly. David, try
>
> opt_conf.write( '[options]\n' )
>
>and
>
> opt_conf.writelines( opt, '=', val, '\n' )
>
>(According to the above web page, it's "writelines" not "writeline".
>Did you test your patch?)
>
>
>
I tested it by building the RPM and the RPM built. That is probably not
a good test in this case because I don't think any options are being
written out on my platform, using that loop.

   - David

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 19 17:51:58 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.