diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e555e9..bd0e885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # v0.1.7 +- #21 Build scripts to exit on failure - #15 Mac OS X build of decode_barcodes - #14 Suffixes to resolve filename collisions diff --git a/build.bat b/build.bat index 60ae2a6..25ebdd3 100644 --- a/build.bat +++ b/build.bat @@ -2,10 +2,14 @@ REM Temporary solution until I get round to writing a makefile echo Clean del /S *pyc -del *spec rmdir /Q /S dist build +echo Check for presence of barcode engines +python -c "from gouda.engines import ZbarEngine; assert ZbarEngine.available()" || exit /b +python -c "from gouda.engines import LibDMTXEngine; assert LibDMTXEngine.available()" || exit /b +python -c "from gouda.engines import InliteEngine; assert InliteEngine.available()" || exit /b + echo Tests -nosetests --with-coverage --cover-html --cover-inclusive --cover-erase --cover-tests --cover-package=gouda +nosetests --with-coverage --cover-html --cover-inclusive --cover-erase --cover-tests --cover-package=gouda || exit /b -pyinstaller --onefile --specpath=build gouda/scripts/decode_barcodes.py +pyinstaller --onefile --clean decode_barcodes.spec || exit /b diff --git a/build.sh b/build.sh index e54c94d..8a91d66 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,10 @@ find . -name "*pyc" -print0 | xargs -0 rm -rf find . -name __pycache__ -print0 | xargs -0 rm -rf rm -rf dist build cover +echo Check for presence of barcode engines +python -c "from gouda.engines import ZbarEngine; assert ZbarEngine.available()" || exit /b +python -c "from gouda.engines import LibDMTXEngine; assert LibDMTXEngine.available()" || exit /b + echo Tests nosetests --with-coverage --cover-html --cover-inclusive --cover-erase --cover-tests --cover-package=gouda diff --git a/decode_barcodes.spec b/decode_barcodes.spec index 867a8c4..339e9cf 100644 --- a/decode_barcodes.spec +++ b/decode_barcodes.spec @@ -18,38 +18,39 @@ a = Analysis(['gouda/scripts/decode_barcodes.py'], win_private_assemblies=False, cipher=block_cipher) -# PyInstaller does not detect some dylibs, I think in some cases because they -# are symlinked. -# See Stack Overflow post http://stackoverflow.com/a/17595149 for example -# of manipulating Analysis.binaries. +if 'darwin' == sys.platform: + # PyInstaller does not detect some dylibs, I think in some cases because they + # are symlinked. + # See Stack Overflow post http://stackoverflow.com/a/17595149 for example + # of manipulating Analysis.binaries. -MISSING_DYLIBS = ( - 'libpng16.16.dylib', - 'libz.1.dylib', - 'libopencv_contrib.2.4.dylib', - 'libopencv_nonfree.2.4.dylib', - 'libopencv_gpu.2.4.dylib', - 'libopencv_legacy.2.4.dylib', - 'libopencv_photo.2.4.dylib', - 'libopencv_ocl.2.4.dylib', - 'libopencv_calib3d.2.4.dylib', - 'libopencv_features2d.2.4.dylib', - 'libopencv_flann.2.4.dylib', - 'libopencv_ml.2.4.dylib', - 'libopencv_video.2.4.dylib', - 'libopencv_objdetect.2.4.dylib', - 'libopencv_highgui.2.4.dylib', - 'libopencv_imgproc.2.4.dylib', - 'libopencv_core.2.4.dylib', -) + MISSING_DYLIBS = ( + 'libpng16.16.dylib', + 'libz.1.dylib', + 'libopencv_contrib.2.4.dylib', + 'libopencv_nonfree.2.4.dylib', + 'libopencv_gpu.2.4.dylib', + 'libopencv_legacy.2.4.dylib', + 'libopencv_photo.2.4.dylib', + 'libopencv_ocl.2.4.dylib', + 'libopencv_calib3d.2.4.dylib', + 'libopencv_features2d.2.4.dylib', + 'libopencv_flann.2.4.dylib', + 'libopencv_ml.2.4.dylib', + 'libopencv_video.2.4.dylib', + 'libopencv_objdetect.2.4.dylib', + 'libopencv_highgui.2.4.dylib', + 'libopencv_imgproc.2.4.dylib', + 'libopencv_core.2.4.dylib', + ) -# The lib directory associated with this environment -LIB = Path(sys.argv[0]).parent.parent.joinpath('lib') + # The lib directory associated with this environment + LIB = Path(sys.argv[0]).parent.parent.joinpath('lib') -# Find the source for each library and add it to the list of binaries -a.binaries += TOC([ - (lib, str(LIB.joinpath(lib).resolve()), 'BINARY') for lib in MISSING_DYLIBS -]) + # Find the source for each library and add it to the list of binaries + a.binaries += TOC([ + (lib, str(LIB.joinpath(lib).resolve()), 'BINARY') for lib in MISSING_DYLIBS + ]) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) diff --git a/gouda/tests/test_decode_barcodes.py b/gouda/tests/test_decode_barcodes.py index 8d02c16..20794b8 100644 --- a/gouda/tests/test_decode_barcodes.py +++ b/gouda/tests/test_decode_barcodes.py @@ -48,7 +48,7 @@ def test_rename_with_collisions(self): main(['zbar', '--action=rename', unicode(tempdir)]) self.assertEqual( ['Stegosaurus.png', 'first copy.png', 'second copy.png'], - [path.name for path in sorted(tempdir.iterdir())] + [path.name for path in sorted(tempdir.iterdir(), key=lambda p: p.name)] ) def test_rename_avoid_collisions(self):