Add comments explaining UCS4 and prevent variant being used on Python 3.3 and above

This commit is contained in:
Paul Hopkins 2016-07-08 13:47:25 +01:00
parent a2be05f24b
commit 49e8e4b590

View File

@ -54,6 +54,13 @@ class Python(Package):
extendable = True
variant('ucs4', default=False, description='Enable UCS4 (wide) unicode strings')
# From https://docs.python.org/2/c-api/unicode.html: Python's default
# builds use a 16-bit type for Py_UNICODE and store Unicode values
# internally as UCS2. It is also possible to build a UCS4 version of Python
# (most recent Linux distributions come with UCS4 builds of Python). These
# builds then use a 32-bit type for Py_UNICODE and store Unicode data
# internally as UCS4. Note that UCS2 and UCS4 Python builds are not binary
# compatible.
depends_on("openssl")
depends_on("bzip2")
@ -95,6 +102,9 @@ def install(self, spec, prefix):
config_args.append('--enable-unicode=ucs4')
elif spec.satisfies('@3.0:3.2'):
config_args.append('--with-wide-unicode')
elif spec.satisfies('@3.3:'):
# https://docs.python.org/3.3/whatsnew/3.3.html
raise ValueError('+ucs4 variant not compatible with Python 3.3 and beyond') # NOQA: ignore=E501
if spec.satisfies('@3:'):
config_args.append('--without-ensurepip')