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

Re: svn commit: r1741742 - in /subversion/trunk: contrib/client-side/svn-merge-vendor.py contrib/server-side/fsfsverify.py tools/server-side/svn-backup-dumps.py

From: Stefan Fuhrmann <stefan2_at_apache.org>
Date: Mon, 02 May 2016 07:02:33 +0200

On 30.04.2016 14:49, James McCoy wrote:
> On Sat, Apr 30, 2016 at 10:41:59AM -0000, stefan2_at_apache.org wrote:
>> Work towards Python 3 compatibility. Since we already require Python 2.7+,
>> we can use the new syntax without further limiting our Python 2 support.
>>
>> Fix leftovers to complete the replacement of print statements with function
>> calls.
>
> You didn't actually change the code to use the print function. The
> syntax just happens to work on Python 2.x because the () group the
> expression (like parens in math) but it's still a single expression
> provide to the print keyword.
>
> If you actually want to use the print function then you need to add:
>
> [[[
> from __future__ import print_function
> ]]]
>
> to the top of the Python files. That would also let you use print() for
> the writes to specific files.

You are right but for now, I'm fine with syntactic
compatibility.

My goal is to simply being able to run our build
and test scripts with Python 3. I don't plan on
switching over or even make it mandatory.

I expect the code to become "cleaner" by e.g.
using centralized functions and symbolic constants
instead of octals.

>> Modified: subversion/trunk/contrib/server-side/fsfsverify.py
>> URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/fsfsverify.py?rev=1741742&r1=1741741&r2=1741742&view=diff
>> ==============================================================================
>> --- subversion/trunk/contrib/server-side/fsfsverify.py (original)
>> +++ subversion/trunk/contrib/server-side/fsfsverify.py Sat Apr 30 10:41:59 2016
>> @@ -1136,7 +1136,7 @@ if __name__ == '__main__':
>> (options, args) = parser.parse_args()
>>
>> if len(args) != 1:
>> - print >>sys.stderr, "Please specify exactly one rev file."
>> + sys.stderr.write("Please specify exactly one rev file.\n")
>
> For example, this would change to:
>
> [[[
> from __future__ import print_function
> print('Please specify exactly one rev file.', file=sys.stderr)
> ]]]
>
> This also maintains the behavior of an automatic newline.

I went for the stream write because that's what we
already use in various places.

-- Stefan^2.
Received on 2016-05-02 07:02:19 CEST

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.