[REF] core: Remove psycogreen dependency
Purpose:
The psycogreen module is unmaintained. Last source update was in
2015 and last pypi package was in 2012. Odoo only use a small
part of the psycogreen module that could be written directly in
the odoo code. This commit reproduce the small function from
psycogreen used in ODoo and remove all depencies from it.
Also the copyright and license are honored and the documentation
is updated accordingly.
pypi pckage: https://pypi.python.org/pypi/psycogreen
bitbucket repos: https://bitbucket.org/dvarrazzo/psycogreen/
This commit is contained in:
Vendored
+30
@@ -223,6 +223,36 @@ Files: addons/web/static/lib/fontawesome/css/font-awesome.css
|
||||
Copyright: Font Awesome by Dave Gandy - http://fontawesome.io
|
||||
License: MIT
|
||||
|
||||
Files: odoo/__init__.py
|
||||
Copyright: Copyright (C) 2010-2012 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||
License:
|
||||
Copyright (c) 2010-2012, Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||
All rights reserved.
|
||||
.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
.
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of Daniele Varrazzo may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Comment: This license only applies to the function 'gevent_wait_callback'
|
||||
|
||||
Files: addons/web/static/lib/fontawesome/fonts/*
|
||||
Copyright: Font Awesome by Dave Gandy - http://fontawesome.io
|
||||
License: OFL-1.1
|
||||
|
||||
@@ -214,10 +214,6 @@ Instead you must have a proxy redirecting requests whose URL starts with
|
||||
``/longpolling/`` to the longpolling port. Other request should be proxied to
|
||||
the :option:`normal HTTP port <odoo-bin --http-port>`
|
||||
|
||||
.. warning:: The livechat worker requires the ``psycogreen`` Python module,
|
||||
which is not always included with all installation packages.
|
||||
It can be manually installed with ``pip install psycogreen``.
|
||||
|
||||
Configuration sample
|
||||
--------------------
|
||||
|
||||
|
||||
+20
-2
@@ -18,9 +18,27 @@ evented = False
|
||||
if len(sys.argv) > 1 and sys.argv[1] == 'gevent':
|
||||
sys.argv.remove('gevent')
|
||||
import gevent.monkey
|
||||
import psycopg2
|
||||
from gevent.socket import wait_read, wait_write
|
||||
gevent.monkey.patch_all()
|
||||
import psycogreen.gevent
|
||||
psycogreen.gevent.patch_psycopg()
|
||||
|
||||
def gevent_wait_callback(conn, timeout=None):
|
||||
"""A wait callback useful to allow gevent to work with Psycopg."""
|
||||
# Copyright (C) 2010-2012 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||
# This function is borrowed from psycogreen module which is licensed
|
||||
# under the BSD license (see in odoo/debian/copyright)
|
||||
while 1:
|
||||
state = conn.poll()
|
||||
if state == psycopg2.extensions.POLL_OK:
|
||||
break
|
||||
elif state == psycopg2.extensions.POLL_READ:
|
||||
wait_read(conn.fileno(), timeout=timeout)
|
||||
elif state == psycopg2.extensions.POLL_WRITE:
|
||||
wait_write(conn.fileno(), timeout=timeout)
|
||||
else:
|
||||
raise psycopg2.OperationalError(
|
||||
"Bad result from poll: %r" % state)
|
||||
psycopg2.extensions.set_wait_callback(gevent_wait_callback)
|
||||
evented = True
|
||||
|
||||
# Is the server running in prefork mode (e.g. behind Gunicorn).
|
||||
|
||||
@@ -16,7 +16,6 @@ ofxparse==0.16
|
||||
passlib==1.6.5
|
||||
Pillow==3.4.1
|
||||
psutil==4.3.1
|
||||
psycogreen==1.0
|
||||
psycopg2==2.7.1
|
||||
pydot==1.2.3
|
||||
pyldap==2.4.28
|
||||
|
||||
@@ -27,7 +27,6 @@ requires =
|
||||
python3-passlib
|
||||
python3-pillow
|
||||
python3-psutil
|
||||
python3-psycogreen
|
||||
python3-pydot
|
||||
python3-pyldap
|
||||
python3-pyparsing
|
||||
|
||||
@@ -149,7 +149,6 @@ setup(
|
||||
'passlib',
|
||||
'pillow', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
|
||||
'psutil', # windows binary code.google.com/p/psutil/downloads/list
|
||||
'psycogreen',
|
||||
'psycopg2 >= 2.2',
|
||||
'pydot',
|
||||
'pyldap', # optional
|
||||
|
||||
@@ -27,7 +27,6 @@ RUN dnf update -d 0 -e 0 -y && \
|
||||
python3-passlib \
|
||||
python3-pillow \
|
||||
python3-psutil \
|
||||
python3-psycogreen \
|
||||
python3-pydot \
|
||||
python3-pyldap \
|
||||
python3-pyparsing \
|
||||
|
||||
@@ -16,7 +16,6 @@ ofxparse==0.16
|
||||
passlib==1.6.5
|
||||
Pillow>=3.4.1
|
||||
psutil>=4.3.1
|
||||
psycogreen==1.0
|
||||
psycopg2==2.7.1
|
||||
pydot==1.2.3
|
||||
pyldap>=2.4.28
|
||||
|
||||
Reference in New Issue
Block a user