Debian Codegraph @

Makefile

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 .PHONY: build dev
2
3 PYTHON?=python3
4 PYTHON_INTERPRETER?=$(PYTHON)
5 MODULE:=guake
6 DESTDIR:=/
7 PREFIX?=/usr/local
8 exec_prefix:=$(PREFIX)
9 bindir = $(exec_prefix)/bin
10
11 # Use site.getsitepackages([PREFIX]) to guess possible install paths for uninstall.
12 PYTHON_SITEDIRS_FOR_PREFIX="env PREFIX=$(PREFIX) $(PYTHON_INTERPRETER) scripts/all-sitedirs-in-prefix.py"
13 ROOT_DIR=$(shell pwd)
14 DATA_DIR=$(ROOT_DIR)/guake/data
15 COMPILE_SCHEMA:=1
16
17 datarootdir:=$(PREFIX)/share
18 datadir:=$(datarootdir)
19 localedir:=$(datarootdir)/locale
20 gsettingsschemadir:=$(datarootdir)/glib-2.0/schemas
21
22 AUTOSTART_FOLDER:=~/.config/autostart
23
24 DEV_DATA_DIR:=$(DATA_DIR)
25
26 SHARE_DIR:=$(datadir)/guake
27 GUAKE_THEME_DIR:=$(SHARE_DIR)/guake
28 LOGIN_DESTOP_PATH = $(SHARE_DIR)
29 IMAGE_DIR:=$(SHARE_DIR)/pixmaps
30 GLADE_DIR:=$(SHARE_DIR)
31 SCHEMA_DIR:=$(gsettingsschemadir)
32
33 SLUG:=fragment_name
34
35 default: prepare-install
36 # 'make' target, so users can install guake without need to install the 'dev' dependencies
37
38 prepare-install: generate-desktop generate-paths generate-mo compile-glib-schemas-dev
39
40 reset:
41 dconf reset -f /org/guake/
42
43
44 all: clean dev style checks dists test docs
45
46 dev: clean-ln-venv ensure-pip pipenv-install-dev requirements ln-venv setup-githook \
47 prepare-install install-dev-locale
48 dev-actions: ensure-pip-system pipenv-install-dev prepare-install
49
50 ensure-pip:
51 ./scripts/bootstrap-dev-pip.sh
52
53 ensure-pip-system:
54 ./scripts/bootstrap-dev-pip.sh system
55
56 dev-no-pipenv: clean
57 virtualenv --python $(PYTHON_INTERPRETER) .venv
58 . .venv/bin/activate && pip install -r requirements.txt -r requirements-dev.txt -e .
59
60 pipenv-install-dev:
61 PIPENV_IGNORE_VIRTUALENVS=1 pipenv install --dev --python $(PYTHON_INTERPRETER)
62
63 ln-venv:
64 # use that to configure a symbolic link to the virtualenv in .venv
65 rm -rf .venv
66 ln -s $$(pipenv --venv) .venv
67
68 clean-ln-venv:
69 @rm -f .venv
70
71 install-system: install-schemas install-locale install-guake
72
73 install-guake:
74 # you probably want to execute this target with sudo:
75 # sudo make install
76 @echo "#############################################################"
77 @echo
78 @echo "Installing from source on your system is not recommended."
79 @echo "Please prefer you application package manager (apt, yum, ...)"
80 @echo
81 @echo "#############################################################"
82 @if [ "$(DESTDIR)" = "" ]; then $(PYTHON_INTERPRETER) -m pip install -r requirements.txt; fi
83
84 @if [ `python -c "import sys; print(sys.version_info[0])"` -eq 2 ]; then SETUPTOOLS_SCM_PRETEND_VERSION=3.9.0; fi
85
86 @rm -f guake/paths.py.dev
87 @if [ -f guake/paths.py ]; then mv guake/paths.py guake/paths.py.dev; fi
88 @cp -f guake/paths.py.in guake/paths.py
89 @sed -i -e 's|{{ LOCALE_DIR }}|"$(localedir)"|g' guake/paths.py
90 @sed -i -e 's|{{ IMAGE_DIR }}|"$(IMAGE_DIR)"|g' guake/paths.py
91 @sed -i -e 's|{{ GLADE_DIR }}|"$(GLADE_DIR)"|g' guake/paths.py
92 @sed -i -e 's|{{ GUAKE_THEME_DIR }}|"$(GUAKE_THEME_DIR)"|g' guake/paths.py
93 @sed -i -e 's|{{ SCHEMA_DIR }}|"$(SCHEMA_DIR)"|g' guake/paths.py
94 @sed -i -e 's|{{ LOGIN_DESTOP_PATH }}|"$(LOGIN_DESTOP_PATH)"|g' guake/paths.py
95 @sed -i -e 's|{{ AUTOSTART_FOLDER }}|"$(AUTOSTART_FOLDER)"|g' guake/paths.py
96
97 @$(PYTHON_INTERPRETER) -m pip install . --root "$(DESTDIR)" --prefix="/usr" || echo -e "\033[31;1msetup.py install failed, you may need to run \"sudo git config --global --add safe.directory '*'\"\033[0m"
98
99 @rm -f guake/paths.py
100 @if [ -f guake/paths.py.dev ]; then mv guake/paths.py.dev guake/paths.py; fi
101
102 @update-desktop-database || echo "Could not run update-desktop-database, are you root?"
103 @rm -rfv build *.egg-info
104
105 install-locale:
106 for f in $$(find po -iname "*.mo"); do \
107 l="$${f%%.*}"; \
108 lb=$$(basename $$l); \
109 install -Dm644 "$$f" "$(DESTDIR)$(localedir)/$$lb/LC_MESSAGES/guake.mo"; \
110 done;
111
112 install-dev-locale:
113 for f in $$(find po -iname "*.mo"); do \
114 l="$${f%%.*}"; \
115 lb=$$(basename $$l); \
116 install -Dm644 "$$f" "guake/po/$$lb/LC_MESSAGES/guake.mo"; \
117 done;
118
119 uninstall-locale:
120 find $(DESTDIR)$(localedir)/ -name "guake.mo" -exec rm -f "{}" + || :
121 # prune two levels of empty locale/ subdirs
122 find "$(DESTDIR)$(localedir)" -type d -a -empty -exec rmdir "{}" + || :
123 find "$(DESTDIR)$(localedir)" -type d -a -empty -exec rmdir "{}" + || :
124
125 uninstall-dev-locale:
126 @rm -rf guake/po
127
128 install-schemas:
129 install -dm755 "$(DESTDIR)$(datadir)/applications"
130 install -Dm644 "$(DEV_DATA_DIR)/guake.desktop" "$(DESTDIR)$(datadir)/applications/"
131 install -Dm644 "$(DEV_DATA_DIR)/guake-prefs.desktop" "$(DESTDIR)$(datadir)/applications/"
132 install -dm755 "$(DESTDIR)$(datadir)/metainfo/"
133 install -Dm644 "$(DEV_DATA_DIR)/guake.desktop.metainfo.xml" "$(DESTDIR)$(datadir)/metainfo/"
134 install -dm755 "$(DESTDIR)$(IMAGE_DIR)"
135 install -Dm644 "$(DEV_DATA_DIR)"/pixmaps/*.png "$(DESTDIR)$(IMAGE_DIR)/"
136 install -Dm644 "$(DEV_DATA_DIR)"/pixmaps/*.svg "$(DESTDIR)$(IMAGE_DIR)/"
137 install -dm755 "$(DESTDIR)$(PREFIX)/share/pixmaps"
138 install -Dm644 "$(DEV_DATA_DIR)/pixmaps/guake.png" "$(DESTDIR)$(PREFIX)/share/pixmaps/"
139 install -dm755 "$(DESTDIR)$(SHARE_DIR)"
140 install -Dm644 "$(DEV_DATA_DIR)/autostart-guake.desktop" "$(DESTDIR)$(SHARE_DIR)/"
141 install -dm755 "$(DESTDIR)$(GLADE_DIR)"
142 install -Dm644 "$(DEV_DATA_DIR)"/*.glade "$(DESTDIR)$(GLADE_DIR)/"
143 install -dm755 "$(DESTDIR)$(SCHEMA_DIR)"
144 install -Dm644 "$(DEV_DATA_DIR)/org.guake.gschema.xml" "$(DESTDIR)$(SCHEMA_DIR)/"
145 if [ $(COMPILE_SCHEMA) = 1 ]; then glib-compile-schemas $(DESTDIR)$(SCHEMA_DIR); fi
146
147 uninstall-system: uninstall-schemas uninstall-locale
148 $(SHELL) -c $(PYTHON_SITEDIRS_FOR_PREFIX) \
149 | while read sitedir; do \
150 echo "rm -rf $(DESTDIR)$$sitedir/{guake,guake-*.egg-info}"; \
151 rm -rf $(DESTDIR)$$sitedir/guake; \
152 rm -rf $(DESTDIR)$$sitedir/guake-*.egg-info; \
153 done
154 rm -f "$(DESTDIR)$(bindir)/guake"
155 rm -f "$(DESTDIR)$(bindir)/guake-prefs"
156 rm -f "$(DESTDIR)$(bindir)/guake-toggle"
157
158 purge-system: uninstall-system reset
159
160 uninstall-schemas:
161 rm -f "$(DESTDIR)$(datadir)/applications/guake.desktop"
162 rm -f "$(DESTDIR)$(datadir)/applications/guake-prefs.desktop"
163 rm -f "$(DESTDIR)$(datadir)/metainfo/guake.desktop.metainfo.xml"
164 rm -f "$(DESTDIR)$(datadir)/pixmaps/guake.png"
165 rm -fr "$(DESTDIR)$(IMAGE_DIR)"
166 rm -fr "$(DESTDIR)$(SHARE_DIR)"
167 rm -f "$(DESTDIR)$(SCHEMA_DIR)/org.guake.gschema.xml"
168 rm -f "$(DESTDIR)$(SCHEMA_DIR)/gschemas.compiled"
169
170 reinstall:
171 sudo make uninstall && make && sudo make install && $(DESTDIR)$(bindir)/guake
172
173 reinstall-v:
174 sudo make uninstall && make && sudo make install && $(DESTDIR)$(bindir)/guake -v
175
176 compile-glib-schemas-dev: clean-schemas
177 glib-compile-schemas --strict $(DEV_DATA_DIR)
178
179 clean-schemas:
180 rm -f $(DEV_DATA_DIR)/gschemas.compiled
181
182 style:
183 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pre-commit run --all-files
184
185 black:
186 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run black $(MODULE)
187
188
189 checks: black-check flake8 pylint reno-lint
190
191 black-check:
192 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run black --check $(MODULE) --extend-exclude $(MODULE)/_version.py
193
194 flake8:
195 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run flake8 guake
196
197 pylint:
198 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pylint --rcfile=.pylintrc --output-format=colorized $(MODULE)
199
200 sc: style check
201
202 dists: update-po requirements prepare-install rm-dists sdist bdist wheels
203 build: dists
204
205 sdist: generate-paths
206 export SKIP_GIT_SDIST=1 && PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python setup.py sdist
207
208 rm-dists:
209 rm -rf build dist
210
211 bdist: generate-paths
212 # pipenv run python setup.py bdist
213 @echo "Ignoring build of bdist package"
214
215 wheels: generate-paths
216 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python setup.py bdist_wheel
217
218 wheel: wheels
219
220 run-local: compile-glib-schemas-dev
221 ifdef V
222 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run ./scripts/run-local.sh -v
223 else
224 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run ./scripts/run-local.sh
225 endif
226
227 run-local-prefs: compile-glib-schemas-dev
228 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run ./scripts/run-local-prefs.sh
229
230 run-fr: compile-glib-schemas-dev
231 LC_ALL=fr_FR.UTF8 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run ./scripts/run-local.sh
232
233
234 shell:
235 PIPENV_IGNORE_VIRTUALENVS=1 pipenv shell
236
237
238 test:
239 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pytest $(MODULE)
240
241 test-actions:
242 xvfb-run -a pipenv run pytest $(MODULE)
243 test-coverage:
244 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run py.test -v --cov $(MODULE) --cov-report term-missing
245
246 test-pip-install-sdist: clean-pip-install-local generate-paths sdist
247 @echo "Testing installation by pip (will install on ~/.local)"
248 pip install --upgrade -vvv --user $(shell ls -1 dist/*.tar.gz | sort | head -n 1)
249 ls -la ~/.local/share/guake
250 ~/.local/bin/guake
251
252 clean-pip-install-local:
253 @rm -rfv ~/.local/guake
254 @rm -rfv ~/.local/bin/guake
255 @rm -rfv ~/.local/lib/python3.*/site-packages/guake
256 @rm -rfv ~/.local/share/guake
257
258 test-pip-install-wheel: clean-pip-install-local generate-paths wheel
259 @echo "Testing installation by pip (will install on ~/.local)"
260 pip install --upgrade -vvv --user $(shell ls -1 dist/*.whl | sort | head -n 1)
261 ls -la ~/.local/share/guake
262 ~/.local/bin/guake -v
263
264 sct: style check update-po requirements test
265
266
267 docs: clean-docs sdist
268 cd docs && PIPENV_IGNORE_VIRTUALENVS=1 pipenv run make html
269
270 docs-open:
271 xdg-open docs/_build/html/index.html
272
273 tag-pbr:
274 @{ \
275 set -e ;\
276 export VERSION=$$(PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python setup.py --version | cut -d. -f1,2,3); \
277 echo "I: Computed new version: $$VERSION"; \
278 echo "I: presse ENTER to accept or type new version number:"; \
279 read VERSION_OVERRIDE; \
280 VERSION=$${VERSION_OVERRIDE:-$$VERSION}; \
281 PROJECTNAME=$$(PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python setup.py --name); \
282 echo "I: Tagging $$PROJECTNAME in version $$VERSION with tag: $$VERSION" ; \
283 echo "$$ git tag $$VERSION -m \"$$PROJECTNAME $$VERSION\""; \
284 git tag $$VERSION -m "$$PROJECTNAME $$VERSION"; \
285 echo "I: Pushing tag $$VERSION, press ENTER to continue, C-c to interrupt"; \
286 echo "$$ git push upstream $$VERSION"; \
287 }
288 @# Note:
289 @# To sign, need gpg configured and the following command:
290 @# git tag -s $$VERSION -m \"$$PROJECTNAME $$VERSION\""
291
292 pypi-publish: build
293 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python setup.py upload -r pypi
294
295
296 update:
297 PIPENV_IGNORE_VIRTUALENVS=1 pipenv update --clear
298 PIPENV_IGNORE_VIRTUALENVS=1 pipenv install --dev
299
300
301 lock: pipenv-lock requirements
302
303 requirements:
304 PIPENV_IGNORE_VIRTUALENVS=1 pipenv requirements > requirements.txt
305 PIPENV_IGNORE_VIRTUALENVS=1 pipenv requirements --dev > requirements-dev.txt
306
307 pipenv-lock:
308 PIPENV_IGNORE_VIRTUALENVS=1 pipenv lock
309
310
311 freeze:
312 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pip freeze
313
314
315 setup-githook:
316 rm -f .git/hooks/post-commit
317 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pre-commit install
318
319
320 push:
321 git push origin --tags
322
323
324 clean: clean-ln-venv rm-dists clean-docs clean-po clean-schemas clean-py clean-paths uninstall-dev-locale
325 @echo "clean successful"
326
327 clean-py:
328 @pipenv --rm ; true
329 @find . -name "*.pyc" -exec rm -f {} \;
330 @rm -f $(DEV_DATA_DIR)/guake-prefs.desktop $(DEV_DATA_DIR)/guake.desktop
331 @rm -rf .eggs *.egg-info po/*.pot
332
333 clean-paths:
334 rm -f guake/paths.py guake/paths.py.dev
335
336 clean-po:
337 @rm -f po/guake.pot
338 @find po -name "*.mo" -exec rm -f {} \;
339
340 clean-docs:
341 rm -rf doc/_build
342
343 update-po:
344 echo "generating pot file"
345 @find guake -iname "*.py" | xargs xgettext --from-code=UTF-8 --output=guake-python.pot
346 @find $(DEV_DATA_DIR) -iname "*.glade" | sed -E "s#$(ROOT_DIR)/##g" | xargs xgettext --from-code=UTF-8 \
347 -L Glade \
348 --output=guake-glade.pot
349 @(\
350 find $(DEV_DATA_DIR) -iname "*.desktop" | sed -E "s#$(ROOT_DIR)/##g" | xargs xgettext --from-code=UTF-8 \
351 -L Desktop \
352 --output=guake-desktop.pot \
353 ) || ( \
354 echo "Skipping .desktop files, is your gettext version < 0.19.1?" && \
355 touch guake-desktop.pot)
356 @msgcat --use-first guake-python.pot guake-glade.pot guake-desktop.pot > po/guake.pot
357 @rm guake-python.pot guake-glade.pot guake-desktop.pot
358 @for f in $$(find po -iname "*.po"); do \
359 echo "updating $$f"; \
360 msgcat --use-first "$$f" po/guake.pot > "$$f.new"; \
361 mv "$$f.new" $$f; \
362 done;
363
364 pot: update-po
365
366 generate-mo:
367 @for f in $$(find po -iname "*.po"); do \
368 echo "generating $$f"; \
369 l="$${f%%.*}"; \
370 msgfmt "$$f" -o "$$l.mo"; \
371 done;
372
373
374 generate-desktop:
375 @echo "generating desktop files"
376 @msgfmt --desktop --template=$(DEV_DATA_DIR)/guake.template.desktop \
377 -d po \
378 -o $(DEV_DATA_DIR)/guake.desktop || ( \
379 echo "Skipping .desktop files, is your gettext version < 0.19.1?" && \
380 cp $(DEV_DATA_DIR)/guake.template.desktop $(DEV_DATA_DIR)/guake.desktop)
381 @msgfmt --desktop --template=$(DEV_DATA_DIR)/guake-prefs.template.desktop \
382 -d po \
383 -o $(DEV_DATA_DIR)/guake-prefs.desktop || ( \
384 echo "Skipping .desktop files, is your gettext version < 0.19.1?" && \
385 cp $(DEV_DATA_DIR)/guake-prefs.template.desktop $(DEV_DATA_DIR)/guake-prefs.desktop)
386
387 generate-paths:
388 @echo "Generating path.py..."
389 @cp -f guake/paths.py.in guake/paths.py
390 @# Generic
391 @sed -i -e 's|{{ LOGIN_DESTOP_PATH }}|""|g' guake/paths.py
392 @sed -i -e 's|{{ AUTOSTART_FOLDER }}|""|g' guake/paths.py
393 @# Dev environment:
394 @sed -i -e 's|{{ LOCALE_DIR }}|get_default_locale_dir()|g' guake/paths.py
395 @sed -i -e 's|{{ IMAGE_DIR }}|get_default_image_dir()|g' guake/paths.py
396 @sed -i -e 's|{{ GUAKE_THEME_DIR }}|get_default_theme_dir()|g' guake/paths.py
397 @sed -i -e 's|{{ GLADE_DIR }}|get_default_glade_dir()|g' guake/paths.py
398 @sed -i -e 's|{{ SCHEMA_DIR }}|get_default_schema_dir()|g' guake/paths.py
399
400 reno:
401 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run reno new $(SLUG) --edit
402
403 reno-lint:
404 PIPENV_IGNORE_VIRTUALENVS=1 pipenv run reno -q lint
405
406 release-note: release-note-github
407
408 release-note-github: reno-lint
409 @echo
410 @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
411 @echo "!! Generating release note for GitHub !!"
412 @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
413 @echo "-------- copy / paste from here --------"
414 @# markdown_github to be avoided => gfm output comes in pandoc 2.0.4 release dec 2017
415 @pipenv run reno report --earliest-version 3.8.3 --no-show-source --collapse-pre-releases 2>/dev/null | \
416 pandoc -f rst -t markdown --markdown-headings=atx --wrap=none --tab-stop 2 | \
417 tr '\n' '\r' | \
418 sed 's/\r<!-- -->\r//g' | \
419 sed 's/\r\-\ \r\r\ /\r-/g' | \
420 sed 's/\r\ \ \:\ \ \ /\r /g' | \
421 sed 's/\r\r\ \ \ \ \-\ /\r - /g' | \
422 sed 's/\r\ \ \ \ \-\ /\r - /g' | \
423 sed 's/\r\ \ >\ \-\ /\r - /g' | \
424 sed 's/\\\#/\#/g' | \
425 tr '\r' '\n'
426
427 # aliases to gracefully handle typos on poor dev's terminal
428 check: checks
429 devel: dev
430 develop: dev
431 dist: dists
432 doc: docs
433 install: install-system
434 purge: purge-system
435 pypi: pypi-publish
436 run: run-local
437 run-prefs: run-local-prefs
438 styles: style
439 uninstall: uninstall-system
440 upgrade: update
441 wheel: wheels