| tattempt to install and use imagemagick via Homebrew.jl - Granular.jl - Julia p… | |
| git clone git://src.adamsgaard.dk/Granular.jl | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit 16941e6bdbc0bf4e555617da7db0b2a3efa820a8 | |
| parent 48271f6efda6a8ef3755618f89f0ee309c07e353 | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Tue, 7 Nov 2017 11:56:38 -0500 | |
| attempt to install and use imagemagick via Homebrew.jl | |
| Diffstat: | |
| M REQUIRE | 2 ++ | |
| A deps/build.jl | 13 +++++++++++++ | |
| M docs/src/man/installation.md | 25 +++++++++++++++++++++++-- | |
| M src/io.jl | 15 ++++++++++++--- | |
| 4 files changed, 50 insertions(+), 5 deletions(-) | |
| --- | |
| diff --git a/REQUIRE b/REQUIRE | |
| t@@ -2,3 +2,5 @@ julia 0.6 | |
| WriteVTK | |
| NetCDF | |
| Documenter | |
| +@osx Homebrew | |
| +BinDeps | |
| diff --git a/deps/build.jl b/deps/build.jl | |
| t@@ -0,0 +1,13 @@ | |
| +#!/usr/bin/env julia | |
| +using BinDeps | |
| + | |
| [email protected] | |
| + | |
| +imagemagick = library_dependency("imagemagick") | |
| + | |
| +if is_apple() | |
| + using Homebrew | |
| + provides(Homebrew.HB, "imagemagick", imagemagick, os = :Darwin) | |
| +end | |
| + | |
| [email protected] Dict(:imagemagick => :imagemagick) | |
| diff --git a/docs/src/man/installation.md b/docs/src/man/installation.md | |
| t@@ -1,6 +1,25 @@ | |
| # Installation | |
| -Julia includes a very useful package manager which makes it easy to install | |
| -packages and their requirements, as well as convenient updating features. | |
| + | |
| +## Prerequisites | |
| +Granular.jl is written as a package for the [Julia programming | |
| +language](https://julialang.org), which is a computationally efficient, yet | |
| +high-level language. Julia also includes a very useful package manager which | |
| +makes it easy to install packages and their requirements, as well as convenien… | |
| +updating features. | |
| + | |
| +### Installing Julia | |
| +If you do not have Julia installed, download the current release from the | |
| +[official Julia download page](https://julialang.org/downloads), or using your | |
| +system package manager (e.g. `brew cask install julia` on macOS with the | |
| +[Homebrew package manager](https://brew.sh)). Afterwards, the program `julia` | |
| +can be launched from the terminal. | |
| + | |
| +### Installing Paraview | |
| +The core visualization functionality of Granular.jl is based on VTK and | |
| +ParaView. The most recent stable release can be downloaded from the [ParaView | |
| +downloads page](https://www.paraview.org/download/). Alternatively, on macOS | |
| +with Homebrew, Paraview can be installed from the terminal with `brew cask | |
| +install paraview`. | |
| ## Stable installation (recommended) | |
| The latest stable release of Granular.jl can be installed directly from the | |
| t@@ -51,3 +70,5 @@ julia> Pkg.test("Granular") | |
| In case any of these tests fail, please open a [Github | |
| Issue](https://github.com/anders-dc/Granular.jl/issues) describing the problem… | |
| so further investigation and diagnosis can follow. | |
| + | |
| + | |
| diff --git a/src/io.jl b/src/io.jl | |
| t@@ -943,19 +943,28 @@ function render(simulation::Simulation; pvpython::String… | |
| if trim | |
| trim_string = "-trim" | |
| end | |
| - run(`convert $trim_string +repage -delay 10 | |
| + | |
| + # use ImageMagick installed with Homebrew.jl if available, | |
| + # otherwise search for convert in $PATH | |
| + convert = "convert" | |
| + if is_apple() | |
| + import Homebrew | |
| + convert = Homebrew.prefix() * "/bin/convert" | |
| + end | |
| + | |
| + run(`$convert $trim_string +repage -delay 10 | |
| -transparent-color white | |
| -loop 0 $(simulation.id)/$(simulation.id).'*'.png | |
| $(simulation.id)/$(simulation.id).gif`) | |
| if reverse | |
| - run(`convert -trim +repage -delay 10 -transparent-color wh… | |
| + run(`$convert -trim +repage -delay 10 -transparent-color w… | |
| -loop 0 -reverse | |
| $(simulation.id)/$(simulation.id).'*'.png | |
| $(simulation.id)/$(simulation.id)-reverse.gif`) | |
| end | |
| catch return_signal | |
| if isa(return_signal, Base.UVError) | |
| - info("Skipping gif merge since `convert` was not found.") | |
| + info("Skipping gif merge since `$convert` was not found.") | |
| end | |
| end | |
| end |