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 1 commit
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
8 changes: 7 additions & 1 deletion docker/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,11 @@ 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
soabi_flags_list="m"
if [ $(lex_pyver $PYVER) -lt $(lex_pyver 3.3) ]; then
soabi_flags_list="mu m"
fi
for soabi_flags in $soabi_flags_list; do
/opt/${PYVER}${soabi_flags}/bin/python $MY_DIR/manylinux1-check.py
done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just be

for PYTHON in /opt/*/bin/python; do
    $PYTHON $MY_DIR/manylinux1-check.py
done

it's a bit redundant (checks the same interpreters repeatedly), but the test takes a fraction of a second so who cares -- being thorough and robust seems more important.

done
37 changes: 25 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/${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" LDFLAGS="-Wl,-rpath /opt/${py_ver}${soabi_flags}/lib" ./configure --prefix=/opt/${py_ver}${soabi_flags} --disable-shared $unicode_flags > /dev/null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that now that we are using --disable-shared, the LDFLAGS setting is pointless and actually somewhat harmful (because python might propagate it into the default settings used for building python extensions). Instead of updating it, maybe we should just remove it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, there should be no reason we need an rpath pointing at the Python lib directory without a shared libpython.

make -j2 > /dev/null
make install > /dev/null
}
Expand All @@ -43,15 +49,22 @@ 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/${py_ver}${soabi_flags}/bin/python3 /opt/${py_ver}${soabi_flags}/bin/python;
fi;
ln -s /opt/${py_ver}${soabi_flags}/ /opt/${py_ver2}${soabi_flags}
[ ! -h /opt/${py_ver2} ] && ln -s /opt/${py_ver}${soabi_flags}/ /opt/$py_ver2
/opt/${py_ver}${soabi_flags}/bin/python get-pip.py
/opt/${py_ver}${soabi_flags}/bin/pip install wheel
rm -rf Python-$py_ver
done
rm -f Python-$py_ver.tgz
}


Expand Down