Make it so pip install --user still works

Debian has enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip
install --user`. I think this is a terrible decision, understandable to
want to avoid modifications in `/usr/lib/python*/site-packages` but to
have that stop be installing packages in my home directory is a big
mistake in terms of usability. In any case this patch moves the
configuration of `pip.conf` to occur before any other roles are
processed, seting the override flag, even though I'm never actually
touching the real site packages.
This commit is contained in:
2023-03-04 11:33:11 +00:00
parent bdbb6a3f3b
commit 23f0fd7f23
4 changed files with 20 additions and 17 deletions

View File

@@ -0,0 +1,39 @@
---
- name: install config repo
git:
repo: git@code.infektor.net:config/python.git
dest: ~/.config/python
# TODO: set repo email
# Ensure that pip.conf exists before ever installing pip packages since Debian
# has not enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip install
# --user` unless configured otherwise.
- name: create symbolic links
file:
state: link
src: '{{item.src}}'
dest: '{{item.dest}}'
with_items:
- src: ~/.config/python/flake8
dest: ~/.config/flake8
- src: ~/.config/python/pylintrc
dest: ~/.pylintrc
- src: ~/.config/python/ipython_config.py
dest: ~/.config/ipython/profile_default/ipython_config.py
- src: ~/.config/python/pip.conf
dest: ~/.config/pip/pip.conf
- name: install pip packages
pip:
name: '{{python_pip_packages}}'
state: latest
extra_args: --user
- name: create directories
file:
state: directory
dest: '{{item}}'
with_items:
- ~/.config/ipython/profile_default
- ~/.config/pip