From 8b598d5b77e048c2ff82317b5b31a12c5e5adeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Sun, 8 May 2016 04:35:08 +0200 Subject: [PATCH 1/5] Run python tests without make install In order to do this, we need to add some stub gi module init files which allow us to extend the gi overrides path. --- configure.ac | 5 +++-- python/Makefile.am | 14 +------------- python/packages/Makefile.am | 1 + python/packages/gi/Makefile.am | 5 +++++ python/packages/gi/__init__.py | 3 +++ python/packages/gi/overrides/Makefile.am | 5 +++++ python/{ => packages/gi/overrides}/Vips.py | 0 python/packages/gi/overrides/__init__.py | 3 +++ test/test_all.py | 5 ++++- 9 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 python/packages/Makefile.am create mode 100644 python/packages/gi/Makefile.am create mode 100644 python/packages/gi/__init__.py create mode 100644 python/packages/gi/overrides/Makefile.am rename python/{ => packages/gi/overrides}/Vips.py (100%) create mode 100644 python/packages/gi/overrides/__init__.py diff --git a/configure.ac b/configure.ac index 562c297b..96881ecb 100644 --- a/configure.ac +++ b/configure.ac @@ -772,8 +772,6 @@ fi if test x"$enable_pyvips8" = x"yes"; then PKG_CHECK_MODULES(PYGOBJECT, [pygobject-3.0 >= 3.12.0]) - pyoverridesdir="\$(pyexecdir)/gi/overrides" - AC_SUBST(pyoverridesdir) fi AM_CONDITIONAL(ENABLE_PYVIPS8, test x"$enable_pyvips8" = x"yes") @@ -994,6 +992,9 @@ AC_OUTPUT([ tools/light_correct tools/shrink_width python/Makefile + python/packages/Makefile + python/packages/gi/Makefile + python/packages/gi/overrides/Makefile test/Makefile test/variables.sh swig/Makefile diff --git a/python/Makefile.am b/python/Makefile.am index 6a8d54a5..fadca9af 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,17 +1,5 @@ -vips_overridesdir = $(pyoverridesdir) -vips_overrides_PYTHON = Vips.py +SUBDIRS = packages EXTRA_DIST = \ README.md -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(vips_overrides_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks -check-local: build_pylinks - diff --git a/python/packages/Makefile.am b/python/packages/Makefile.am new file mode 100644 index 00000000..14602de3 --- /dev/null +++ b/python/packages/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = gi diff --git a/python/packages/gi/Makefile.am b/python/packages/gi/Makefile.am new file mode 100644 index 00000000..dee3aef1 --- /dev/null +++ b/python/packages/gi/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = overrides + +EXTRA_DIST = \ + __init__.py + diff --git a/python/packages/gi/__init__.py b/python/packages/gi/__init__.py new file mode 100644 index 00000000..e35e122f --- /dev/null +++ b/python/packages/gi/__init__.py @@ -0,0 +1,3 @@ +# support overrides in different directories than our gi module +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/python/packages/gi/overrides/Makefile.am b/python/packages/gi/overrides/Makefile.am new file mode 100644 index 00000000..7a93b151 --- /dev/null +++ b/python/packages/gi/overrides/Makefile.am @@ -0,0 +1,5 @@ +vips_overridesdir = $(pyexecdir)/gi/overrides +vips_overrides_PYTHON = Vips.py + +EXTRA_DIST = \ + __init__.py diff --git a/python/Vips.py b/python/packages/gi/overrides/Vips.py similarity index 100% rename from python/Vips.py rename to python/packages/gi/overrides/Vips.py diff --git a/python/packages/gi/overrides/__init__.py b/python/packages/gi/overrides/__init__.py new file mode 100644 index 00000000..e35e122f --- /dev/null +++ b/python/packages/gi/overrides/__init__.py @@ -0,0 +1,3 @@ +# support overrides in different directories than our gi module +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/test/test_all.py b/test/test_all.py index 98fcf747..60805e49 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -1,4 +1,7 @@ -#!/usr/bin/python3 +#!/usr/bin/env python + +import sys +sys.path.append('../python/packages') import unittest From 1bf8e0847f33bfc29060da9f1512db37f37bc992 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 10 May 2016 14:48:03 +0100 Subject: [PATCH 2/5] run py tests from "make check" though they fail on ubuntu 16.04 due to giflib dumbness magickload is also failing, investigate --- test/Makefile.am | 21 +++++++++++++-------- test/test_python.sh | 26 ++++++++++++++++++-------- test/variables.sh.in | 1 + 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index bd82e2ca..56dc0f2d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,3 +1,16 @@ +TESTS = + +if ENABLE_PYVIPS8 +TESTS += \ + test_python.sh +endif + +# don't run test_thumbnail.sh by default, it takes ages +TESTS += \ + test_cli.sh \ + test_formats.sh \ + test_seq.sh \ + test_threading.sh EXTRA_DIST = \ images \ @@ -21,14 +34,6 @@ EXTRA_DIST = \ test_morphology.py \ test_resample.py -# don't run test_thumbnail.sh by default, it takes ages - -TESTS = \ - test_cli.sh \ - test_formats.sh \ - test_seq.sh \ - test_threading.sh - clean-local: -rm -rf tmp-* -rm -f *.pyc diff --git a/test/test_python.sh b/test/test_python.sh index ec464471..e361d4f2 100755 --- a/test/test_python.sh +++ b/test/test_python.sh @@ -2,16 +2,26 @@ # set -x -# don't run this set of tests as part of make check -- some platforms do make -# check before install and it's too hard to make pyvips8 work without -# installation - . ./variables.sh -echo "testing with python2 ..." +export GI_TYPELIB_PATH=../libvips -python2 test_all.py +vipslibs=../libvips/.libs -echo "testing with python3 ..." +# we want to test against the built but uninstalled libraries, so we must set +# LD_LIBRARY_PATH or equivalent +case `uname` in +HPUX) + export SHLIB_PATH=$vipslibs + ;; -python3 test_all.py +Darwin) + export DYLD_LIBRARY_PATH=$vipslibs + ;; + +*) + export LD_LIBRARY_PATH=$vipslibs + ;; +esac + +$PYTHON -m unittest -v test_all diff --git a/test/variables.sh.in b/test/variables.sh.in index f2751c31..efb90aab 100644 --- a/test/variables.sh.in +++ b/test/variables.sh.in @@ -1,4 +1,5 @@ top_srcdir=@TOP_SRCDIR@ +PYTHON=@PYTHON@ # we need a different tmp for each script since make can run tests in parallel tmp=$top_srcdir/test/tmp-$$ test_images=$top_srcdir/test/images From dacca27ac3d7096facf6689b0e6ee726fa47db9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Sun, 8 May 2016 21:51:07 +0200 Subject: [PATCH 3/5] Try running python tests in travis ci trusty env --- .travis.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc454de8..632ec158 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,23 @@ language: cpp +sudo: required +dist: trusty +cache: ccache before_install: - sudo apt-get update -qq - - sudo apt-get install automake gtk-doc-tools - - sudo apt-get install gobject-introspection - - sudo apt-get install libfftw3-dev libjpeg-turbo8-dev - - sudo apt-get install libpng12-dev libwebp-dev libtiff4-dev libxml2-dev - - sudo apt-get install swig libmagick++-dev bc - - sudo apt-get install libcfitsio3-dev libgsl0-dev libmatio-dev - - sudo apt-get install liborc-0.4-dev liblcms2-dev libpoppler-glib-dev - - sudo apt-get install librsvg2-dev libgif-dev + - sudo apt-get install -y + automake gtk-doc-tools + gobject-introspection + libfftw3-dev libjpeg-turbo8-dev + libpng12-dev libwebp-dev libtiff4-dev libxml2-dev + swig libmagick++-dev bc + libcfitsio3-dev libgsl0-dev libmatio-dev + liborc-0.4-dev liblcms2-dev libpoppler-glib-dev + librsvg2-dev libgif-dev + libpango1.0-dev libgsf-1-dev libopenslide-dev + python-dev python-gi-dev libgirepository1.0-dev before_script: - ./bootstrap.sh - - ./configure - - make - - sudo make install - - sudo ldconfig -script: - - make check + - PYTHON=/usr/bin/python ./configure + - make -j`nproc` +script: + - VERBOSE=1 make check From e71c247764e6162815f82a6e32a96c1364d21ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Thu, 2 Jun 2016 20:38:41 +0200 Subject: [PATCH 4/5] Make sure test_formats.sh exits on errors This is required to make sure we fail if a vips command fails, eg. due to a missing fixture. --- test/test_formats.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_formats.sh b/test/test_formats.sh index 130f0dcb..5cf471de 100755 --- a/test/test_formats.sh +++ b/test/test_formats.sh @@ -4,6 +4,7 @@ # as a test of the command-line interface # set -x +set -e . ./variables.sh From 14a64c7b4cf485616664882a43e1f44d185a9968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Fri, 3 Jun 2016 00:50:53 +0200 Subject: [PATCH 5/5] Configure Travis CI matrix build The following environments are used: * Ubuntu Precise (only cli tests are run) * Ubuntu Trusty (cli and python tests) * Mac OS X 10.11 / Xcode 7.3 / mozjpeg (cli and python tests) --- .travis.yml | 101 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 632ec158..f105dad2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,86 @@ language: cpp -sudo: required -dist: trusty -cache: ccache -before_install: - - sudo apt-get update -qq - - sudo apt-get install -y - automake gtk-doc-tools - gobject-introspection - libfftw3-dev libjpeg-turbo8-dev - libpng12-dev libwebp-dev libtiff4-dev libxml2-dev - swig libmagick++-dev bc - libcfitsio3-dev libgsl0-dev libmatio-dev - liborc-0.4-dev liblcms2-dev libpoppler-glib-dev - librsvg2-dev libgif-dev - libpango1.0-dev libgsf-1-dev libopenslide-dev - python-dev python-gi-dev libgirepository1.0-dev + before_script: - ./bootstrap.sh - - PYTHON=/usr/bin/python ./configure - - make -j`nproc` + - ./configure + --disable-dependency-tracking + --with-jpeg-includes=$JPEG/include + --with-jpeg-libraries=$JPEG/lib + - make -j$JOBS -s V=0 script: - - VERBOSE=1 make check + - make -Ctest -j$JOBS -s V=0 VERBOSE=1 check + +matrix: + fast_finish: true + allow_failures: + - os: osx + include: + - os: linux + sudo: required + dist: precise + env: + - PYTHON=/usr/bin/python + - JPEG=/usr + - JOBS=`nproc` + - LIBTOOLFLAGS=--quiet + cache: ccache + before_install: + - sudo apt-get update -qq + - sudo apt-get install -y + automake gtk-doc-tools + gobject-introspection + libfftw3-dev libjpeg-turbo8-dev + libpng12-dev libwebp-dev libtiff4-dev libxml2-dev + swig libmagick++-dev bc + libcfitsio3-dev libgsl0-dev libmatio-dev + liborc-0.4-dev liblcms2-dev libpoppler-glib-dev + librsvg2-dev libgif-dev + libpango1.0-dev + python-dev + + - os: linux + sudo: required + dist: trusty + env: + - PYTHON=/usr/bin/python + - JPEG=/usr + - JOBS=`nproc` + cache: ccache + before_install: + - sudo apt-get update -qq + - sudo apt-get install -y + automake gtk-doc-tools + gobject-introspection + libfftw3-dev libjpeg-turbo8-dev + libpng12-dev libwebp-dev libtiff4-dev libxml2-dev + swig libmagick++-dev bc + libcfitsio3-dev libgsl0-dev libmatio-dev + liborc-0.4-dev liblcms2-dev libpoppler-glib-dev + librsvg2-dev libgif-dev + libpango1.0-dev libgsf-1-dev libopenslide-dev + python-dev python-gi-dev libgirepository1.0-dev + + - os: osx + osx_image: xcode7.3 + env: + - PYTHON=/usr/local/bin/python + - JPEG=/usr/local/opt/mozjpeg + - PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig + - JOBS="`sysctl -n hw.ncpu`" + - PATH="/usr/local/opt/ccache/libexec:$PATH" + cache: ccache + before_install: + - brew tap homebrew/science + - brew update + - brew install ccache pkg-config automake + - brew install --ignore-dependencies gtk-doc + - brew reinstall + gobject-introspection + fftw mozjpeg libexif + libpng webp libtiff + swig imagemagick + cfitsio libmatio + orc little-cms2 poppler + pango libgsf openslide + librsvg giflib openexr + python pygobject3