Skip to content

Commit 8707a7c

Browse files
committed
Merge pull request #35 from natefoo/ucs2
Add UCS-2 builds of Python to the docker image
2 parents 3a51d5c + 4c796c2 commit 8707a7c

File tree

3 files changed

+41
-18
lines changed

3 files changed

+41
-18
lines changed

README.rst

+13-2
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,25 @@ directory for source code.
5555
The images currently contain:
5656

5757
- CPython 2.6, 2.7, 3.3, 3.4, and 3.5, installed in ``/opt/<version
58-
number>``
58+
number><soabi flags>``
5959
- Devel packages for all the libraries that PEP 513 allows you to
6060
assume are present on the host system
6161
- The `auditwheel <https://pypi.python.org/pypi/auditwheel>`_ tool
6262

63+
The "soabi flags" used in naming CPython version directories under ``/opt`` are
64+
`PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_ ABI flags. Because
65+
wheels created using a CPython (older than 3.3) built with
66+
``--enable-unicode=ucs2`` are not compatible with ``--enable-unicode=ucs4``
67+
interpreters, CPython 2.X builds of both UCS-2 (flags ``m``) and UCS-4 (flags
68+
``mu``) are provided in ``/opt`` since both are commonly found "in the wild."
69+
Other less common or virtually unheard of flag combinations (such as
70+
``--with-pydebug`` (``d``) and ``--without-pymalloc`` (absence of ``m``)) are
71+
not provided.
72+
6373
It'd be good to put an example of how to use these images here, but
6474
that isn't written yet. If you want to know, then bug us on the
65-
mailing list to fill in this section :-).
75+
mailing list to fill in this section :-). However, one useful tip is that a
76+
list of all interpreters can be obtained with ``/opt/python/*/bin/python``.
6677

6778

6879
The PEP itself

docker/build_scripts/build.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ tar -xzf patchelf-0.8.tar.gz
5353
(cd patchelf-0.8 && ./configure && make && make install)
5454
rm -rf patchelf-0.8.tar.gz patchelf-0.8
5555

56-
/opt/3.5/bin/pip install git+git://github.com/manylinux/auditwheel.git && \
57-
ln -s /opt/3.5/bin/auditwheel /usr/local/bin/auditwheel
56+
/opt/3.5m/bin/pip install git+git://github.com/manylinux/auditwheel.git && \
57+
ln -s /opt/3.5m/bin/auditwheel /usr/local/bin/auditwheel
5858

5959
# Clean up development headers and other unnecessary stuff for
6060
# final image
@@ -65,6 +65,6 @@ yum -y install ${MANYLINUX1_DEPS}
6565
yum -y clean all > /dev/null 2>&1
6666
yum list installed
6767

68-
for PYVER in $PY_VERS; do
69-
/opt/$PYVER/bin/python $MY_DIR/manylinux1-check.py
68+
for PYTHON in /opt/*/bin/python; do
69+
$PYTHON $MY_DIR/manylinux1-check.py
7070
done

docker/build_scripts/build_utils.sh

+24-12
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ function lex_pyver {
2626
function do_python_build {
2727
local py_ver=$1
2828
check_var $py_ver
29-
mkdir -p /opt/$py_ver/lib
29+
local soabi_flags=$2
30+
check_var $soabi_flags
31+
mkdir -p /opt/python/${py_ver}${soabi_flags}/lib
3032
if [ $(lex_pyver $py_ver) -lt $(lex_pyver 3.3) ]; then
31-
local unicode_flags="--enable-unicode=ucs4"
33+
if [ $soabi_flags = "mu" ]; then
34+
local unicode_flags="--enable-unicode=ucs4"
35+
else
36+
local unicode_flags="--enable-unicode=ucs2"
37+
fi
3238
fi
3339
# -Wformat added for https://bugs.python.org/issue17547 on Python 2.6
34-
CFLAGS="-Wformat" LDFLAGS="-Wl,-rpath /opt/$py_ver/lib" ./configure --prefix=/opt/$py_ver --disable-shared $unicode_flags > /dev/null
40+
CFLAGS="-Wformat" ./configure --prefix=/opt/python/${py_ver}${soabi_flags} --disable-shared $unicode_flags > /dev/null
3541
make -j2 > /dev/null
3642
make install > /dev/null
3743
}
@@ -43,15 +49,21 @@ function build_python {
4349
local py_ver2="$(echo $py_ver | cut -d. -f 1,2)"
4450
check_var $PYTHON_DOWNLOAD_URL
4551
wget -q $PYTHON_DOWNLOAD_URL/$py_ver/Python-$py_ver.tgz
46-
tar -xzf Python-$py_ver.tgz
47-
(cd Python-$py_ver && do_python_build $py_ver)
48-
if [ $(lex_pyver $py_ver) -ge $(lex_pyver 3) ]; then \
49-
ln -s /opt/$py_ver/bin/python3 /opt/$py_ver/bin/python;
50-
fi;
51-
ln -s /opt/$py_ver/ /opt/$py_ver2
52-
/opt/$py_ver/bin/python get-pip.py
53-
/opt/$py_ver/bin/pip install wheel
54-
rm -rf Python-$py_ver.tgz Python-$py_ver
52+
if [ $(lex_pyver $py_ver) -lt $(lex_pyver 3.3) ]; then
53+
local soabi_flags_list="mu m"
54+
fi
55+
for soabi_flags in ${soabi_flags_list:-m}; do
56+
tar -xzf Python-$py_ver.tgz
57+
(cd Python-$py_ver && do_python_build $py_ver $soabi_flags)
58+
if [ $(lex_pyver $py_ver) -ge $(lex_pyver 3) ]; then \
59+
ln -s /opt/python/${py_ver}${soabi_flags}/bin/python3 /opt/python/${py_ver}${soabi_flags}/bin/python;
60+
fi;
61+
ln -s /opt/python/${py_ver}${soabi_flags}/ /opt/${py_ver2}${soabi_flags}
62+
/opt/python/${py_ver}${soabi_flags}/bin/python get-pip.py
63+
/opt/python/${py_ver}${soabi_flags}/bin/pip install wheel
64+
rm -rf Python-$py_ver
65+
done
66+
rm -f Python-$py_ver.tgz
5567
}
5668

5769

0 commit comments

Comments
 (0)