utils: use absolute paths when opening files on Windows
[git-cola.git] / garden.yaml
blob4ba235787b415cb57d8462f251c5765f77ad118e
1 # Use "cargo install garden-tools" to install garden https://gitlab.com/garden-rs/garden
3 #   # Installation
4 #   garden install              # Install git-cola to the installation ${prefix}
5 #   garden doc                  # Generate documentation: html + manual pages
6 #   garden install docs         # Install documentation
8 #   # Variables can be overridden using "-D name=value", e.g.:
9 #   garden -D prefix=$PWD/dist install docs
10 #   garden -D DESTDIR=/tmp/stage -D prefix=/usr/local install
12 #   # Development
13 #   garden test                 # Run the test suite
14 #   garden fmt                  # Format code using "cercis"
15 #   garden html                 # Generate documentation: html only
16 #   garden man                  # Generate documentation: manual pages only
17 #   garden pot                  # Regenerate git-cola.pot with new translations
18 #   garden po                   # Update .po files with new translations from git-cola.pot
19 #   garden pages                # Install docs into the pages/ website sources.
20 #   garden build pages          # Generate the pages/ website from the html templates.
22 #   # macOS
23 #   garden macos/app            # Build a git-cola.app bundle
25 #   # Related Projects
26 #   garden grow pages           # Clone the Git Cola homepage
27 #   garden grow fedora          # Clone the Fedora packaging
28 #   garden grow deb             # Clone the Debian packaging
29 #   garden grow flatpak         # Clone the Flatpak packaging
30 trees:
31   git-cola:
32     description: The highly-caffeinated Git GUI
33     path: "${GARDEN_CONFIG_DIR}"
34     url: "git@gitlab.com:git-cola/git-cola.git"
35     commands:
36       clean: rm -rf build dist git_cola.egg-info git-cola-*.windows.zip
37       doc: garden ${GARDEN_CMD_VERBOSE} cmd docs html man -- "$@"
38       dev: ${PYTHON} -m venv --system-site-packages ${env_dir}
39       dev>:
40         - dev/extras
41         - dev/development
42         - dev/build
43       dev/build: ${activate} pip install --editable '.[build]'
44       dev/development: ${activate} pip install --editable '.[docs,dev,testing]'
45       dev/extras: ${activate} pip install --editable '.[extras]'
46       dev/pyqt6: ${activate} pip install --editable '.[pyqt6]'
47       dev/install: ${activate} pip install --editable .
48       dev/env: ${activate} "$@"
49       check>:
50         - test
51         - check/fmt
52         - doc
53       check/fmt: garden fmt -- --check
54       fmt: |
55         ${activate}
56         cercis --version
57         git ls-files -- '*.py' |
58         grep -v ^qtpy |
59         xargs cercis "$@"
60       html: garden ${GARDEN_CMD_VERBOSE} html docs
61       install: |
62         if test -n "${DESTDIR}"
63         then
64             pip_root="--root=${DESTDIR}"
65             export DESTDIR="${DESTDIR}"
66         fi
67         pip install --disable-pip-version-check $pip_root --prefix="${prefix}" "$@" .
68       i18n>:
69         - pot
70         - po
71       macos/app: |
72         mkdir -p ${cola_app}/Contents/MacOS
73         mkdir -p ${cola_app_resources}
74         ${PYTHON} -m venv ${cola_app_resources}
75         source ${cola_app_resources}/bin/activate
76         pip install '.[docs,extras,pyqt6]'
77         cp contrib/darwin/Info.plist contrib/darwin/PkgInfo ${cola_app}/Contents
78         if test -n "${cola_full_version}"
79         then
80             sed -i -e s/0.0.0.0/${cola_full_version}/ ${cola_app}/Contents/Info.plist
81         fi
82         sed -i -e s/0.0.0/${cola_version}/ ${cola_app}/Contents/Info.plist
83         cp contrib/darwin/git-cola ${cola_app}/Contents/MacOS
84         cp contrib/darwin/git-cola.icns ${cola_app}/Contents/Resources
85         garden ${GARDEN_CMD_VERBOSE} -D prefix=${cola_app_resources} install
86         garden ${GARDEN_CMD_VERBOSE} doc
87         garden ${GARDEN_CMD_VERBOSE} -D prefix=${cola_app_resources} install docs
88       man: garden ${GARDEN_CMD_VERBOSE} man docs
89       po: |
90         for po in cola/i18n/*.po
91         do
92             msgmerge \
93                 --no-wrap \
94                 --no-fuzzy-matching \
95                 --sort-output \
96                 --output-file $$po.new \
97                 $$po \
98                 cola/i18n/git-cola.pot
99             mv $$po.new $$po
100         done
101       pot: |
102         xgettext \
103             --language=Python \
104             --keyword=N_ \
105             --no-wrap \
106             --omit-header \
107             --sort-output \
108             --output-dir cola/i18n \
109             --output git-cola.pot \
110             cola/*.py \
111             cola/*/*.py
112       pages<: doc
113       pages: garden ${GARDEN_CMD_VERBOSE} -D prefix=${TREE_PATH}/pages install docs "$@"
114       publish: |
115         ${activate}
116         twine upload --sign dist/*.whl dist/*.tar.gz
117       run: ${activate} ./bin/git-cola "$@"
118       run/qt6: ${activate} QT_API=PyQt6 ./bin/git-cola "$@"
119       test: ${activate} ${PYTEST} cola test "$@"
120       tox: tox run "$@"
121       tox/check: tox run -e check "$@"
122       wheel: ${activate} python3 -m build -n .
123     gitconfig:
124       remote.publish.pushurl:
125         - "git@gitlab.com:git-cola/git-cola.git"
126         - "git@github.com:git-cola/git-cola.git"
127     remotes:
128       abid1998: "git@github.com:abid1998/git-cola.git"
129       achernet: "git@github.com:achernet/git-cola.git"
130       axel-h: "git@github.com:axel-h/git-cola.git"
131       BaumiCoder: "git@github.com:BaumiCoder/git-cola.git"
132       bearsh: "git@github.com:bearsh/git-cola.git"
133       bensmrs: "git@github.com:bensmrs/git-cola.git"
134       bobvanderlinden: "git@github.com:bobvanderlinden/git-cola.git"
135       brccabral: "git@github.com:brccabral/git-cola.git"
136       DasaniT: "git@github.com:DasaniT/git-cola.git"
137       davvid: "git@github.com:davvid/git-cola.git"
138       dschwoerer: "git@github.com:dschwoerer/git-cola.git"
139       florisla: "git@github.com:florisla/git-cola.git"
140       fu7mu4: "git@github.com:fu7mu4/git-cola.git"
141       gdebure: "git@github.com:gdebure/git-cola.git"
142       github: "git@github.com:git-cola/git-cola.git"
143       guoyunhe: "git@github.com:guoyunhe/git-cola.git"
144       gyuris: "git@github.com:gyuris/git-cola.git"
145       haffmans: "git@github.com:haffmans/git-cola.git"
146       harmathy: "git@github.com:harmathy/git-cola.git"
147       hsoft: "git@github.com:hsoft/git-cola.git"
148       jamie-pate: "git@github.com:jamie-pate/git-cola.git"
149       kenyuy: "git@github.com:kenyuy/git-cola.git"
150       kisaragi-hiu: "git@github.com:kisaragi-hiu/git-cola.git"
151       kneirinck: "git@github.com:kneirinck/git-cola.git"
152       kurtmckee: "git@github.com:kurtmckee/git-cola.git"
153       laerreal: "git@github.com:laerreal/git-cola.git"
154       lah7: "git@github.com:lah7/git-cola.git"
155       lefairy: "git@github.com:lefairy/git-cola.git"
156       living180: "git@github.com:living180/git-cola.git"
157       ljhcage: "git@github.com:ljhcage/git-cola.git"
158       Mailaender: "git@github.com:Mailaender/git-cola.git"
159       malpas: "git@github.com:malpas/git-cola.git"
160       melkecelioglu: "git@github.com:melkecelioglu/git-cola.git"
161       milestone12: "git@github.com:milestone12/git-cola.git"
162       Mithil467: "git@github.com:Mithil467/git-cola.git"
163       mmargoliono: "git@github.com:mmargoliono/git-cola"
164       mp-chet: "git@github.com:mp-chet/git-cola.git"
165       nakanoi: "git@github.com:nakanoi/git-cola.git"
166       nandalopes: "git@github.com:nandalopes/git-cola.git"
167       NielBuys: "git@github.com:NielBuys/git-cola.git"
168       OriShalhon: "git@github.com:OriShalhon/git-cola.git"
169       pilarmolinalopez: "git@github.com:pilarmolinalopez/git-cola.git"
170       quintusfelix: "git@github.com:quintusfelix/git-cola.git"
171       rafaelreuber: "git@github.com:rafaelreuber/git-cola.git"
172       scop: "git@github.com:scop/git-cola.git"
173       sergei-dyshel: "git@github.com:sergei-dyshel/git-cola.git"
174       skunkwerks: "git@github.com:skunkwerks/git-cola.git"
175       sthalik: "git@github.com:sthalik/git-cola.git"
176       takluyver: "git@github.com:takluyver/git-cola.git"
177       thk123: "git@github.com:thk123/git-cola.git"
178       timgates42: "git@github.com:timgates42/git-cola.git"
179       vdragon: "git@github.com:Vdragon/git-cola.git"
180       victorhck: "git@github.com:victorhck/git-cola.git"
181       virtualstaticvoid: "git@github.com:virtualstaticvoid/git-cola.git"
182       VishnuSanal: "git@github.com:VishnuSanal/git-cola.git"
183       wm4: "git@github.com:wm4/git-cola.git"
184       WNguyen14: "git@github.com:WNguyen14/git-cola.git"
185       wojnilowicz: "git@github.com:wojnilowicz/git-cola.git"
186       yaellevy: "git@github.com:yaellevy/git-cola.git"
187   deb:
188     description: Debian packaging
189     url: "git@gitlab.com:git-cola/git-cola-debian.git"
190     remotes:
191       davvid: "git@github.com:davvid/git-cola-debian.git"
192   docs:
193     description: Sphinx documentation
194     variables:
195       env_dir: ../env3
196     commands:
197       clean: rm -fr _build
198       doctest: ${activate} ${SPHINX} -b doctest . _build/doctest "$@"
199       html: ${activate} ${SPHINX} -b html . _build/html "$@"
200       man: ${activate} ${SPHINX} -b man . _build/man "$@"
201       linkcheck: ${activate} ${SPHINX} -b linkcheck . _build/linkcheck "$@"
202       install: |
203         mkdir -p "${DESTDIR}${docdir}"
204         install -m 644 *.html "${DESTDIR}${docdir}"
205         install -m 644 *.rst "${DESTDIR}${docdir}"
206         # HTML documentation
207         mkdir -p "${DESTDIR}${htmldir}"
208         rsync -r --delete --exclude=.buildinfo _build/html/ "${DESTDIR}${htmldir}/"
209         # Manual pages
210         mkdir -p "${DESTDIR}${mandir}"
211         install -m 644 _build/man/git-cola.1 "${DESTDIR}${mandir}"
212         install -m 644 _build/man/git-dag.1 "${DESTDIR}${mandir}"
213   fedora:
214     description: Fedora packaging
215     url: "https://src.fedoraproject.org/rpms/git-cola.git"
216     remotes:
217       git-cola: "git@gitlab.com:git-cola/git-cola-fedora.git"
218       davvid: "git@github.com:davvid/git-cola-fedora.git"
219   flatpak:
220     description: Flatpak packaging
221     url: "git@github.com:flathub/com.github.git_cola.git-cola.git"
222     variables:
223       app-id: com.github.git_cola.git-cola
224     commands:
225       build: flatpak-builder "$@" --user "${prefix}" "${app-id}.yml"
226       check: |
227         flatpak run --command=flatpak-builder-lint \
228             org.flatpak.Builder "$@" --exceptions builddir "${prefix}"
229       install: flatpak-builder "$@" --install --user "${prefix}" "${app-id}.yml"
230       run: flatpak run ${app-id}
231       setup: |
232         flatpak remote-add --user --if-not-exists \
233         flathub https://flathub.org/repo/flathub.flatpakrepo
234         flatpak install --user \
235         org.flatpak.Builder/x86_64 \
236         org.kde.Sdk/x86_64/5.15-23.08 \
237         org.kde.Platform/x86_64/5.15-23.08 \
238         com.riverbankcomputing.PyQt.BaseApp/x86_64/5.15-23.08
239   pages:
240     description: "Git Cola's homepage"
241     url: "git@gitlab.com:git-cola/git-cola.gitlab.io.git"
242     remotes:
243       github: "git@github.com:git-cola/git-cola.github.io.git"
244       ls-jad-elkik: "git://github.com/ls-jad-elkik/git-cola.github.io.git"
245       lz-coder: "https://github.com/lz-coder/git-cola.github.io.git"
246     gitconfig:
247       remote.origin.pushurl:
248         - "git@gitlab.com:git-cola/git-cola.gitlab.io.git"
249         - "git@github.com:git-cola/git-cola.github.io.git"
250     variables:
251       prefix: build
252       container-image: "jekyll/minimal:latest"
253     commands:
254       build: jekyll build --destination "${prefix}" "$@"
255       watch: |
256         while true
257         do
258           garden build ${GARDEN_CMD_VERBOSE} "$@"
259           inotifywait --event=close_write --recursive "${TREE_PATH}"
260         done
261       build/podman: |
262         uid=$${UID:-$(id -u)}
263         gid=$${GID:-$(id -g)}
264         podman \
265           run \
266           --interactive \
267           --rm \
268           --user="$uid:$gid" \
269           --userns keep-id:uid=$uid,gid=$gid \
270           --volume="${TREE_PATH}:/srv/jekyll" \
271           --workdir "${TREE_PATH}" \
272           "${container-image}" \
273           jekyll build --destination "${prefix}" "$@"
274       sanitize: dos2unix share/doc/git-cola/*.html share/doc/git-cola/html/*.html
275       setup: sudo apt install inotify-tools jekyll
276     links:
277       - "https://git-cola.gitlab.io"
278       - "https://git-cola.github.io"
279   todo:
280     description: Maintainer scripts and notes
281     worktree: git-cola
282     branch: todo
284 commands:
285   commit: git commit "$@"
286   diff: git diff "$@"
287   diffs: git diff --staged "$@"
288   fetch: git fetch "$@"
289   stat: git status --short "$@"
290   status: git status "$@"
291   stage: git add -u "$@"
292   push: git push "$@"
293   pull: git pull --ff-only "$@"
295 # Variables can be overridden externally using "garden -D name=value ...".
296 variables:
297   # DESTDIR + prefix variables: https://www.gnu.org/software/make/manual/html_node/DESTDIR.html
298   DESTDIR: ""
299   prefix: ${GARDEN_CONFIG_DIR}/dist
300   docdir: ${prefix}/share/doc/git-cola
301   htmldir: ${docdir}/html
302   mandir: ${prefix}/share/man/man1
303   cola_app: ${TREE_PATH}/git-cola.app
304   cola_app_resources: ${cola_app}/Contents/Resources
305   cola_full_version: $ ./bin/git-cola version --brief --builtin
306   cola_version: $ sed -e "s/VERSION = '\(.*\)'/\1/"  cola/_version.py
307   is_virtualenv: |
308     $ ${PYTHON} -c '
309     import os, sys
310     if sys.prefix != sys.base_prefix or os.environ.get("VIRTUAL_ENV"):
311         print("true")
312     '
313   env_dir: env3
314   activate: |
315     if test -z "${is_virtualenv}" && test -f "${env_dir}/bin/activate"
316     then
317         source "${env_dir}/bin/activate"
318     fi
319   # External commands and options
320   PYTEST: ${PYTHON} -B -m pytest ${PYTEST_OPTIONS}
321   PYTEST_OPTIONS: $ test "$(uname -s)" != Linux && printf '%s' --ignore=cola/inotify.py
322   PYTHON: python3
323   SPHINX: ${PYTHON} -m sphinx -d _build/doctrees -a