You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Summers <da...@summersoft.fay.ar.us> on 2004/01/18 19:09:25 UTC

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

Not knowing hardly any python, here is my first attempt at a patch to 
gen-make.py to bring it back to Python 1.5.2 compatability.  This fixes 
the bug introduced in r8109.  This bug was keeping the RedHat 7.3 RPM from 
being built.

Log:
====
* 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():


-- 
David Wayne Summers          "Linux: Because reboots are for hardware upgrades!"
david@summersoft.fay.ar.us   PGP Key: http://summersoft.fay.ar.us/~david/pgp.txt
PGP Key fingerprint =  C0 E0 4F 50 DD A9 B6 2B  60 A1 31 7E D2 28 6D A8 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Branko Čibej <br...@xbc.nu>.
David Summers wrote:

> 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.

If you look carefully, you'll see that the only bit of code that
currently uses gen-make.opts is in win-tests.py. So no wonder your RPM
built with no errors.

Anyway, I committed a correct fix in r8382.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by David Summers <da...@summersoft.fay.ar.us>.
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

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

Posted by kf...@collab.net.
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?)

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by su...@millenix.mailshell.com.
David Summers wrote:
> Not knowing hardly any python, here is my first attempt at a patch to 
> gen-make.py to bring it back to Python 1.5.2 compatability.  This fixes 
> the bug introduced in r8109.  This bug was keeping the RedHat 7.3 RPM from 
> being built.
> 
> Log:
> ====
> * 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.

Philip Miller


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org