Migration to 5.0

This commit is contained in:
Javier Uribe 2019-02-28 13:56:45 +01:00
parent 7dc1cbb5ea
commit 3aa912b391
9 changed files with 30 additions and 51 deletions

View File

@ -33,27 +33,15 @@ services:
matrix:
include:
- IMAGE: python:2.7
TOXENV: py27
DATABASE: sqlite
- IMAGE: python:2.7
TOXENV: py27
DATABASE: postgresql
- IMAGE: python:3.4
TOXENV: py34
DATABASE: sqlite
- IMAGE: python:3.4
TOXENV: py34
DATABASE: postgresql
- IMAGE: python:3.5
TOXENV: py35
DATABASE: sqlite
- IMAGE: python:3.5
TOXENV: py35
DATABASE: postgresql
- IMAGE: python:3.6
TOXENV: py36
DATABASE: sqlite
- IMAGE: python:3.6
TOXENV: py36
DATABASE: postgresql
- IMAGE: python:3.7
TOXENV: py37
DATABASE: sqlite
- IMAGE: python:3.7
TOXENV: py37
DATABASE: postgresql

View File

@ -4,7 +4,6 @@ Installing datalife_edocument_edifact
Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
Installation

View File

@ -6,8 +6,7 @@ from trytond.pool import PoolMeta
__all__ = ['Rule']
class Rule:
__metaclass__ = PoolMeta
class Rule(metaclass=PoolMeta):
__name__ = 'incoterm.rule'
EDI_code = fields.Char('EDI Code')

View File

@ -6,8 +6,7 @@ from trytond.model import fields
__all__ = ['PartyIdentifier', 'Address']
class PartyIdentifier:
__metaclass__ = PoolMeta
class PartyIdentifier(metaclass=PoolMeta):
__name__ = 'party.identifier'
@classmethod
@ -20,8 +19,7 @@ class PartyIdentifier:
]
class Address:
__metaclass__ = PoolMeta
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
EDI_code = fields.Char('EDI Code')

View File

@ -6,8 +6,7 @@ from trytond.model import fields
__all__ = ['Template']
class Template:
__metaclass__ = PoolMeta
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
EDI_code = fields.Char('EDI Code')

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
@ -6,10 +6,7 @@ from setuptools import setup
import re
import os
import io
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
from configparser import ConfigParser
MODULE2PREFIX = {
'incoterm': 'datalife',
@ -23,6 +20,7 @@ def read(fname):
'r', encoding='utf-8').read()
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
@ -33,6 +31,7 @@ def get_require_version(name):
return require
config = ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
@ -50,9 +49,12 @@ requires = []
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')
requires.append(get_require_version('%s_%s' % (prefix, dep)))
requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')]
series = '%s.%s' % (major_version, minor_version)
if minor_version % 2:
@ -93,7 +95,7 @@ setup(name=name,
],
package_data={
'trytond.modules.edocument_edifact': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt',
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']),
},
classifiers=[
@ -118,15 +120,16 @@ setup(name=name,
'Natural Language :: Slovenian',
'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 :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
],
license='GPL-3',
python_requires='>=3.4',
install_requires=requires,
dependency_links=dependency_links,
zip_safe=False,
@ -137,5 +140,4 @@ setup(name=name,
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
)

View File

@ -10,8 +10,7 @@ __all__ = ['Configuration', 'ConfigurationSequence', 'UnitLoad',
'ConfigurationEDIOutputPath']
class Configuration:
__metaclass__ = PoolMeta
class Configuration(metaclass=PoolMeta):
__name__ = 'stock.configuration'
edocument_sequence = fields.MultiValue(
@ -34,9 +33,8 @@ class Configuration:
'edocument_sequence').default_edocument_sequence()
class ConfigurationSequence:
class ConfigurationSequence(metaclass=PoolMeta):
__name__ = 'stock.configuration.sequence'
__metaclass__ = PoolMeta
edocument_sequence = fields.Many2One('ir.sequence',
'Electronic Document Sequence', required=True)
@ -97,8 +95,7 @@ class ConfigurationEDIOutputPath(ModelSQL, CompanyValueMixin):
field_names, cls, value_names, fields=fields)
class UnitLoad:
__metaclass__ = PoolMeta
class UnitLoad(metaclass=PoolMeta):
__name__ = 'stock.unit_load'
def get_best_before(self):

13
tox.ini
View File

@ -1,18 +1,15 @@
[tox]
envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
envlist = {py36,py37}-{sqlite,postgresql},pypy3-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
mysql: MySQL-python
sqlite: sqlitebck
{py36,py37}-postgresql: psycopg2 >= 2.5
pypy3-postgresql: psycopg2cffi >= 2.5
{py36}-sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
mysql: DB_NAME={env:MYSQL_NAME:test}
install_command = pip install --pre --process-dependency-links {opts} {packages}
install_command = pip install --pre {opts} {packages}

View File

@ -1,5 +1,5 @@
[tryton]
version=4.8.0
version=5.0.0
depends:
ir
res