Add support for psycopg2cffi and PyPy
issue4408 review11741002
This commit is contained in:
+1
-1
@@ -4,6 +4,6 @@ env:
|
||||
- MYSQL_URI=mysql://root@127.0.0.1:3306/
|
||||
script:
|
||||
- pip install tox
|
||||
- tox -e sqlite,postgresql
|
||||
- tox -e "py27-{sqlite,postgresql}"
|
||||
services:
|
||||
- postgres
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Add support for PyPy
|
||||
* Add support for psycopg2cffi
|
||||
* Add noeval on PYSONDecoder
|
||||
* Add __repr__ to PYSON
|
||||
* Remove safe_eval
|
||||
|
||||
@@ -15,6 +15,8 @@ Prerequisites
|
||||
* polib (https://bitbucket.org/izi/polib/wiki/Home)
|
||||
* python-sql 0.2 or later (http://code.google.com/p/python-sql/)
|
||||
* Optional: psycopg 2 or later (http://www.initd.org/)
|
||||
* Optional: psycopg2cffi 2.5.0 or later
|
||||
(http://github.com/chtd/psycopg2cffi)
|
||||
* Optional: MySQL-python (http://sourceforge.net/projects/mysql-python/)
|
||||
* Optional: pywebdav 0.9.8 or later (http://code.google.com/p/pywebdav/)
|
||||
* Optional: pydot (http://code.google.com/p/pydot/)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
import os
|
||||
import platform
|
||||
|
||||
PACKAGE, VERSION, LICENSE, WEBSITE = None, None, None, None
|
||||
execfile(os.path.join('trytond', 'version.py'))
|
||||
@@ -23,6 +24,11 @@ if minor_version % 2:
|
||||
download_url = 'hg+http://hg.tryton.org/%s#egg=%s-%s' % (
|
||||
PACKAGE, PACKAGE, VERSION)
|
||||
|
||||
if platform.python_implementation() == 'PyPy':
|
||||
pg_require = ['psycopg2cffi >= 2.5']
|
||||
else:
|
||||
pg_require = ['psycopg2 >= 2.0']
|
||||
|
||||
setup(name=PACKAGE,
|
||||
version=VERSION,
|
||||
description='Tryton server',
|
||||
@@ -65,6 +71,8 @@ setup(name=PACKAGE,
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy',
|
||||
'Topic :: Software Development :: Libraries :: Application Frameworks',
|
||||
],
|
||||
platforms='any',
|
||||
@@ -78,7 +86,7 @@ setup(name=PACKAGE,
|
||||
'python-sql >= 0.4',
|
||||
],
|
||||
extras_require={
|
||||
'PostgreSQL': ['psycopg2 >= 2.0'],
|
||||
'PostgreSQL': pg_require,
|
||||
'MySQL': ['MySQL-python'],
|
||||
'WebDAV': ['PyWebDAV >= 0.9.8'],
|
||||
'unoconv': ['unoconv'],
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
[tox]
|
||||
envlist = py27-{sqlite,postgresql,mysql}
|
||||
envlist = py27-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
|
||||
|
||||
[testenv]
|
||||
commands = {envpython} setup.py test
|
||||
deps =
|
||||
mock
|
||||
postgresql: psycopg2 >= 2.0
|
||||
py27-postgresql: psycopg2 >= 2.0
|
||||
pypy-postgresql: psycopg2cffi >= 2.5
|
||||
mysql: MySQL-python
|
||||
setenv =
|
||||
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.backend.database import DatabaseInterface, CursorInterface
|
||||
from trytond.config import config, parse_uri
|
||||
import time
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
if os.name == 'posix':
|
||||
import pwd
|
||||
from decimal import Decimal
|
||||
|
||||
try:
|
||||
from psycopg2cffi import compat
|
||||
compat.register()
|
||||
except ImportError:
|
||||
pass
|
||||
from psycopg2.pool import ThreadedConnectionPool
|
||||
from psycopg2.extensions import cursor as PsycopgCursor
|
||||
from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ
|
||||
@@ -14,15 +25,12 @@ except ImportError:
|
||||
PYDATE, PYDATETIME, PYTIME, PYINTERVAL = None, None, None, None
|
||||
from psycopg2 import IntegrityError as DatabaseIntegrityError
|
||||
from psycopg2 import OperationalError as DatabaseOperationalError
|
||||
import time
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
if os.name == 'posix':
|
||||
import pwd
|
||||
from decimal import Decimal
|
||||
|
||||
from sql import Flavor
|
||||
|
||||
from trytond.backend.database import DatabaseInterface, CursorInterface
|
||||
from trytond.config import config, parse_uri
|
||||
|
||||
__all__ = ['Database', 'DatabaseIntegrityError', 'DatabaseOperationalError',
|
||||
'Cursor']
|
||||
|
||||
|
||||
@@ -296,6 +296,8 @@ def get_module_list():
|
||||
for file in os.listdir(MODULES_PATH):
|
||||
if file.startswith('.'):
|
||||
continue
|
||||
if file == '__pycache__':
|
||||
continue
|
||||
if os.path.isdir(OPJ(MODULES_PATH, file)):
|
||||
module_list.add(file)
|
||||
update_egg_modules()
|
||||
|
||||
Reference in New Issue
Block a user