From 795a4d3f58ed68fa7bf42e55c2baf7b06e307a64 Mon Sep 17 00:00:00 2001 From: Javier Uribe Date: Tue, 26 Feb 2019 11:03:20 +0100 Subject: [PATCH] Migration to 5.0 --- .drone.yml | 12 ++++++------ INSTALL | 1 - payment.py | 6 ++---- setup.py | 16 +++++++++------- tox.ini | 13 +++++-------- tryton.cfg | 2 +- 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/.drone.yml b/.drone.yml index 38b32ad..a0b10dd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,15 +33,15 @@ services: matrix: include: - - IMAGE: python:2.7 - TOXENV: py27 - DATABASE: sqlite - - IMAGE: python:2.7 - TOXENV: py27 - 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 \ No newline at end of file diff --git a/INSTALL b/INSTALL index c917684..cd7250a 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,6 @@ Installing datalife_account_payment_confirming_n68 Prerequisites ------------- - * Python 2.7 or later (http://www.python.org/) * trytond (http://www.tryton.org/) Installation diff --git a/payment.py b/payment.py index 0bf0eb5..3ad7c04 100644 --- a/payment.py +++ b/payment.py @@ -5,9 +5,8 @@ import os __all__ = ['Journal', 'Group'] -class Journal: +class Journal(metaclass=PoolMeta): __name__ = 'account.payment.journal' - __metaclass__ = PoolMeta @classmethod def __setup__(cls): @@ -16,9 +15,8 @@ class Journal: ('n68', 'Standard 68')) -class Group: +class Group(metaclass=PoolMeta): __name__ = 'account.payment.group' - __metaclass__ = PoolMeta @classmethod def _get_confirming_template_paths(cls): diff --git a/setup.py b/setup.py index 10c4d47..d157e95 100644 --- a/setup.py +++ b/setup.py @@ -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, find_packages import re import os import io -try: - from configparser import ConfigParser -except ImportError: - from ConfigParser import ConfigParser +from configparser import ConfigParser MODULE2PREFIX = { 'account_bank': 'trytonspain', @@ -24,6 +21,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' @@ -34,6 +32,7 @@ def get_require_version(name): return require + config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) @@ -81,12 +80,15 @@ requires = [] for dep in info.get('depends', []): if not re.match(r'(ir|res)(\W|$)', dep): prefix = MODULE2PREFIX.get(dep, 'trytond') + req = get_require_version('%s_%s' % (prefix, dep)) if dep in dependency_links: req = '%s_%s @ %s' % (prefix, dep, dependency_links[dep]) requires.append(req) + requires.append(get_require_version('trytond')) + tests_require = [get_require_version('proteus')] dependency_links = list(dependency_links.values()) @@ -136,15 +138,16 @@ setup(name=name, 'Natural Language :: Slovenian', 'Natural Language :: Spanish', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', '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, @@ -155,5 +158,4 @@ setup(name=name, test_suite='tests', test_loader='trytond.test_loader:Loader', tests_require=tests_require, - use_2to3=True, ) diff --git a/tox.ini b/tox.ini index f8a2206..718b574 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,15 @@ [tox] -envlist = {py27,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} +envlist = {py36,py37}-{sqlite,postgresql},pypy3-{sqlite,postgresql} [testenv] commands = {envpython} setup.py test deps = - {py27,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 {opts} {packages} +install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages} \ No newline at end of file diff --git a/tryton.cfg b/tryton.cfg index 71bbb6a..02723f7 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=4.8.0 +version=5.0 depends: ir res