Projet

Général

Profil

0001-use-python3-psycopg2-in-the-virtualenv-55980.patch

Emmanuel Cazenave, 14 octobre 2021 16:26

Télécharger (2,04 ko)

Voir les différences:

Subject: [PATCH] use python3-psycopg2 in the virtualenv (#55980)

 roles/base/tasks/main.yml           | 25 +++++++++++++++++++------
 roles/base/templates/getpsycopg2.j2 | 17 +++++++++++++++++
 2 files changed, 36 insertions(+), 6 deletions(-)
 create mode 100644 roles/base/templates/getpsycopg2.j2
roles/base/tasks/main.yml
62 62
    name: "django-debug-toolbar<3"
63 63
    virtualenv: "{{venv_py3}}"
64 64

  
65
- name: install psycopg2-binary
66
  pip:
67
    name: psycopg2-binary
68
    version: 2.8.6
69
    virtualenv: "{{venv_py3}}"
70

  
71 65
- name: install pytest
72 66
  pip:
73 67
    name: pytest
......
112 106
- name: execute getlasso
113 107
  command: "{{venv_py3_bin}}/getlasso.sh"
114 108

  
109
- name: clean psycopg2 pip installation
110
  ansible.builtin.pip:
111
    name:
112
      - psycopg2-binary
113
      - psycopg2
114
    state: absent
115
    virtualenv: "{{venv_py3}}"
116

  
117
- name: create getpsycopg2 scripts
118
  ansible.builtin.template:
119
    src: getpsycopg2.j2
120
    dest: "{{venv_py3_bin}}/getpsycopg2.sh"
121
    mode: "u=rwx,g=rx,o=rx"
122
  vars:
123
    virtualenv_python: "{{venv_py3_python}}"
124

  
125
- name: execute getpsycopg2
126
  ansible.builtin.command: "{{venv_py3_bin}}/getpsycopg2.sh"
127

  
115 128
- name: create get-uwsgidecorators scripts
116 129
  template:
117 130
    src: get-uwsgidecorators.j2
roles/base/templates/getpsycopg2.j2
1
#!/bin/sh
2

  
3

  
4
# Get venv site-packages path
5
DSTDIR=`{{virtualenv_python}} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
6

  
7
# Clean up
8
rm -f $DSTDIR/psycopg2*
9

  
10
# symlink
11
for PSYCOFILE in /usr/lib/python3/dist-packages/psycopg2*
12
do
13
  ln -sv $PSYCOFILE $DSTDIR/
14
done
15

  
16
exit 0
17

  
0
-