Skip to content

Commit

Permalink
Update to Alpine 3.11 and fix version info in CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir authored and olmari committed Feb 28, 2020
1 parent 69b092e commit 845eb92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk add --no-cache libpng libpng-dev zlib zlib-dev \
&& git checkout 543c1d23ac9322f4f03c7fb6612ea7d026d44ac0 \
&& make

FROM docker.io/alpine:3.10
FROM docker.io/alpine:3.11

ENV UID=1337 \
GID=1337 \
Expand All @@ -33,7 +33,6 @@ RUN apk add --no-cache --virtual .build-deps \
python3-dev \
libffi-dev \
build-base \
git \
&& apk add --no-cache \
py3-virtualenv \
py3-pillow \
Expand All @@ -52,7 +51,7 @@ RUN apk add --no-cache --virtual .build-deps \
py3-markupsafe \
#moviepy
py3-decorator \
#py3-tqdm \
py3-tqdm \
py3-requests \
#imageio
py3-numpy \
Expand Down
14 changes: 10 additions & 4 deletions mautrix_telegram/get_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
import shutil
import os

from . import __version__
Expand All @@ -15,7 +16,7 @@ def run(cmd):
return subprocess.check_output(cmd, stderr=subprocess.DEVNULL, env=cmd_env)


if os.path.exists(".git"):
if os.path.exists(".git") and shutil.which("git"):
try:
git_revision = run(["git", "rev-parse", "HEAD"]).strip().decode("ascii")
git_revision_url = f"https://github.com/tulir/mautrix-telegram/commit/{git_revision}"
Expand All @@ -26,15 +27,20 @@ def run(cmd):

try:
git_tag = run(["git", "describe", "--exact-match", "--tags"]).strip().decode("ascii")
git_tag_url = f"https://github.com/tulir/mautrix-telegram/releases/tag/{git_tag}"
except (subprocess.SubprocessError, OSError):
git_tag = None
git_tag_url = None
elif os.environ.get("CI_SERVER", "no") == "yes":
git_revision = os.environ["CI_COMMIT_SHA"]
git_revision_url = f"https://github.com/tulir/mautrix-telegram/commit/{git_revision}"
git_revision = git_revision[:8]
git_tag = os.environ.get("CI_COMMIT_TAG", None)
else:
git_revision = "unknown"
git_revision_url = None
git_tag = None
git_tag_url = None

git_tag_url = (f"https://github.com/tulir/mautrix-telegram/releases/tag/{git_tag}"
if git_tag else None)

if git_tag and __version__ == git_tag[1:].replace("-", ""):
version = __version__
Expand Down

0 comments on commit 845eb92

Please sign in to comment.