diff options
author | zeroinformatique | 2022-11-11 00:29:42 +0100 |
---|---|---|
committer | GitHub | 2022-11-11 00:29:42 +0100 |
commit | ddadf9798b7f874aa0a829d55987ec0d105efa6d (patch) | |
tree | f208efeec53d97dd53cbd61f6fe4dfe824d8754c | |
parent | bb3b0eae37a7214a3a4a6a1e4354e6f082adf15e (diff) | |
parent | 7ae7e904303dd623398495c2d61d1acadfe96fb1 (diff) | |
download | ldgallery-ddadf9798b7f874aa0a829d55987ec0d105efa6d.tar.gz |
Merge pull request #346 from ldgallery/p_compiler_logging
compiler: fix support for non-utf8 terminals, add more steps prints
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | compiler/app/Main.hs | 5 | ||||
-rw-r--r-- | compiler/package.yaml | 3 | ||||
-rw-r--r-- | compiler/src/Compiler.hs | 6 | ||||
-rw-r--r-- | compiler/stack.yaml | 2 | ||||
-rw-r--r-- | compiler/stack.yaml.lock | 8 | ||||
-rw-r--r-- | flake.nix | 2 |
7 files changed, 16 insertions, 11 deletions
diff --git a/changelog.md b/changelog.md index 07a6d3a..66de4b9 100644 --- a/changelog.md +++ b/changelog.md | |||
@@ -11,6 +11,7 @@ release. Releases are tracked and referred to using git tags. | |||
11 | - Bug fixes: | 11 | - Bug fixes: |
12 | - compiler: fix detection of dimensions of EXIF-rotated pictures. | 12 | - compiler: fix detection of dimensions of EXIF-rotated pictures. |
13 | Rebuild the gallery with `--rebuild-all` to purge erroneous cached data. | 13 | Rebuild the gallery with `--rebuild-all` to purge erroneous cached data. |
14 | - compiler: fix support for non-UTF8 terminals. | ||
14 | - viewer: fix theme quirks (line spacing, icon colours). | 15 | - viewer: fix theme quirks (line spacing, icon colours). |
15 | - viewer: fix ghost keyboard hints when the search panel is closed. | 16 | - viewer: fix ghost keyboard hints when the search panel is closed. |
16 | 17 | ||
diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs index 3e6f254..a9630ce 100644 --- a/compiler/app/Main.hs +++ b/compiler/app/Main.hs | |||
@@ -1,7 +1,7 @@ | |||
1 | -- ldgallery - A static generator which turns a collection of tagged | 1 | -- ldgallery - A static generator which turns a collection of tagged |
2 | -- pictures into a searchable web gallery. | 2 | -- pictures into a searchable web gallery. |
3 | -- | 3 | -- |
4 | -- Copyright (C) 2019-2021 Pacien TRAN-GIRARD | 4 | -- Copyright (C) 2019-2022 Pacien TRAN-GIRARD |
5 | -- | 5 | -- |
6 | -- This program is free software: you can redistribute it and/or modify | 6 | -- This program is free software: you can redistribute it and/or modify |
7 | -- it under the terms of the GNU Affero General Public License as | 7 | -- it under the terms of the GNU Affero General Public License as |
@@ -28,6 +28,7 @@ import Data.Aeson (ToJSON) | |||
28 | import System.FilePath ((</>)) | 28 | import System.FilePath ((</>)) |
29 | import System.Directory (canonicalizePath, listDirectory) | 29 | import System.Directory (canonicalizePath, listDirectory) |
30 | import System.Console.CmdArgs | 30 | import System.Console.CmdArgs |
31 | import Main.Utf8 (withUtf8) | ||
31 | 32 | ||
32 | import Compiler | 33 | import Compiler |
33 | import Files (readDirectory, copyTo, remove) | 34 | import Files (readDirectory, copyTo, remove) |
@@ -103,7 +104,7 @@ options = Options | |||
103 | 104 | ||
104 | main :: IO () | 105 | main :: IO () |
105 | main = | 106 | main = |
106 | do | 107 | withUtf8 $ do |
107 | opts <- cmdArgs options | 108 | opts <- cmdArgs options |
108 | buildGallery opts | 109 | buildGallery opts |
109 | deployViewer opts | 110 | deployViewer opts |
diff --git a/compiler/package.yaml b/compiler/package.yaml index 7bd86e9..0c07efe 100644 --- a/compiler/package.yaml +++ b/compiler/package.yaml | |||
@@ -4,7 +4,7 @@ homepage: https://ldgallery.pacien.org | |||
4 | github: "pacien/ldgallery" | 4 | github: "pacien/ldgallery" |
5 | license: AGPL-3 | 5 | license: AGPL-3 |
6 | author: "Pacien TRAN-GIRARD, Guillaume FOUET" | 6 | author: "Pacien TRAN-GIRARD, Guillaume FOUET" |
7 | copyright: "2019-2021 Pacien TRAN-GIRARD, Guillaume FOUET" | 7 | copyright: "2019-2022 Pacien TRAN-GIRARD, Guillaume FOUET" |
8 | 8 | ||
9 | extra-source-files: | 9 | extra-source-files: |
10 | - readme.md | 10 | - readme.md |
@@ -29,6 +29,7 @@ dependencies: | |||
29 | - safe | 29 | - safe |
30 | - time | 30 | - time |
31 | - process | 31 | - process |
32 | - with-utf8 | ||
32 | 33 | ||
33 | default-extensions: | 34 | default-extensions: |
34 | - DuplicateRecordFields | 35 | - DuplicateRecordFields |
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index 4111f02..d92d8e9 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -85,7 +85,8 @@ loadGalleryIndex path = | |||
85 | doesFileExist path >>= bool (return Nothing) decodeIndex | 85 | doesFileExist path >>= bool (return Nothing) decodeIndex |
86 | where | 86 | where |
87 | decodeIndex = | 87 | decodeIndex = |
88 | JSON.eitherDecodeFileStrict path | 88 | putStrLn ("Loading previous index:\t" ++ path) |
89 | >> JSON.eitherDecodeFileStrict path | ||
89 | >>= either (\err -> warn err >> return Nothing) (return . Just) | 90 | >>= either (\err -> warn err >> return Nothing) (return . Just) |
90 | warn = putStrLn . ("Warning:\tUnable to reuse existing index as cache: " ++) | 91 | warn = putStrLn . ("Warning:\tUnable to reuse existing index as cache: " ++) |
91 | 92 | ||
@@ -136,10 +137,13 @@ compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDir | |||
136 | do | 137 | do |
137 | config <- readConfig $ inputGalleryConf configPath | 138 | config <- readConfig $ inputGalleryConf configPath |
138 | 139 | ||
140 | putStrLn "Inventorying input files" | ||
139 | inputDir <- readDirectory inputDirPath | 141 | inputDir <- readDirectory inputDirPath |
140 | excludedCanonicalDirs <- mapM canonicalizePath excludedDirs | 142 | excludedCanonicalDirs <- mapM canonicalizePath excludedDirs |
143 | |||
141 | let sourceFilter = galleryDirFilter config excludedCanonicalDirs | 144 | let sourceFilter = galleryDirFilter config excludedCanonicalDirs |
142 | let sourceTree = filterDir sourceFilter inputDir | 145 | let sourceTree = filterDir sourceFilter inputDir |
146 | putStrLn "Reading input metadata" | ||
143 | inputTree <- readInputTree sourceTree | 147 | inputTree <- readInputTree sourceTree |
144 | let curatedInputTree = filterInputTree (inputTreeFilter config) inputTree | 148 | let curatedInputTree = filterInputTree (inputTreeFilter config) inputTree |
145 | 149 | ||
diff --git a/compiler/stack.yaml b/compiler/stack.yaml index 67e823b..b75c56f 100644 --- a/compiler/stack.yaml +++ b/compiler/stack.yaml | |||
@@ -17,7 +17,7 @@ | |||
17 | # | 17 | # |
18 | # resolver: ./custom-snapshot.yaml | 18 | # resolver: ./custom-snapshot.yaml |
19 | # resolver: https://example.com/snapshots/2018-01-01.yaml | 19 | # resolver: https://example.com/snapshots/2018-01-01.yaml |
20 | resolver: lts-16.19 | 20 | resolver: lts-19.30 |
21 | 21 | ||
22 | 22 | ||
23 | # User packages to be built. | 23 | # User packages to be built. |
diff --git a/compiler/stack.yaml.lock b/compiler/stack.yaml.lock index 93f79d9..dc48671 100644 --- a/compiler/stack.yaml.lock +++ b/compiler/stack.yaml.lock | |||
@@ -6,7 +6,7 @@ | |||
6 | packages: [] | 6 | packages: [] |
7 | snapshots: | 7 | snapshots: |
8 | - completed: | 8 | - completed: |
9 | size: 532177 | 9 | sha256: 9a74d76d250a455d9cd11e74f157e087787fa9aa3c4264e69c94703d1e71aede |
10 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/19.yaml | 10 | size: 619200 |
11 | sha256: d2b828ecf50386841d0c5700b58d38566992e10d63a062af497ab29ab031faa1 | 11 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/30.yaml |
12 | original: lts-16.19 | 12 | original: lts-19.30 |
@@ -123,8 +123,6 @@ | |||
123 | src = ./example; | 123 | src = ./example; |
124 | nativeBuildInputs = [ ldgallery ]; | 124 | nativeBuildInputs = [ ldgallery ]; |
125 | buildPhase = '' | 125 | buildPhase = '' |
126 | # Need UTF-8: https://github.com/ldgallery/ldgallery/issues/341 | ||
127 | export LC_ALL=C.UTF-8 | ||
128 | ldgallery --input-dir src --output-dir $out --with-viewer | 126 | ldgallery --input-dir src --output-dir $out --with-viewer |
129 | ''; | 127 | ''; |
130 | installPhase = ":"; | 128 | installPhase = ":"; |