Skip to content

Commit

Permalink
Make: install is now fully managed by setup.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
roddhjav committed Jan 23, 2022
1 parent dd26aab commit 74e8aa8
Showing 1 changed file with 11 additions and 44 deletions.
55 changes: 11 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,52 +1,17 @@
PROG ?= audit
PREFIX ?= /usr
DESTDIR ?= /
LIBDIR ?= $(PREFIX)/lib
MANDIR ?= $(PREFIX)/share/man
PYTHON ?= yes

SYSTEM_EXTENSION_DIR ?= $(LIBDIR)/password-store/extensions

BASHCOMPDIR ?= $(PREFIX)/share/bash-completion/completions
ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions

all:
@[ "$(PYTHON)" = "yes" ] || exit 0; python3 setup.py build
@echo
@echo "pass-$(PROG) was built successfully. You can now install it with \"make install\""
@echo
@python3 setup.py build
@echo "pass-audit was built successfully. You can now install it wit \"make install\""

install:
@install -vd "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/" "$(DESTDIR)$(MANDIR)/man1" \
"$(DESTDIR)$(BASHCOMPDIR)" "$(DESTDIR)$(ZSHCOMPDIR)"
@install -vm 0755 $(PROG).bash "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash"
@install -vm 0644 pass-$(PROG).1 "$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1"
@install -vm 0644 "completion/pass-$(PROG).bash" "$(DESTDIR)$(BASHCOMPDIR)/pass-$(PROG)"
@install -vm 0644 "completion/pass-$(PROG).zsh" "$(DESTDIR)$(ZSHCOMPDIR)/_pass-$(PROG)"
@[ "$(PYTHON)" = "yes" ] || exit 0; python3 setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
@echo
@echo "pass-$(PROG) is installed succesfully"
@echo

uninstall:
@rm -vrf \
"$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash" \
"$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1" \
"$(DESTDIR)$(ZSHCOMPDIR)/_pass-$(PROG)" \
"$(DESTDIR)$(BASHCOMPDIR)/pass-$(PROG)"
@python3 setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
@echo "pass-audit is installed succesfully"


PASSWORD_STORE_DIR ?= $(HOME)/.password-store
PASSWORD_STORE_EXTENSIONS_DIR ?= $(PASSWORD_STORE_DIR)/.extensions
local:
@install -vd "$(DESTDIR)$(PASSWORD_STORE_EXTENSIONS_DIR)/"
@install -vm 0755 "$(PROG).bash" "$(DESTDIR)$(PASSWORD_STORE_EXTENSIONS_DIR)/$(PROG).bash"
@python3 setup.py install --user --optimize=1
@echo
@echo "pass-$(PROG) is localy installed succesfully."
@echo "pass-audit is localy installed succesfully."
@echo "Remember to set PASSWORD_STORE_ENABLE_EXTENSIONS to 'true' for the extension to be enabled."
@echo "Warning, because it is a local installation, there is no manual page or shell completion."


tests:
@python3 -m green -vvv --run-coverage --termcolor --processes $(shell nproc)
Expand All @@ -70,10 +35,12 @@ security:
@bandit -r pass_audit tests setup.py

clean:
@rm -rf .coverage .mypy_cache .pybuild .ropeproject build \
@rm -rf .coverage .mypy_cache .pybuild .ropeproject build config.json \
debian/.debhelper debian/debhelper* debian/pass-extension-audit* \
dist *.egg-info htmlcov */__pycache__/ __pycache__ \
session.baseline.sqlite session.sqlite \
tests/gnupg/random_seed tests/test-results/
debian/files *.deb *.buildinfo *.changes \
dist *.egg-info htmlcov pass_audit/**/__pycache__/ */__pycache__/ \
__pycache__ session.baseline.sqlite session.sqlite \
tests/assets/gnupg/random_seed tests/assets/test-results/ \
tests/**/__pycache__/

.PHONY: install uninstall local tests tests_bash $(T) lint security clean

0 comments on commit 74e8aa8

Please sign in to comment.