diff --git a/.drone.yml b/.drone.yml index 9d7c769d8c..c4fd423e94 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,9 +1,9 @@ -image: python2.7 +image: python:all env: - POSTGRESQL_URI=postgresql://postgres@127.0.0.1:5432/ - MYSQL_URI=mysql://root@127.0.0.1:3306/ script: - pip install tox - - tox -e "py27-{sqlite,postgresql}" + - tox -e "{py27,py33,py34,py35}-{sqlite,postgresql}" --skip-missing-interpreters services: - postgres diff --git a/CHANGELOG b/CHANGELOG index 8d80dcb621..66333ba609 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add Python3 support + Version 3.8.0 - 2015-11-02 * Bug fixes (see mercurial logs for details) diff --git a/account.py b/account.py index 952ee74a7e..631a2f8656 100644 --- a/account.py +++ b/account.py @@ -8,10 +8,10 @@ from trytond.transaction import Transaction from trytond.pyson import Eval __all__ = ['Configuration', 'Level'] -__metaclass__ = PoolMeta class Configuration: + __metaclass__ = PoolMeta __name__ = 'account.configuration' default_credit_limit_amount = fields.Function(fields.Numeric( @@ -76,6 +76,7 @@ class Configuration: class Level: + __metaclass__ = PoolMeta __name__ = 'account.dunning.level' credit_limit = fields.Boolean('Credit Limit', help='Has reached the credit limit') diff --git a/party.py b/party.py index b11e2272e6..ae1f84c743 100644 --- a/party.py +++ b/party.py @@ -6,10 +6,10 @@ from trytond.transaction import Transaction from trytond.pyson import Eval __all__ = ['Party'] -__metaclass__ = PoolMeta class Party: + __metaclass__ = PoolMeta __name__ = 'party.party' credit_amount = fields.Function(fields.Numeric('Credit Amount', diff --git a/setup.py b/setup.py index fe91e15a11..06b3931704 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,17 @@ from setuptools import setup import re import os -import ConfigParser +import io +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() + return io.open( + os.path.join(os.path.dirname(__file__), fname), + 'r', encoding='utf-8').read() def get_require_version(name): @@ -21,7 +27,7 @@ def get_require_version(name): major_version, minor_version + 1) return require -config = ConfigParser.ConfigParser() +config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) for key in ('depends', 'extras_depend', 'xml'): @@ -88,6 +94,9 @@ setup(name=name, 'Natural Language :: Spanish', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Office/Business', @@ -102,4 +111,5 @@ setup(name=name, """, test_suite='tests', test_loader='trytond.test_loader:Loader', + use_2to3=True, ) diff --git a/tests/__init__.py b/tests/__init__.py index 6ec40fdb45..24c12e2be7 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,6 +1,6 @@ # 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 test_account_credit_limit import suite +from .test_account_credit_limit import suite __all__ = ['suite'] diff --git a/tox.ini b/tox.ini index e9d2876444..e2a064851d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = py27-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} +envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} [testenv] commands = {envpython} setup.py test deps = - py27-postgresql: psycopg2 >= 2.0 + {py27,py33,py34,py35}-postgresql: psycopg2 >= 2.0 pypy-postgresql: psycopg2cffi >= 2.5 mysql: MySQL-python setenv =