diff options
author | Mike Crute <mike@crute.us> | 2020-02-08 00:55:53 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2020-02-08 00:55:53 +0000 |
commit | cd7d5795264de19f6354e8caaaf15b7ebec0dc92 (patch) | |
tree | dde125cf0076aec2ea181f04d85a82101234a944 /moin | |
parent | bc08e7bc27349d4bbe9c775e925a40b8387112f7 (diff) | |
download | dockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.tar.bz2 dockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.tar.xz dockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.zip |
moin: fix to python2 versions
Diffstat (limited to 'moin')
-rw-r--r-- | moin/Dockerfile | 7 | ||||
-rw-r--r-- | moin/Makefile | 5 | ||||
-rw-r--r-- | moin/wiki-common/plugins/macro/NoCacheRemoteImage.py | 33 |
3 files changed, 42 insertions, 3 deletions
diff --git a/moin/Dockerfile b/moin/Dockerfile index 28c31d6..6dbf84f 100644 --- a/moin/Dockerfile +++ b/moin/Dockerfile | |||
@@ -1,6 +1,8 @@ | |||
1 | FROM docker.io/alpine:latest | 1 | FROM docker.io/alpine:3.10 |
2 | LABEL maintainer="Mike Crute <mike@crute.us>" | 2 | LABEL maintainer="Mike Crute <mike@crute.us>" |
3 | 3 | ||
4 | ARG moin_version | ||
5 | |||
4 | ADD patches/ /tmp/moin-patches | 6 | ADD patches/ /tmp/moin-patches |
5 | # aspell-en (wamerican) needed? | 7 | # aspell-en (wamerican) needed? |
6 | 8 | ||
@@ -42,8 +44,9 @@ RUN set -euxo pipefail; \ | |||
42 | && mv *.so* /usr/lib \ | 44 | && mv *.so* /usr/lib \ |
43 | # Build the latest version of moin | 45 | # Build the latest version of moin |
44 | && cd /tmp \ | 46 | && cd /tmp \ |
45 | && git clone --depth=1 https://github.com/moinwiki/moin-1.9.git \ | 47 | && git clone https://github.com/moinwiki/moin-1.9.git \ |
46 | && cd moin-1.9 \ | 48 | && cd moin-1.9 \ |
49 | && git checkout ${moin_version} \ | ||
47 | && for p in /tmp/moin-patches/*; do \ | 50 | && for p in /tmp/moin-patches/*; do \ |
48 | patch -p1 < $p; \ | 51 | patch -p1 < $p; \ |
49 | done \ | 52 | done \ |
diff --git a/moin/Makefile b/moin/Makefile index a72d6ff..6330b72 100644 --- a/moin/Makefile +++ b/moin/Makefile | |||
@@ -1,8 +1,11 @@ | |||
1 | VERSION=latest | 1 | VERSION=latest |
2 | IMAGE=docker.crute.me/moin | 2 | IMAGE=docker.crute.me/moin |
3 | MOIN_VERSION=6cf59082f29a2bb3bb37bed1bd525e401e524a3e | ||
3 | 4 | ||
4 | all: | 5 | all: |
5 | docker build -t $(IMAGE):$(VERSION) . | 6 | docker build \ |
7 | --build-arg=moin_version=$(MOIN_VERSION) \ | ||
8 | -t $(IMAGE):$(VERSION) . | ||
6 | 9 | ||
7 | all-no-cache: | 10 | all-no-cache: |
8 | docker build --no-cache -t $(IMAGE):$(VERSION) . | 11 | docker build --no-cache -t $(IMAGE):$(VERSION) . |
diff --git a/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py b/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py new file mode 100644 index 0000000..9f37332 --- /dev/null +++ b/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py | |||
@@ -0,0 +1,33 @@ | |||
1 | import time | ||
2 | import urllib | ||
3 | import urlparse | ||
4 | |||
5 | |||
6 | QUERY_PART_INDEX = 4 | ||
7 | |||
8 | |||
9 | def macro_NoCacheRemoteImage(macro, url, querystring_param=None, alt=None, | ||
10 | width=None, link=True): | ||
11 | parsed = list(urlparse.urlparse(url)) | ||
12 | |||
13 | query = urlparse.parse_qsl(parsed[QUERY_PART_INDEX]) | ||
14 | query.append((querystring_param or "c", str(int(time.time() * 1000000)))) | ||
15 | |||
16 | parsed[QUERY_PART_INDEX] = urllib.urlencode(query) | ||
17 | |||
18 | cb_url = urlparse.urlunparse(urlparse.ParseResult(*parsed)) | ||
19 | |||
20 | img_args = { "class": "external image" } | ||
21 | |||
22 | if alt: | ||
23 | img_args["alt"] = alt | ||
24 | img_args["title"] = alt | ||
25 | |||
26 | if width: | ||
27 | img_args["width"] = width | ||
28 | |||
29 | return "".join([ | ||
30 | macro.formatter.url(True, cb_url) if link else "", | ||
31 | macro.formatter.image(cb_url, **img_args), | ||
32 | macro.formatter.url(False) if link else "", | ||
33 | ]) | ||