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

Requiring python 2.7 (Was: RE: svn commit: r1741742 - in /subversion/trunk:contrib/client-side/svn-merge-vendor.py contrib/server-side/fsfsverify.pytools/server-side/svn-backup-dumps.py)

From: Bert Huijben <bert_at_qqmail.nl>
Date: Mon, 2 May 2016 09:55:52 +0200

I haven’t reviewed the entire series yet, but where did we discuss requiring python 2.7 for everything?

I remember that we required a newer python for the test suite and some of the release scripts, but we explicitly didn’t include other parts then.

I’m pretty sure we break some legacy platforms if we change things for swig, and some of the installed python scripts.

Bert

Sent from Mail for Windows 10

From: Stefan Fuhrmann
Sent: maandag 2 mei 2016 07:02
To: dev_at_subversion.apache.org
Subject: Re: svn commit: r1741742 - in /subversion/trunk:contrib/client-side/svn-merge-vendor.py contrib/server-side/fsfsverify.pytools/server-side/svn-backup-dumps.py

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 09:56:05 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.