mirror of
https://gitlab.com/datalifeit/trytond-staff_workplace
synced 2023-12-14 04:42:58 +01:00
Update to drone 0.8
This commit is contained in:
parent
ec4f47a90a
commit
c352edcf3a
6 changed files with 165 additions and 26 deletions
58
.drone.yml
Normal file
58
.drone.yml
Normal file
|
@ -0,0 +1,58 @@
|
|||
clone:
|
||||
hg:
|
||||
image: plugins/hg
|
||||
|
||||
pipeline:
|
||||
tox:
|
||||
image: ${IMAGE}
|
||||
environment:
|
||||
- CFLAGS=-O0
|
||||
- TOX_TESTENV_PASSENV=CFLAGS
|
||||
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
|
||||
commands:
|
||||
- python tests/netrc2hgrc.py
|
||||
- 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
|
|
@ -1,5 +1,5 @@
|
|||
include INSTALL
|
||||
include README
|
||||
include README.md
|
||||
include COPYRIGHT
|
||||
include CHANGELOG
|
||||
include LICENSE
|
||||
|
|
|
@ -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.
|
||||
|
||||
[![Build Status](http://drone.datalife.com.es:8050/api/badges/datalife_sco/trytond-staff_workplace/status.svg)](http://drone.datalife.com.es:8050/datalife_sco/trytond-staff_workplace)
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
85
setup.py
85
setup.py
|
@ -1,18 +1,25 @@
|
|||
#!/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 = 'staff_workplace'
|
||||
PREFIX = 'datalife'
|
||||
MODULE2PREFIX = {}
|
||||
MODULE2PREFIX = {
|
||||
'staff': 'datalife'
|
||||
}
|
||||
|
||||
|
||||
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 +31,63 @@ 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_staff_workplace'
|
||||
download_url = 'https://bitbucket.org/datalife_sco/trytond-staff_workplace'
|
||||
|
||||
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 = [
|
||||
('hg+https://bitbucket.org/datalife_sco/'
|
||||
'trytond-staff@%(branch)s'
|
||||
'#egg=datalife_staff-%(series)s' % {
|
||||
'branch': branch,
|
||||
'series': series,
|
||||
})
|
||||
]
|
||||
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 staff workplace 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.staff_workplace': '.'},
|
||||
packages=[
|
||||
'trytond.modules.%s' % MODULE,
|
||||
'trytond.modules.%s.tests' % MODULE,
|
||||
'trytond.modules.staff_workplace',
|
||||
'trytond.modules.staff_workplace.tests',
|
||||
],
|
||||
package_data={
|
||||
'trytond.modules.%s' % MODULE: (info.get('xml', [])
|
||||
+ ['tryton.cfg', 'locale/*.po', 'tests/*.rst']),
|
||||
'trytond.modules.staff_workplace': (info.get('xml', [])
|
||||
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt',
|
||||
'icons/*.svg', 'tests/*.rst']),
|
||||
},
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
|
@ -79,21 +104,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),
|
||||
staff_workplace = trytond.modules.staff_workplace
|
||||
""",
|
||||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
use_2to3=True,
|
||||
)
|
||||
|
|
27
tests/netrc2hgrc.py
Normal file
27
tests/netrc2hgrc.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import netrc
|
||||
import os
|
||||
try:
|
||||
from configparser import ConfigParser, DuplicateSectionError
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser, DuplicateSectionError
|
||||
|
||||
|
||||
def main():
|
||||
netrc_ = netrc.netrc(os.path.expanduser('~/.netrc'))
|
||||
config = ConfigParser()
|
||||
try:
|
||||
config.add_section('auth')
|
||||
except DuplicateSectionError:
|
||||
pass
|
||||
hgrc = os.path.expanduser('~/.hgrc')
|
||||
config.read(hgrc)
|
||||
for host, (login, _, password) in netrc_.hosts.items():
|
||||
config.set('auth', host + '.prefix', host)
|
||||
config.set('auth', host + '.username', login)
|
||||
config.set('auth', host + '.password', password)
|
||||
with open(hgrc, 'w') as fp:
|
||||
config.write(fp)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
17
tox.ini
Normal file
17
tox.ini
Normal 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}
|
Loading…
Reference in a new issue