diff --git a/Dockerfile b/Dockerfile index 4d9796e..3ba8bdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,9 @@ ARG ZLIB_VERSION=1.2.11 ARG TERMCAP_VERSION=1.3.1 ARG READLINE_VERSION=6.3 ARG OPENSSL_VERSION=1.0.2k -ARG PYTHON_BASE_VERSION=2.7.15 +ARG PYTHON_BASE_VERSION=3.6.6 ARG PSUTIL_VERSION=5.4.5 -ARG PYTHON_RC=rc1 +ARG PYTHON_RC= RUN \ mkdir -m 755 /build @@ -93,8 +93,9 @@ RUN \ # Ready to be copied for Lib ADD \ - ./BPO-7938_pr4338-fix-makesetup-script.patch \ - ./cpython-enable-openssl.patch \ + ./BPO-7938_pr4338-fix-makesetup-script.patch \ + ./cpython-enable-openssl.patch \ + ./python-BPO-19348-3.6.6-fix-testcapi.patch \ /build/ RUN \ @@ -115,7 +116,7 @@ RUN \ MODULES="_bisect _collections _csv _datetime _elementtree _functools _heapq _io _md5 _posixsubprocess _random _sha256 _sha512 _socket _struct _weakref array binascii cmath datetime fcntl grp itertools math mmap operator parser readline resource select spwd syslog termios time unicodedata zlib" && \ for mod in $MODULES; do echo "enabling ${mod}" ; sed -i -e "s/^#${mod}/${mod}/" Modules/Setup; done && \ echo '_json _json.c' >> Modules/Setup && \ - echo '_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c _multiprocessing/socket_connection.c' >> Modules/Setup && \ + echo '_multiprocessing _multiprocessing/semaphore.c _multiprocessing/multiprocessing.c' >> Modules/Setup && \ sed -i '1i *static*' Modules/Setup && \ sed -i \ -e "s|^zlib zlibmodule.c|zlib zlibmodule.c -I/build/zlib-${ZLIB_VERSION} -L/build/zlib-${ZLIB_VERSION} -lz|" \ @@ -126,47 +127,48 @@ RUN \ echo "pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I\$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI -DHAVE_SYSCALL_GETRANDOM" >>Modules/Setup && \ echo "_psutil_linux psutil/_psutil_common.c psutil/_psutil_posix.c psutil/_psutil_linux.c -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=__PSVER__ -DPSUTIL_LINUX=1" >>Modules/Setup && \ echo "_psutil_posix psutil/_psutil_common.c psutil/_psutil_posix.c -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=__PSVER__ -DPSUTIL_LINUX=1" >>Modules/Setup && \ - echo "crypt cryptmodule.c -lcrypt" >>Modules/Setup && \ patch --ignore-whitespace -p1 < /build/cpython-enable-openssl.patch && \ echo "Patching for https://bugs.python.org/issue7938" && \ patch --ignore-whitespace -p0 < /build/BPO-7938_pr4338-fix-makesetup-script.patch && \ + echo "Patching for https://bugs.python.org/issue19348" && \ + cd Modules && \ + patch --ignore-whitespace -p0 < /build/python-BPO-19348-3.6.6-fix-testcapi.patch && \ + cd .. && \ sed -i \ -e "s|^SSL=/build/openssl-TKTK|SSL=/build/openssl-${OPENSSL_VERSION}|" \ -e "s|__PSVER__|${psversion}|g" \ Modules/Setup && \ - cat Modules/Setup && \ CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ ./configure \ --disable-shared \ --with-openssl=/build/openssl-${OPENSSL_VERSION} && \ - (make --trace -j $(nproc --all) LDFLAGS="-static" LINKFORSHARED=" " || true) && \ + (make --trace -j$(nproc --all) LDFLAGS="-static" LINKFORSHARED=" " || true) && \ /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip python && \ - cp $(find . -name _sysconfigdata.py -print) Lib && \ cp -r /build/psutil/python_files/psutil Lib && \ - cd Lib && zip -r ../python2.7.zip . + cd Lib && zip -r ../python${PYTHON_BASE_VERSION}.zip . ### FROM scratch MAINTAINER Lisa Seelye WORKDIR / -ARG PYTHON_BASE_VERSION=2.7.15 -ARG PYTHON_RC=rc1 +ARG PYTHON_BASE_VERSION=3.6.6 +ARG PYTHON_RC= COPY \ --from=0 \ /build/Python-${PYTHON_BASE_VERSION}${PYTHON_RC}/python \ - /build/Python-${PYTHON_BASE_VERSION}${PYTHON_RC}/python2.7.zip \ + /build/Python-${PYTHON_BASE_VERSION}${PYTHON_RC}/python${PYTHON_BASE_VERSION}.zip \ / # just in case things need them to exist, like flask COPY passwd /etc/passwd COPY group /etc/group ENV \ - PYTHONHOME=/python2.7.zip \ - PYTHONPATH=/python2.7.zip + PYTHONHOME=/python${PYTHON_BASE_VERSION}.zip \ + PYTHONPATH=/python${PYTHON_BASE_VERSION}.zip # Users of this base image should be sure to COPY their entrypoint.py to /entrypoint.py CMD [ "/python", "-s", "-S", "/entrypoint.py" ] diff --git a/python-BPO-19348-3.6.6-fix-testcapi.patch b/python-BPO-19348-3.6.6-fix-testcapi.patch new file mode 100644 index 0000000..342436b --- /dev/null +++ b/python-BPO-19348-3.6.6-fix-testcapi.patch @@ -0,0 +1,20 @@ +--- _testcapimodule.c-orig 2018-10-05 14:24:52.151333000 +0000 ++++ _testcapimodule.c 2018-10-05 14:25:55.281320000 +0000 +@@ -10,7 +10,17 @@ + #include "Python.h" + #include + #include "structmember.h" ++/* Differentiate between building the core module and building extension ++ * modules. ++ * https://bugs.python.org/issue19348 ++ */ ++#ifdef Py_BUILD_CORE ++#undef Py_BUILD_CORE + #include "datetime.h" ++#define Py_BUILD_CORE ++#else ++#include "datetime.h" ++#endif + #include "marshal.h" + #include + \ No newline at end of file diff --git a/travis-build-scripts/build_image.sh b/travis-build-scripts/build_image.sh index 15e2ec0..0620cef 100755 --- a/travis-build-scripts/build_image.sh +++ b/travis-build-scripts/build_image.sh @@ -40,4 +40,4 @@ docker build -f Dockerfile -t thedoh/static-python:$TRAVIS_COMMIT . >> $BUILD_OU dump_output kill $PING_LOOP_PID -exit 0 \ No newline at end of file +exit 0