use python3-psycopg2 in the virtualenv (#55980)

This commit is contained in:
Emmanuel Cazenave 2021-10-06 12:33:01 +02:00
parent c616debbf2
commit 6d588e6f0e
2 changed files with 36 additions and 6 deletions

View File

@ -71,12 +71,6 @@
name: "django-debug-toolbar<3"
virtualenv: "{{venv_py3}}"
- name: install psycopg2-binary
pip:
name: psycopg2-binary
version: 2.8.6
virtualenv: "{{venv_py3}}"
- name: install pytest
pip:
name: pytest
@ -121,6 +115,25 @@
- name: execute getlasso
command: "{{venv_py3_bin}}/getlasso.sh"
- name: clean psycopg2 pip installation
ansible.builtin.pip:
name:
- psycopg2-binary
- psycopg2
state: absent
virtualenv: "{{venv_py3}}"
- name: create getpsycopg2 scripts
ansible.builtin.template:
src: getpsycopg2.j2
dest: "{{venv_py3_bin}}/getpsycopg2.sh"
mode: "u=rwx,g=rx,o=rx"
vars:
virtualenv_python: "{{venv_py3_python}}"
- name: execute getpsycopg2
ansible.builtin.command: "{{venv_py3_bin}}/getpsycopg2.sh"
- name: create get-uwsgidecorators scripts
template:
src: get-uwsgidecorators.j2

View File

@ -0,0 +1,17 @@
#!/bin/sh
# Get venv site-packages path
DSTDIR=`{{virtualenv_python}} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
# Clean up
rm -f $DSTDIR/psycopg2*
# symlink
for PSYCOFILE in /usr/lib/python3/dist-packages/psycopg2*
do
ln -sv $PSYCOFILE $DSTDIR/
done
exit 0