Skip to content

Video editing with Python

Auto-detect image magick latest 6.9.X-Y version (#936)

Rémi Bèges57086efe7830
diff --git a/appveyor.yml b/appveyor.yml
index 31dae8ba..28c9da18 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,7 +2,6 @@ image: Visual Studio 2017
environment:
global:
- IMAGE_MAGICK_VERSION: 6.9.10-35-Q16
IMAGE_MAGICK_INSTALL_DIR: c://ImageMagick
matrix:
- PYTHON: "C:\\Python35-x64"
@@ -36,6 +35,12 @@ install:
- pip install --upgrade pip --user
- pip install pipenv
+ # Find latest image magick version by parsing website
+
+ - python find_latest_imagemagick_version.py > temp.txt
+ - set /p IMAGE_MAGICK_VERSION=<temp.txt
+
+ - echo %IMAGE_MAGICK_VERSION%
# Download ImageMagick installer (which also installs ffmpeg.)
# From http://ftp.fifi.org/ImageMagick/binaries/
# Might need to be updated from time to time
diff --git a/find_latest_imagemagick_version.py b/find_latest_imagemagick_version.py
new file mode 100644
index 00000000..00cde14e
--- /dev/null
+++ b/find_latest_imagemagick_version.py
@@ -0,0 +1,21 @@
+from urllib import request
+import re
+
+url = "https://legacy.imagemagick.org/script/index.php"
+
+'''This little script parses url above to extract latest image magick version
+(major version 6.9), to feed it into CI system. Not the best way for reproducible
+builds, but it's preferred for now over storing imagemagick installer into the
+git repository
+'''
+
+response = request.urlopen(url)
+html = response.read().decode('utf-8')
+r = re.compile("6\.9\.[0-9]+\-[0-9]+")
+version = r.findall(html)
+if len(version) == 0:
+ raise ValueError("Could not find latest legacy 6.9.X-Y ImageMagick version from {}".format(url))
+version = version[0]
+# Append Q16 build
+version += '-Q16'
+print(version)