Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UCS-2 builds of Python to the docker image #35

Merged
merged 4 commits into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,25 @@ directory for source code.
The images currently contain:

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

The "soabi flags" used in naming CPython version directories under ``/opt`` are
`PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_ ABI flags. Because
wheels created using a CPython (older than 3.3) built with
``--enable-unicode=ucs2`` are not compatible with ``--enable-unicode=ucs4``
interpreters, CPython 2.X builds of both UCS-2 (flags ``m``) and UCS-4 (flags
``mu``) are provided in ``/opt`` since both are commonly found "in the wild."
Other less common or virtually unheard of flag combinations (such as
``--with-pydebug`` (``d``) and ``--without-pymalloc`` (absence of ``m``)) are
not provided.

It'd be good to put an example of how to use these images here, but
that isn't written yet. If you want to know, then bug us on the
mailing list to fill in this section :-).
mailing list to fill in this section :-). However, one useful tip is that a
list of all interpreters can be obtained with ``/opt/python/*/bin/python``.


The PEP itself
Expand Down
8 changes: 4 additions & 4 deletions docker/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ tar -xzf patchelf-0.8.tar.gz
(cd patchelf-0.8 && ./configure && make && make install)
rm -rf patchelf-0.8.tar.gz patchelf-0.8

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

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

for PYVER in $PY_VERS; do
/opt/$PYVER/bin/python $MY_DIR/manylinux1-check.py
for PYTHON in /opt/*/bin/python; do
$PYTHON $MY_DIR/manylinux1-check.py
done
36 changes: 24 additions & 12 deletions docker/build_scripts/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ function lex_pyver {
function do_python_build {
local py_ver=$1
check_var $py_ver
mkdir -p /opt/$py_ver/lib
local soabi_flags=$2
check_var $soabi_flags
mkdir -p /opt/python/${py_ver}${soabi_flags}/lib
if [ $(lex_pyver $py_ver) -lt $(lex_pyver 3.3) ]; then
local unicode_flags="--enable-unicode=ucs4"
if [ $soabi_flags = "mu" ]; then
local unicode_flags="--enable-unicode=ucs4"
else
local unicode_flags="--enable-unicode=ucs2"
fi
fi
# -Wformat added for https://bugs.python.org/issue17547 on Python 2.6
CFLAGS="-Wformat" LDFLAGS="-Wl,-rpath /opt/$py_ver/lib" ./configure --prefix=/opt/$py_ver --disable-shared $unicode_flags > /dev/null
CFLAGS="-Wformat" ./configure --prefix=/opt/python/${py_ver}${soabi_flags} --disable-shared $unicode_flags > /dev/null
make -j2 > /dev/null
make install > /dev/null
}
Expand All @@ -43,15 +49,21 @@ function build_python {
local py_ver2="$(echo $py_ver | cut -d. -f 1,2)"
check_var $PYTHON_DOWNLOAD_URL
wget -q $PYTHON_DOWNLOAD_URL/$py_ver/Python-$py_ver.tgz
tar -xzf Python-$py_ver.tgz
(cd Python-$py_ver && do_python_build $py_ver)
if [ $(lex_pyver $py_ver) -ge $(lex_pyver 3) ]; then \
ln -s /opt/$py_ver/bin/python3 /opt/$py_ver/bin/python;
fi;
ln -s /opt/$py_ver/ /opt/$py_ver2
/opt/$py_ver/bin/python get-pip.py
/opt/$py_ver/bin/pip install wheel
rm -rf Python-$py_ver.tgz Python-$py_ver
if [ $(lex_pyver $py_ver) -lt $(lex_pyver 3.3) ]; then
local soabi_flags_list="mu m"
fi
for soabi_flags in ${soabi_flags_list:-m}; do
tar -xzf Python-$py_ver.tgz
(cd Python-$py_ver && do_python_build $py_ver $soabi_flags)
if [ $(lex_pyver $py_ver) -ge $(lex_pyver 3) ]; then \
ln -s /opt/python/${py_ver}${soabi_flags}/bin/python3 /opt/python/${py_ver}${soabi_flags}/bin/python;
fi;
ln -s /opt/python/${py_ver}${soabi_flags}/ /opt/${py_ver2}${soabi_flags}
/opt/python/${py_ver}${soabi_flags}/bin/python get-pip.py
/opt/python/${py_ver}${soabi_flags}/bin/pip install wheel
rm -rf Python-$py_ver
done
rm -f Python-$py_ver.tgz
}


Expand Down