[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: James McCoy <jamessan_at_jamessan.com>
Date: Sat, 30 Apr 2016 08:49:46 -0400

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.

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

Cheers,

-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan_at_jamessan.com>
Received on 2016-04-30 14:49:59 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.