From 0f9a9c527d877e1688d951fab1943b4b7961e406 Mon Sep 17 00:00:00 2001 From: Sergio Morillo Date: Thu, 21 Jun 2018 17:07:53 +0200 Subject: [PATCH] Update to drone 0.8 --- .drone.yml | 57 ++++++++++++++++++++++++++++++++++ README => README.md | 0 setup.py | 74 ++++++++++++++++++++++++++++++--------------- tox.ini | 17 +++++++++++ 4 files changed, 124 insertions(+), 24 deletions(-) create mode 100644 .drone.yml rename README => README.md (100%) create mode 100644 tox.ini diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a52ef0e --- /dev/null +++ b/.drone.yml @@ -0,0 +1,57 @@ +clone: + hg: + image: plugins/hg + +pipeline: + tox: + image: ${IMAGE} + environment: + - CFLAGS=-O0 + - TOX_TESTENV_PASSENV=CFLAGS + - POSTGRESQL_URI=postgresql://postgres@postgresql:5432/ + commands: + - pip install tox + - tox -e "${TOXENV}-${DATABASE}" + volumes: + - cache:/root/.cache + notify: + image: drillster/drone-email + from: drone@datalife.com.es + skip_verify: true + secrets: [ email_host, email_port ] + when: + status: [ changed, failure ] + +services: + postgresql: + image: postgres + when: + matrix: + DATABASE: postgresql + +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 diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/setup.py b/setup.py index d0cdb09..b8b8917 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,23 @@ #!/usr/bin/env python -# encoding: utf-8 +# 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 ConfigParser +import io +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser -MODULE = 'account_invoice_party_invoice_to' -PREFIX = 'datalife' MODULE2PREFIX = {} 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): @@ -24,45 +29,56 @@ 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'): if key in info: info[key] = info[key].strip().splitlines() - version = info.get('version', '0.0.1') major_version, minor_version, _ = version.split('.', 2) major_version = int(major_version) minor_version = int(minor_version) +name = 'datalife_account_invoice_party_invoice_to' +download_url = 'https://bitbucket.org/datalife_sco/trytond-account_invoice_party_invoice_to' requires = [] for dep in info.get('depends', []): - if not re.match(r'(ir|res|webdav)(\W|$)', dep): + if not re.match(r'(ir|res)(\W|$)', dep): prefix = MODULE2PREFIX.get(dep, 'trytond') - requires.append('%s_%s >= %s.%s, < %s.%s' % - (prefix, dep, major_version, minor_version, - major_version, minor_version + 1)) + 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: + branch = 'default' +else: + branch = series +dependency_links = [] +if minor_version % 2: + # Add development index for testing with proteus + dependency_links.append('https://trydevpi.tryton.org/') -setup(name='%s_%s' % (PREFIX, MODULE), +setup(name=name, version=version, - description='', - long_description=read('README'), + description='Tryton Account invoice party invoice to module', + long_description=read('README.md'), author='Datalife', author_email='info@datalife.com.es', - url='http://www.datalife.com.es/', - download_url="https://bitbucket.org/datalife_sco/trytond-%s" % MODULE, - package_dir={'trytond.modules.%s' % MODULE: '.'}, + url='https://bitbucket.org/datalife_sco/', + download_url=download_url, + keywords='', + package_dir={'trytond.modules.account_invoice_party_invoice_to': '.'}, packages=[ - 'trytond.modules.%s' % MODULE, - 'trytond.modules.%s.tests' % MODULE, + 'trytond.modules.account_invoice_party_invoice_to', + 'trytond.modules.account_invoice_party_invoice_to.tests', ], package_data={ - 'trytond.modules.%s' % MODULE: (info.get('xml', []) - + ['tryton.cfg', 'locale/*.po', 'tests/*.rst']), + 'trytond.modules.account_invoice_party_invoice_to': (info.get('xml', []) + + ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt', + 'icons/*.svg', 'tests/*.rst']), }, classifiers=[ 'Development Status :: 5 - Production/Stable', @@ -79,21 +95,31 @@ setup(name='%s_%s' % (PREFIX, MODULE), 'Natural Language :: English', 'Natural Language :: French', 'Natural Language :: German', + 'Natural Language :: Hungarian', + 'Natural Language :: Italian', + 'Natural Language :: Portuguese (Brazilian)', 'Natural Language :: Russian', + 'Natural Language :: Slovenian', 'Natural Language :: Spanish', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.6', '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', ], license='GPL-3', install_requires=requires, + dependency_links=dependency_links, zip_safe=False, entry_points=""" [trytond.modules] - %s = trytond.modules.%s - """ % (MODULE, MODULE), + account_invoice_party_invoice_to = trytond.modules.account_invoice_party_invoice_to + """, test_suite='tests', test_loader='trytond.test_loader:Loader', tests_require=tests_require, + use_2to3=True, ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..18193cf --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] +envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{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 +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 --find-links https://trydevpi.tryton.org/ --process-dependency-links {opts} {packages}