diff --git a/.travis.yml b/.travis.yml index cc454de8..f105dad2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,86 @@ language: cpp -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 + before_script: - ./bootstrap.sh - - ./configure - - make - - sudo make install - - sudo ldconfig -script: - - make check + - ./configure + --disable-dependency-tracking + --with-jpeg-includes=$JPEG/include + --with-jpeg-libraries=$JPEG/lib + - make -j$JOBS -s V=0 +script: + - 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 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/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_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 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 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