diff setup.py @ 31325:70bc35df3e54

setup: convert setupversion to unicode Something deep in the bowels of distutils expects "version" passed to setup() to be a str/unicode. So, convert the type. This still works on Python 2 because the string is ascii and an implicit coercion back to str/bytes should work without issue. If it does cause problems, we can always make the unicode conversion dependent on running Python 3. This change makes `python3.5 setup.py install` work.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 11 Mar 2017 17:14:02 -0800
parents 62939e0148f1
children 9639ff4a93ae
line wrap: on
line diff
--- a/setup.py	Wed Jan 14 01:15:26 2015 +0100
+++ b/setup.py	Sat Mar 11 17:14:02 2017 -0800
@@ -661,7 +661,14 @@
             packagedata['mercurial'].append(f)
 
 datafiles = []
-setupversion = version
+
+# distutils expects version to be str/unicode. Converting it to
+# unicode on Python 2 still works because it won't contain any
+# non-ascii bytes and will be implicitly converted back to bytes
+# when operated on.
+assert isinstance(version, bytes)
+setupversion = version.decode('ascii')
+
 extra = {}
 
 if py2exeloaded: