subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James McCoy <james...@jamessan.com>
Subject 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
Date Sat, 30 Apr 2016 12:49:46 GMT
On Sat, Apr 30, 2016 at 10:41:59AM -0000, stefan2@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@jamessan.com>

Mime
View raw message