From 35c9cf651796bf64da6eb41c07eb8e3f72298d0a Mon Sep 17 00:00:00 2001 From: Carmen Tawalika Date: Tue, 28 Jan 2020 11:06:56 +0100 Subject: [PATCH] patch python instead of grass for alpine docker --- docker/alpine/Dockerfile_alpine | 16 +++++++++--- docker/alpine/alpine-py38-ctypes.patch | 34 -------------------------- 2 files changed, 13 insertions(+), 37 deletions(-) delete mode 100644 docker/alpine/alpine-py38-ctypes.patch diff --git a/docker/alpine/Dockerfile_alpine b/docker/alpine/Dockerfile_alpine index aaa912aaa49..9ac4e399c54 100644 --- a/docker/alpine/Dockerfile_alpine +++ b/docker/alpine/Dockerfile_alpine @@ -159,9 +159,11 @@ RUN echo "Install main packages";\ # Copy and install GRASS GIS COPY . /src/grass_build/ WORKDIR /src/grass_build/ -# PATCH ctypes -COPY docker/alpine/alpine-py38-ctypes.patch /src/alpine-py38-ctypes.patch -RUN patch -p1 < /src/alpine-py38-ctypes.patch + +# Python 3.8.1 patch +RUN apk add curl +RUN curl -L https://github.com/mmacata/alpine-python381-patch/releases/download/0.0.0/python3-dev-3.8.1-r1.apk > /src/python3-dev-3.8.1-r1.apk +RUN apk add --allow-untrusted /src/python3-dev-3.8.1-r1.apk # Configure compile and install GRASS GIS RUN echo " => Configure and compile grass" && \ @@ -195,6 +197,11 @@ RUN grass --tmp-location EPSG:4326 --exec g.version -rge && \ pdal --version && \ python3 --version +# Python 3.8.1 patch again +RUN apk add curl +RUN curl -L https://github.com/mmacata/alpine-python381-patch/releases/download/0.0.0/python3-3.8.1-r1.apk > /src/python3-3.8.1-r1.apk +RUN apk add --allow-untrusted /src/python3-3.8.1-r1.apk + FROM grass as test @@ -205,6 +212,9 @@ COPY docker/testdata/test_grass_session.py . ## just scan the LAZ file # TODO: fix test #RUN /usr/bin/python3 /scripts/test_grass_session.py +# Test addon installation +RUN apk add make gcc +RUN grass --tmp-location EPSG:4326 --exec g.extension extension=r.learn.ml FROM grass as final diff --git a/docker/alpine/alpine-py38-ctypes.patch b/docker/alpine/alpine-py38-ctypes.patch deleted file mode 100644 index 34fce143497..00000000000 --- a/docker/alpine/alpine-py38-ctypes.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/lib/python/ctypes/ctypesgencore/ctypedescs.py b/lib/python/ctypes/ctypesgencore/ctypedescs.py -index 1b061ea1f..b04fba80e 100644 ---- a/lib/python/ctypes/ctypesgencore/ctypedescs.py -+++ b/lib/python/ctypes/ctypesgencore/ctypedescs.py -@@ -297,8 +297,16 @@ class CtypesFunction(CtypesType): - CtypesType.visit(self, visitor) - - def py_string(self): -+ at = [] -+ for a in self.argtypes: -+ if a.py_string() == "String": -+ at.append("POINTER(String)") -+ elif a.py_string()[:5] == "union": -+ at.append("POINTER(%s)" % a.py_string()) -+ else: -+ at.append(a.py_string()) - return 'CFUNCTYPE(UNCHECKED(%s), %s)' % (self.restype.py_string(), -- ', '.join([a.py_string() for a in self.argtypes])) -+ ', '.join([a for a in at])) - - last_tagnum = 0 - -diff --git a/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py b/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py -index b64d38c9c..0a840acff 100644 ---- a/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py -+++ b/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py -@@ -183,7 +183,7 @@ class CtypesParser(CParser): - isinstance(t.destination, CtypesSimple) and - t.destination.name == "char" and - t.destination.signed): -- t = CtypesSpecial("String") -+ t = CtypesSpecial("POINTER(String)") - - return t