Projet

Général

Profil

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

Emmanuel Cazenave, 14 octobre 2021 13:50

Télécharger (4,79 ko)

Voir les différences:

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

 roles/base/tasks/main.yml              | 49 ++++++++++++++++++++++----
 roles/base/templates/PSYCOPG2-METADATA | 38 ++++++++++++++++++++
 roles/base/templates/getpsycopg2.j2    |  7 ++++
 3 files changed, 88 insertions(+), 6 deletions(-)
 create mode 100644 roles/base/templates/PSYCOPG2-METADATA
 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: guess venv site-packages path
118
  ansible.builtin.command: "{{venv_py3_python}} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'"
119
  register: site_packages
120

  
121
- name: set venv_py3_site_packages
122
  ansible.builtin.set_fact:
123
    venv_py3_site_packages: "{{site_packages.stdout}}"
124

  
125
- name: create getpsycopg2 scripts
126
  ansible.builtin.template:
127
    src: getpsycopg2.j2
128
    dest: "{{venv_py3_bin}}/getpsycopg2.sh"
129
    mode: "u=rwx,g=rx,o=rx"
130

  
131
- name: execute getpsycopg2
132
  ansible.builtin.command: "{{venv_py3_bin}}/getpsycopg2.sh"
133

  
134
- name: Gather the package facts
135
  ansible.builtin.package_facts:
136
    manager: auto
137

  
138
- name: set python3_psycopg2_version
139
  ansible.builtin.set_fact:
140
    python3_psycopg2_version: "{{ansible_facts.packages['python3-psycopg2'][0]['version']}}"
141

  
142
- name: create psycopg .dist-info
143
  ansible.builtin.file:
144
    path: "{{venv_py3_site_packages}}/psycopg2-{{python3_psycopg2_version}}.dist-info"
145
    state: directory
146

  
147
- name: copy psycopg2 metadata
148
  ansible.builtin.template:
149
    src: PSYCOPG2-METADATA
150
    dest: "{{venv_py3_site_packages}}/psycopg2-{{python3_psycopg2_version}}.dist-info/METADATA"
151

  
115 152
- name: create get-uwsgidecorators scripts
116 153
  template:
117 154
    src: get-uwsgidecorators.j2
roles/base/templates/PSYCOPG2-METADATA
1
Metadata-Version: 2.1
2
Name: psycopg2
3
Version: {{python3_psycopg2_version}}
4
Summary: psycopg2 - Python-PostgreSQL Database Adapter
5
Home-page: https://psycopg.org/
6
Author: Federico Di Gregorio
7
Author-email: fog@initd.org
8
Maintainer: Daniele Varrazzo
9
Maintainer-email: daniele.varrazzo@gmail.org
10
License: LGPL with exceptions
11
Project-URL: Homepage, https://psycopg.org/
12
Project-URL: Documentation, https://www.psycopg.org/docs/
13
Project-URL: Code, https://github.com/psycopg/psycopg2
14
Project-URL: Issue Tracker, https://github.com/psycopg/psycopg2/issues
15
Project-URL: Download, https://pypi.org/project/psycopg2/
16
Platform: any
17
Classifier: Development Status :: 5 - Production/Stable
18
Classifier: Intended Audience :: Developers
19
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
20
Classifier: Programming Language :: Python
21
Classifier: Programming Language :: Python :: 2
22
Classifier: Programming Language :: Python :: 2.7
23
Classifier: Programming Language :: Python :: 3
24
Classifier: Programming Language :: Python :: 3.4
25
Classifier: Programming Language :: Python :: 3.5
26
Classifier: Programming Language :: Python :: 3.6
27
Classifier: Programming Language :: Python :: 3.7
28
Classifier: Programming Language :: Python :: 3.8
29
Classifier: Programming Language :: Python :: Implementation :: CPython
30
Classifier: Programming Language :: C
31
Classifier: Programming Language :: SQL
32
Classifier: Topic :: Database
33
Classifier: Topic :: Database :: Front-Ends
34
Classifier: Topic :: Software Development
35
Classifier: Topic :: Software Development :: Libraries :: Python Modules
36
Classifier: Operating System :: Microsoft :: Windows
37
Classifier: Operating System :: Unix
38
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
roles/base/templates/getpsycopg2.j2
1
#!/bin/sh
2

  
3
# Clean up
4
rm -f {{venv_py3_site_packages}}/psycopg2
5

  
6
# symlink
7
ln -sv /usr/lib/python3/dist-packages/psycopg2 {{venv_py3_site_packages}}/
0
-