diff --git a/.drone.yml b/.drone.yml index e0bc2f7026..5da6083eb7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,12 +25,6 @@ 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 diff --git a/CHANGELOG b/CHANGELOG index 9a79682b11..ecd3813c43 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Remove support for Python 2.7 + Version 4.8.0 - 2018-04-23 * Bug fixes (see mercurial logs for details) diff --git a/INSTALL b/INSTALL index d3f60c3c03..d020eb4c96 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing trytond_account_stock_continental Prerequisites ------------- - * Python 2.7 or later (http://www.python.org/) + * Python 3.4 or later (http://www.python.org/) * trytond (http://www.tryton.org/) * trytond_account (http://www.tryton.org/) * trytond_account_product (http://www.tryton.org/) diff --git a/account.py b/account.py index 22168e04c1..5e40fc4248 100644 --- a/account.py +++ b/account.py @@ -12,8 +12,7 @@ stock_journal = fields.Many2One( 'account.journal', "Stock Journal", required=True) -class Configuration: - __metaclass__ = PoolMeta +class Configuration(metaclass=PoolMeta): __name__ = 'account.configuration' stock_journal = fields.MultiValue(stock_journal) cost_price_counterpart_account = fields.MultiValue(fields.Many2One( @@ -53,8 +52,7 @@ class ConfigurationCostPriceCounterpartAccount(ModelSQL, CompanyValueMixin): depends=['company']) -class FiscalYear: - __metaclass__ = PoolMeta +class FiscalYear(metaclass=PoolMeta): __name__ = 'account.fiscalyear' account_stock_method = fields.Selection([ (None, 'None'), @@ -62,8 +60,7 @@ class FiscalYear: ], 'Account Stock Method') -class AccountMove: - __metaclass__ = PoolMeta +class AccountMove(metaclass=PoolMeta): __name__ = 'account.move' @classmethod diff --git a/product.py b/product.py index 71d67b3d0f..2e13846850 100644 --- a/product.py +++ b/product.py @@ -21,8 +21,7 @@ account_names = [ 'account_stock_production', 'account_stock_lost_found'] -class Category: - __metaclass__ = PoolMeta +class Category(metaclass=PoolMeta): __name__ = 'product.category' account_stock = fields.MultiValue(fields.Many2One( 'account.account', "Account Stock", @@ -118,8 +117,7 @@ class Category: pass -class CategoryAccount: - __metaclass__ = PoolMeta +class CategoryAccount(metaclass=PoolMeta): __name__ = 'product.category.account' account_stock = fields.Many2One( 'account.account', "Account Stock", @@ -179,8 +177,7 @@ class CategoryAccount: field_names, value_names, fields) -class Template: - __metaclass__ = PoolMeta +class Template(metaclass=PoolMeta): __name__ = 'product.template' @classmethod @@ -219,8 +216,7 @@ class Template: pass -class Product: - __metaclass__ = PoolMeta +class Product(metaclass=PoolMeta): __name__ = 'product.product' account_stock_used = template_property('account_stock_used') account_stock_supplier_used = template_property( diff --git a/setup.py b/setup.py index 9f6b7e68ae..af863239e7 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,12 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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 setuptools import setup -import re -import os import io -try: - from configparser import ConfigParser -except ImportError: - from ConfigParser import ConfigParser +import os +import re +from configparser import ConfigParser +from setuptools import setup def read(fname): @@ -27,6 +24,7 @@ def get_require_version(name): major_version, minor_version + 1) return require + config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) @@ -104,7 +102,6 @@ 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', @@ -114,6 +111,7 @@ setup(name=name, 'Topic :: Office/Business :: Financial :: Accounting', ], license='GPL-3', + python_requires='>=3.4', install_requires=requires, dependency_links=dependency_links, zip_safe=False, @@ -124,8 +122,4 @@ setup(name=name, test_suite='tests', test_loader='trytond.test_loader:Loader', tests_require=tests_require, - use_2to3=True, - convert_2to3_doctests=[ - 'tests/scenario_account_stock_continental.rst', - ], ) diff --git a/stock.py b/stock.py index 9ba29742e9..2b6aa428ba 100644 --- a/stock.py +++ b/stock.py @@ -9,8 +9,7 @@ from trytond.transaction import Transaction __all__ = ['Move'] -class Move: - __metaclass__ = PoolMeta +class Move(metaclass=PoolMeta): __name__ = 'stock.move' def _get_account_stock_move_lines(self, type_): diff --git a/tests/scenario_account_stock_continental.rst b/tests/scenario_account_stock_continental.rst index 78e5f2be6d..3f93a4290b 100644 --- a/tests/scenario_account_stock_continental.rst +++ b/tests/scenario_account_stock_continental.rst @@ -124,7 +124,7 @@ Purchase 12 products:: >>> purchase.click('confirm') >>> purchase.click('process') >>> purchase.state - u'processing' + 'processing' Receive 9 products:: @@ -142,7 +142,7 @@ Receive 9 products:: >>> shipment.click('receive') >>> shipment.click('done') >>> shipment.state - u'done' + 'done' >>> stock_supplier.reload() >>> stock_supplier.debit Decimal('0.00') @@ -167,7 +167,7 @@ Open supplier invoice:: >>> invoice.invoice_date = today >>> invoice.click('post') >>> invoice.state - u'posted' + 'posted' >>> payable.reload() >>> payable.debit Decimal('0.00') @@ -196,7 +196,7 @@ Sale 5 products:: >>> sale.click('confirm') >>> sale.click('process') >>> sale.state - u'processing' + 'processing' Send 5 products:: @@ -204,13 +204,13 @@ Send 5 products:: >>> shipment.click('assign_try') True >>> shipment.state - u'assigned' + 'assigned' >>> shipment.click('pack') >>> shipment.state - u'packed' + 'packed' >>> shipment.click('done') >>> shipment.state - u'done' + 'done' >>> stock_customer.reload() >>> stock_customer.debit Decimal('28.00') @@ -228,7 +228,7 @@ Open customer invoice:: >>> invoice, = sale.invoices >>> invoice.click('post') >>> invoice.state - u'posted' + 'posted' >>> receivable.reload() >>> receivable.debit Decimal('50.00') @@ -257,7 +257,7 @@ Create an Inventory:: >>> inventory_line.quantity = 1.0 >>> inventory.click('confirm') >>> inventory.state - u'done' + 'done' >>> stock_lost_found.reload() >>> stock_lost_found.debit Decimal('11.00') @@ -291,7 +291,7 @@ Create Drop Shipment Move:: >>> sale.click('confirm') >>> sale.click('process') >>> sale.state - u'processing' + 'processing' >>> PurchaseRequest = Model.get('purchase.request') >>> purchase_request, = PurchaseRequest.find() @@ -305,13 +305,13 @@ Create Drop Shipment Move:: >>> purchase.click('confirm') >>> purchase.click('process') >>> purchase.state - u'processing' + 'processing' >>> shipment, = sale.drop_shipments >>> shipment.click('ship') >>> shipment.click('done') >>> shipment.state - u'done' + 'done' >>> stock_supplier.reload() >>> stock_supplier.debit @@ -343,7 +343,7 @@ Create Drop Shipment Move:: >>> sale.click('confirm') >>> sale.click('process') >>> sale.state - u'processing' + 'processing' >>> purchase_request, = [p for p in PurchaseRequest.find() ... if p.state == 'draft'] @@ -357,13 +357,13 @@ Create Drop Shipment Move:: >>> purchase.click('confirm') >>> purchase.click('process') >>> purchase.state - u'processing' + 'processing' >>> shipment, = sale.drop_shipments >>> shipment.click('ship') >>> shipment.click('done') >>> shipment.state - u'done' + 'done' >>> stock_supplier.reload() >>> stock_supplier.debit diff --git a/tox.ini b/tox.ini index 2082ab4f4d..adbcbf8431 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] -envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql} +envlist = {py34,py35,py36}-{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 + {py34,py35,py36}-postgresql: psycopg2 >= 2.5 + pypy3-postgresql: psycopg2cffi >= 2.5 sqlite: sqlitebck setenv = sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}