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

[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: Stefan Hett <stefan_at_egosoft.com>
Date: Mon, 20 Jul 2015 16:59:08 +0200

> [ moved from users@ to dev@; tldr: trunk gen-make.py fails with py3.4/windows ]
> Stefan Hett wrote on Mon, Jun 22, 2015 at 15:12:31 +0200:
>>> On Mon, Jun 22, 2015 at 12:45 PM, Stefan Hett <stefan_at_egosoft.com> wrote:
>>>> File "E:\Python34\lib\encodings\cp1252.py", line 23, in decode return
>>>> codecs.charmap_decode(input,self.errors,decoding_table)[0]
>>>> UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2116:
>>>> character maps to <undefined>
>>> Quick shot: perhaps it's related to the Python version. I'm using
>>> Python 2.7. Can you try that?
>> Hi Johan,
>> thanks for the hint. That indeed seemed to have been the problem.
>> Passes through the python script now when using Python 2.7.10.
>> Regards,
>> Stefan
> Two things about that error:
> 1. The file that triggers it is probably
> subversion/tests/cmdline/upgrade_tests_data/upgrade_with_externals.tar.bz2
> (it has a 0x81 byte at the given offset). It's a binary file so it
> shouldn't be fed to a unicode decoder in the first place. It's only
> used by some unit tests.
> 2. I went through autogen.sh/configure on Python 3 on Linux a few weeks
> ago and got it to pass. (I don't recall what's the status of the test
> suite under py3.) So either this issue is specific to Py3 on Windows,
> or I missed something, or the gen-make.py code has changed.
> Anyway, gen-make.py shouldn't fail like that. I'd rather it just worked
> under py3, but if we can't make it work, we should error out up front if
> Python is newer than we support.
Given there's been not much progress on the issue, I quickly
put-together (and tested) a patch to detect Python >= 3 and issue a
user-readable error. Maybe it'd be worth including this in 1.9, so
people trying to build 1.9 don't have to go through the hazzle of
figuring out that the problem is their current python-version rather
than some other problem?

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

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.


Received on 2015-07-20 16:59:46 CEST

This is an archived mail posted to the Subversion Dev mailing list.