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

Re: [PATCH] Error out with proper error message when using Python >= 3.0 (was: building SVN trunk on Windows fails on python gen-make.py)

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 22 Jul 2015 11:31:31 +0000

Stefan Hett wrote on Mon, Jul 20, 2015 at 16:59:08 +0200:
> Please note that while testing I also found 1.7/1.8 not working with
> Python 3.4.3 as well. Error (in both cases):
> File "gen-make.py", line 271
> except getopt.GetoptError, e:
> ^
> SyntaxError: invalid syntax
>

The 'except' comma syntax is supported by Python through 2.7 (inclusive)
and the 'except' 'as' syntax is supported by Python 2.6 and newer.
Currently, trunk advertises support for Python 2.5 and newer (so, in
particular, so do the older branches).

So, I think we should:

- For 1.7/1.8, if we expect people will try to build them with py3,
  we can apply the patch. (The patch is correct; we must remain
  compatible with py2.5 on those branches; and we can't easily be
  compatible with py3 at the same time.)

- For trunk, I think we should convert to the 'except' 'as' syntax and
  drop py2.5 support. (Actually, we could drop py2.6 support as well,
  as py2.6 has been EOL for nearly two years now.)

- For 1.9, it's a little late to make any changes, but I would consider
  dropping py2.5 support (and converting to the 'except' 'as' syntax),
  since for 1.9 py3 support is more important than py2.5 support.

Thoughts?

Daniel

-- 
References:
[py2.5 'except' syntax] https://docs.python.org/2.5/ref/try.html
[py2.6 'except' syntax] https://docs.python.org/2.6/reference/compound_stmts.html#the-try-statement
[py2.6 EOL] https://www.python.org/dev/peps/pep-0361/
> So I guess it might be worthwhile adding some check there too?
> 
> [[[
>    Detect Python >= 3.0 and error out in gen-make.py (rather than
> producing some cryptic error/callstack).
> 
>    * gen-make.py
>       (): Add python version check >= 3.0 and error out.
> ]]]
> 
> Regards,
> Stefan
> Index: gen-make.py
> ===================================================================
> --- gen-make.py	(revision 1691913)
> +++ gen-make.py	(working copy)
> @@ -28,6 +28,10 @@
>  import traceback
>  import sys
>  
> +if sys.hexversion >= 0x03000000:
> +  print("Python >= 3.0 not supported. Please use Python >= 2.5 and < 3.0")
> +  sys.exit(2)
> +
>  import getopt
>  try:
>    my_getopt = getopt.gnu_getopt
Received on 2015-07-22 13:31:49 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.