Skip to content

Commit 5d0ba9d

Browse files
committed
Add python3.6 python3.7 support to manylinux Dockerfile
test=develop
1 parent d971d5b commit 5d0ba9d

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

tools/manylinux1/Dockerfile.x64

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ RUN wget -O /root/requirements.txt https://raw.githubusercontent.com/PaddlePaddl
4141
RUN LD_LIBRARY_PATH=/opt/_internal/cpython-2.7.11-ucs4/lib:${LD_LIBRARY_PATH} /opt/python/cp27-cp27mu/bin/pip install -r /root/requirements.txt && \
4242
LD_LIBRARY_PATH=/opt/_internal/cpython-2.7.11-ucs2/lib:${LD_LIBRARY_PATH} /opt/python/cp27-cp27m/bin/pip install -r /root/requirements.txt && \
4343
LD_LIBRARY_PATH=/opt/_internal/cpython-3.5.1/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.5.1/bin/pip3 install -r /root/requirements.txt && \
44+
LD_LIBRARY_PATH=/opt/_internal/cpython-3.6.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.6.0/bin/pip3 install -r /root/requirements.txt && \
45+
LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.7.0/bin/pip3 install -r /root/requirements.txt && \
4446
go get github.com/Masterminds/glide && \
4547
rm -rf /root/requirements.txt
4648

4749
RUN LD_LIBRARY_PATH=/opt/_internal/cpython-2.7.11-ucs4/lib:${LD_LIBRARY_PATH} /opt/python/cp27-cp27mu/bin/pip install pre-commit 'ipython==5.3.0' opencv-python && \
4850
LD_LIBRARY_PATH=/opt/_internal/cpython-2.7.11-ucs2/lib:${LD_LIBRARY_PATH} /opt/python/cp27-cp27m/bin/pip install pre-commit 'ipython==5.3.0' opencv-python && \
49-
LD_LIBRARY_PATH=/opt/_internal/cpython-3.5.1/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.5.1/bin/pip3 install pre-commit 'ipython==5.3.0' opencv-python
51+
LD_LIBRARY_PATH=/opt/_internal/cpython-3.5.1/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.5.1/bin/pip3 install pre-commit 'ipython==5.3.0' opencv-python && \
52+
LD_LIBRARY_PATH=/opt/_internal/cpython-3.6.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.6.0/bin/pip3 install pre-commit 'ipython==5.3.0' opencv-python && \
53+
LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.7.0/bin/pip3 install pre-commit 'ipython==5.3.0' opencv-python
5054

5155
RUN wget -O /opt/swig-2.0.12.tar.gz https://cytranet.dl.sourceforge.net/project/swig/swig/swig-2.0.12/swig-2.0.12.tar.gz && \
5256
cd /opt && tar xzf swig-2.0.12.tar.gz && cd /opt/swig-2.0.12 && ./configure && make && make install && cd /opt && rm swig-2.0.12.tar.gz

tools/manylinux1/build_scripts/build.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -ex
99
# remove others to expedite build and reduce docker image size. The original
1010
# manylinux docker image project builds many python versions.
1111
# NOTE We added back 3.5.1, since auditwheel requires python 3.3+
12-
CPYTHON_VERSIONS="2.7.11 3.5.1"
12+
CPYTHON_VERSIONS="3.7.0 3.6.0 3.5.1 2.7.11"
1313

1414
# openssl version to build, with expected sha256 hash of .tar.gz
1515
# archive
@@ -25,7 +25,7 @@ AUTOCONF_HASH=954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969
2525

2626
# Dependencies for compiling Python that we want to remove from
2727
# the final image after compiling Python
28-
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel"
28+
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-dev"
2929

3030
# Libraries that are allowed as part of the manylinux1 profile
3131
MANYLINUX1_DEPS="glibc-devel libstdc++-devel glib2-devel libX11-devel libXext-devel libXrender-devel mesa-libGL-devel libICE-devel libSM-devel ncurses-devel freetype-devel libpng-devel"
@@ -77,11 +77,13 @@ mkdir -p /opt/python
7777
build_cpythons $CPYTHON_VERSIONS
7878

7979
PY35_BIN=/opt/python/cp35-cp35m/bin
80+
PY36_BIN=/opt/python/cp36-cp36m/bin
81+
PY37_BIN=/opt/python/cp37-cp37m/bin
8082
# NOTE Since our custom manylinux image builds pythons with shared
8183
# libpython, we need to add libpython's dir to LD_LIBRARY_PATH before running
8284
# python.
8385
ORIGINAL_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
84-
LD_LIBRARY_PATH="${ORIGINAL_LD_LIBRARY_PATH}:$(dirname ${PY35_BIN})/lib"
86+
LD_LIBRARY_PATH="${ORIGINAL_LD_LIBRARY_PATH}:$(dirname ${PY35_BIN})/lib:$(dirname ${PY36_BIN})/lib:$(dirname ${PY37_BIN})/lib"
8587

8688
# Our openssl doesn't know how to find the system CA trust store
8789
# (https://github.com/pypa/manylinux/issues/53)

tools/manylinux1/build_scripts/build_utils.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ function do_cpython_build {
5353
# NOTE --enable-shared for generating libpython shared library needed for
5454
# linking of some of the nupic.core test executables.
5555
CFLAGS="-Wformat" ./configure --prefix=${prefix} --enable-shared $unicode_flags > /dev/null
56-
make -j2 > /dev/null
57-
make install > /dev/null
56+
make -j8 > /dev/null
57+
if [ $(lex_pyver $py_ver) -ge $(lex_pyver 3.7) ]; then
58+
make altinstall > /dev/null
59+
else
60+
make install > /dev/null
61+
fi
5862
popd
5963
echo "ZZZ looking for libpython"
6064
find / -name 'libpython*.so*'
@@ -64,6 +68,12 @@ function do_cpython_build {
6468
if [ -e ${prefix}/bin/python3 ]; then
6569
ln -s python3 ${prefix}/bin/python
6670
fi
71+
if [ -e ${prefix}/bin/python3.6 ]; then
72+
ln -s python3.6 ${prefix}/bin/python
73+
fi
74+
if [ -e ${prefix}/bin/python3.7 ]; then
75+
ln -s python3.7 ${prefix}/bin/python
76+
fi
6777
# NOTE Make libpython shared library visible to python calls below
6878
LD_LIBRARY_PATH="${prefix}/lib" ${prefix}/bin/python get-pip.py
6979
LD_LIBRARY_PATH="${prefix}/lib" ${prefix}/bin/pip install wheel

0 commit comments

Comments
 (0)