Update to drone 0.8

This commit is contained in:
Sergio Morillo 2018-06-22 12:18:31 +02:00
parent ae16d97c1d
commit 835ff32948
5 changed files with 127 additions and 25 deletions

57
.drone.yml Normal file
View File

@ -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

View File

@ -1,5 +1,5 @@
include INSTALL include INSTALL
include README include README.md
include COPYRIGHT include COPYRIGHT
include CHANGELOG include CHANGELOG
include LICENSE include LICENSE

View File

@ -3,6 +3,8 @@ This Module runs with the Tryton application platform.
This module is developed and tested over a Tryton server and core modules. This module is developed and tested over a Tryton server and core modules.
[![Build Status](http://drone.datalife.com.es:8050/api/badges/datalife_sco/trytond-stock_location_notebook/status.svg)](http://drone.datalife.com.es:8050/datalife_sco/trytond-stock_location_notebook)
Installing Installing
---------- ----------

View File

@ -1,18 +1,23 @@
#!/usr/bin/env python #!/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 from setuptools import setup
import re import re
import os import os
import ConfigParser import io
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
MODULE = 'stock_location_notebook'
PREFIX = 'datalife'
MODULE2PREFIX = {} MODULE2PREFIX = {}
def read(fname): 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): def get_require_version(name):
@ -24,45 +29,56 @@ def get_require_version(name):
major_version, minor_version + 1) major_version, minor_version + 1)
return require return require
config = ConfigParser.ConfigParser()
config = ConfigParser()
config.readfp(open('tryton.cfg')) config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton')) info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'): for key in ('depends', 'extras_depend', 'xml'):
if key in info: if key in info:
info[key] = info[key].strip().splitlines() info[key] = info[key].strip().splitlines()
version = info.get('version', '0.0.1') version = info.get('version', '0.0.1')
major_version, minor_version, _ = version.split('.', 2) major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version) major_version = int(major_version)
minor_version = int(minor_version) minor_version = int(minor_version)
name = 'datalife_stock_location_notebook'
download_url = 'https://bitbucket.org/datalife_sco/trytond-stock_location_notebook'
requires = [] requires = []
for dep in info.get('depends', []): 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') prefix = MODULE2PREFIX.get(dep, 'trytond')
requires.append('%s_%s >= %s.%s, < %s.%s' % requires.append(get_require_version('%s_%s' % (prefix, dep)))
(prefix, dep, major_version, minor_version,
major_version, minor_version + 1))
requires.append(get_require_version('trytond')) requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')] 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, version=version,
description='', description='Tryton stock location notebook Module',
long_description=read('README'), long_description=read('README.md'),
author='Datalife', author='Datalife',
author_email='info@datalife.com.es', author_email='info@datalife.com.es',
url='http://www.datalife.com.es/', url='https://bitbucket.org/datalife_sco/',
download_url="https://bitbucket.org/datalife_sco/trytond-%s" % MODULE, download_url=download_url,
package_dir={'trytond.modules.%s' % MODULE: '.'}, keywords='',
package_dir={'trytond.modules.stock_location_notebook': '.'},
packages=[ packages=[
'trytond.modules.%s' % MODULE, 'trytond.modules.stock_location_notebook',
'trytond.modules.%s.tests' % MODULE, 'trytond.modules.stock_location_notebook.tests',
], ],
package_data={ package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', []) 'trytond.modules.stock_location_notebook': (info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.rst']), + ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt',
'icons/*.svg', 'tests/*.rst']),
}, },
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
@ -79,21 +95,31 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'Natural Language :: English', 'Natural Language :: English',
'Natural Language :: French', 'Natural Language :: French',
'Natural Language :: German', 'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Italian',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian', 'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish', 'Natural Language :: Spanish',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', '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', 'Topic :: Office/Business',
], ],
license='GPL-3', license='GPL-3',
install_requires=requires, install_requires=requires,
dependency_links=dependency_links,
zip_safe=False, zip_safe=False,
entry_points=""" entry_points="""
[trytond.modules] [trytond.modules]
%s = trytond.modules.%s stock_location_notebook = trytond.modules.stock_location_notebook
""" % (MODULE, MODULE), """,
test_suite='tests', test_suite='tests',
test_loader='trytond.test_loader:Loader', test_loader='trytond.test_loader:Loader',
tests_require=tests_require, tests_require=tests_require,
use_2to3=True,
) )

17
tox.ini Normal file
View File

@ -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}