diff options
author | Adam Hupp <adam@hupp.org> | 2021-06-03 06:43:08 -0700 |
---|---|---|
committer | Adam Hupp <adam@hupp.org> | 2021-06-03 06:43:08 -0700 |
commit | 4ed6b038ba8acd59ed58c888fbd18355b8955eba (patch) | |
tree | b873c49134fac415adef90375a05b60aa67f3cb1 | |
parent | 5e1f1500a37377216605c81fc9a965a0036aaef6 (diff) | |
download | python-magic-4ed6b038ba8acd59ed58c888fbd18355b8955eba.tar.gz |
fix alpine library loading
-rw-r--r-- | magic/loader.py | 5 | ||||
-rwxr-xr-x | test/docker/alpine (renamed from test/Dockerfile_alpine) | 2 | ||||
-rwxr-xr-x | test/docker/archlinux (renamed from test/Dockerfile_archlinux) | 0 | ||||
-rwxr-xr-x | test/docker/bionic (renamed from test/Dockerfile_bionic) | 0 | ||||
-rw-r--r-- | test/docker/centos7 (renamed from test/Dockerfile_centos7) | 0 | ||||
-rw-r--r-- | test/docker/centos8 (renamed from test/Dockerfile_centos8) | 0 | ||||
-rwxr-xr-x | test/docker/focal (renamed from test/Dockerfile_focal) | 0 | ||||
-rwxr-xr-x | test/docker/xenial (renamed from test/Dockerfile_xenial) | 0 | ||||
-rwxr-xr-x | test_docker.sh | 17 |
9 files changed, 10 insertions, 14 deletions
diff --git a/magic/loader.py b/magic/loader.py index d6e179b..931f161 100644 --- a/magic/loader.py +++ b/magic/loader.py @@ -29,6 +29,11 @@ def _lib_candidates(): yield './%s.dll' % (i,) yield find_library(i) + elif sys.platform == 'linux': + # This is necessary because alpine is bad + yield 'libmagic.so.1' + + def load_lib(): for lib in _lib_candidates(): diff --git a/test/Dockerfile_alpine b/test/docker/alpine index f8ec79e..eb511d7 100755 --- a/test/Dockerfile_alpine +++ b/test/docker/alpine @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM python:3.8-alpine3.12 RUN apk add python3 python2 libmagic COPY . /python-magic CMD cd /python-magic/test && python3 ./run.py diff --git a/test/Dockerfile_archlinux b/test/docker/archlinux index fc96c44..fc96c44 100755 --- a/test/Dockerfile_archlinux +++ b/test/docker/archlinux diff --git a/test/Dockerfile_bionic b/test/docker/bionic index e335b8e..e335b8e 100755 --- a/test/Dockerfile_bionic +++ b/test/docker/bionic diff --git a/test/Dockerfile_centos7 b/test/docker/centos7 index f2ac6e4..f2ac6e4 100644 --- a/test/Dockerfile_centos7 +++ b/test/docker/centos7 diff --git a/test/Dockerfile_centos8 b/test/docker/centos8 index 968f6b6..968f6b6 100644 --- a/test/Dockerfile_centos8 +++ b/test/docker/centos8 diff --git a/test/Dockerfile_focal b/test/docker/focal index 74e4d78..74e4d78 100755 --- a/test/Dockerfile_focal +++ b/test/docker/focal diff --git a/test/Dockerfile_xenial b/test/docker/xenial index bc0440b..bc0440b 100755 --- a/test/Dockerfile_xenial +++ b/test/docker/xenial diff --git a/test_docker.sh b/test_docker.sh index 57d5328..59d6b7c 100755 --- a/test_docker.sh +++ b/test_docker.sh @@ -5,17 +5,8 @@ set -e -function TestInContainer { - local name="$1" - local TAG="python_magic/${name}:latest" - docker build -t $TAG -f "test/Dockerfile_${name}" . - docker run "python_magic/${name}:latest" -} +NAME=`basename $1` +TAG="python_magic/${NAME}:latest" +docker build -t $TAG -f $1 . +docker run $TAG -TestInContainer "xenial" -TestInContainer "bionic" -TestInContainer "focal" -TestInContainer "centos7" -TestInContainer "centos8" -TestInContainer "archlinux" -TestInContainer "alpine" |