Last active
February 26, 2019 06:06
-
-
Save Valian/013297c79edcc03f87fe351fe7a76f1a to your computer and use it in GitHub Desktop.
Fast way to fix not working ctype.util.find_library() in python alpine. Rather quick workaround, but works :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:2-alpine | |
ENV PYTHONUNBUFFERED=1 \ | |
PROJECT_ROOT=/srv | |
COPY requirements.txt $PROJECT_ROOT/ | |
RUN apk add --update --virtual build-dependencies build-base python-dev \ | |
&& cd $PROJECT_ROOT && pip install -r requirements.txt \ | |
# those two lines replaces "find_library(...)" call with result of "ls /lib | grep ..." in problematic packages | |
&& sed -i -e "s/ctypes\.util\.find_library('crypto')/'$(ls /lib | grep crypto)'/g" /usr/local/lib/python2.7/site-packages/pyelliptic/openssl.py \ | |
&& sed -i -e "s/find_library('c')/'$(ls /lib | grep libc.musl)'/g" /usr/local/lib/python2.7/site-packages/fakeredis.py \ | |
&& apk del build-dependencies \ | |
&& rm -rf /var/cache/apk/* | |
COPY . $PROJECT_ROOT | |
WORKDIR $PROJECT_ROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
CODE_FRAGMENT="find_library('c')" | |
LIBRARY_NAME="libc.musl" | |
PACKAGE_NAME="fakeredis.py" | |
sed -i -e "s/$CODE_FRAGMENT/'$(ls /lib | grep $LIBRARY_NAME)'/g" /usr/local/lib/python2.7/site-packages/$PACKAGE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment