Do not use venv on arch

This commit is contained in:
2022-06-30 06:38:05 +02:00
parent 374c939fdb
commit 3e4d59348b
2 changed files with 25 additions and 11 deletions

View File

@@ -1,20 +1,26 @@
DISTRO := $(shell . /etc/os-release && echo $$NAME)
venv = ./venv venv = ./venv
requirements = requirements.txt requirements = requirements.txt
activate = . $(venv)/bin/activate activate = . $(venv)/bin/activate
pip = pip pip = pip
ansible = venv/bin/ansible-playbook
ansible_run = $(activate) && ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS} ifeq ($(DISTRO),Ubuntu)
ansible_run = $(activate) && ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS}
else
ansible_run =ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS}
endif
.PHONY: all .PHONY: all
all: | venv $(ansible) all: | venv
$(ansible_run) $(ansible_run)
.PHONY: config .PHONY: config
config: | venv $(ansible) config: | venv
$(ansible_run) --skip-tags system-update $(ansible_run) --skip-tags system-update
.PHONY: system-update .PHONY: system-update
system-update: $(ansible) system-update: venv
$(ansible_run) --tags system-update $(ansible_run) --tags system-update
.PHONY: reboot .PHONY: reboot
@@ -29,11 +35,11 @@ poweroff:
weekend: | update poweroff weekend: | update poweroff
.PHONY: packages .PHONY: packages
packages: $(ansible) packages: venv
$(ansible_run) --tags packages $(ansible_run) --tags packages
.PHONY: dotfiles .PHONY: dotfiles
dotfiles: $(ansible) dotfiles: venv
$(ansible_run) --tags dotfiles $(ansible_run) --tags dotfiles
.PHONY: clean .PHONY: clean
@@ -44,11 +50,14 @@ clean:
test: test:
./test-in-docker.sh ./test-in-docker.sh
$(ansible): venv ifeq ($(DISTRO), Ubuntux)
venv: venv:
python3 -m venv $(venv) python3 -m venv $(venv)
$(activate) && $(pip) install -r $(requirements) $(activate) && $(pip) install -r $(requirements)
else
venv:
true
endif
.PHONY: freeze .PHONY: freeze
freeze: freeze:

View File

@@ -90,6 +90,11 @@ if ! python3 -c 'import venv' 2>/dev/null ; then
printf 'Done\n' printf 'Done\n'
fi fi
if [[ $NAME == "Arch Linux" ]] ; then
_install "ansible"
_install "python-jmespath"
fi
cd "$DOTDIR" && make cd "$DOTDIR" && make
# fix permissions of the directory # fix permissions of the directory