Update setup.py

This commit is contained in:
Adrián Bernardi 2021-11-09 10:39:32 -03:00
parent 3a6f2cd0d1
commit 54c33d605e
1 changed files with 47 additions and 58 deletions

105
setup.py
View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# This file is part of the sale_payment_collect module for Tryton.
# The COPYRIGHT file at the top level of this repository contains # The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms. # the full copyright notices and license terms.
@ -6,19 +7,26 @@ import io
import os import os
import re import re
from configparser import ConfigParser from configparser import ConfigParser
from setuptools import setup, find_packages from setuptools import setup
MODULE = 'sale_payment_collect'
PREFIX = 'trytonar'
MODULE2PREFIX = {
'payment_collect': 'trytonar',
}
def read(fname, slice=None): def read(fname):
content = io.open( return io.open(
os.path.join(os.path.dirname(__file__), fname), os.path.join(os.path.dirname(__file__), fname),
'r', encoding='utf-8').read() 'r', encoding='utf-8').read()
if slice:
content = '\n'.join(content.splitlines()[slice])
return content
def get_require_version(name): def get_require_version(name):
#if name.startswith('trytonar_'):
#return ''
if name in LINKS:
return '%s@%s' % (name, LINKS[name])
if minor_version % 2: if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s' require = '%s >= %s.%s.dev0, < %s.%s'
else: else:
@ -38,40 +46,38 @@ 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 = 'trytonar_sale_payment_collect' series = '%s.%s' % (major_version, minor_version)
download_url = 'https://github.com/tryton-ar/sale_payment_collect/tree/%s.%s' % (
major_version, minor_version)
if minor_version % 2: if minor_version % 2:
version = '%s.%s.dev0' % (major_version, minor_version) branch = 'master'
download_url = ( else:
'git+http://github.com/tryton-ar/%s#egg=%s-%s' % ( branch = series
name.replace('trytonar','trytond'), name, version))
local_version = [] download_url = 'https://github.com/tryton-ar/sale_payment_collect/tree/%s' % branch
for build in ['CI_BUILD_NUMBER', 'CI_JOB_NUMBER', 'CI_JOB_ID']:
if os.environ.get(build): LINKS = {
local_version.append(os.environ[build]) 'trytonar_payment_collect': ('git+https://github.com/tryton-ar/'
if local_version: 'payment_collect.git@%s#egg=trytonar_payment_collect-%s' %
version += '+' + '.'.join(local_version) (branch, series)),
}
requires = ['requests'] requires = ['requests']
for dep in info.get('depends', []): for dep in info.get('depends', []):
if dep == 'payment_collect': if not re.match(r'(ir|res)(\W|$)', dep):
requires.append('trytonar_payment_collect @ git+https://github.com/tryton-ar/payment_collect.git@%s.%s#egg=trytonar_payment_collect-%s.%s' % (major_version, minor_version, major_version, minor_version)) module_name = '%s_%s' % (MODULE2PREFIX.get(dep, 'trytond'), dep)
elif not re.match(r'(ir|res)(\W|$)', dep): requires.append(get_require_version(module_name))
requires.append(get_require_version('trytond_%s' % dep))
requires.append(get_require_version('trytond')) requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')] tests_require = [get_require_version('proteus')]
dependency_links = [] dependency_links = list(LINKS.values())
if minor_version % 2: if minor_version % 2:
dependency_links.append('https://trydevpi.tryton.org/') dependency_links.append('https://trydevpi.tryton.org/')
setup(name=name, setup(name='%s_%s' % (PREFIX, MODULE),
version=version, version=version,
description='', description='',
long_description=read('README.rst'), long_description=read('README.rst'),
author='trytonar', author='tryton-ar',
author_email='info@gcoop.coop', author_email='info@gcoop.coop',
url='http://github.com/tryton-ar/sale_payment_collect', url='http://github.com/tryton-ar/sale_payment_collect',
download_url=download_url, download_url=download_url,
@ -82,16 +88,15 @@ setup(name=name,
"Source Code": 'https://github.com/tryton-ar/trytond-sale_payment_collect', "Source Code": 'https://github.com/tryton-ar/trytond-sale_payment_collect',
}, },
keywords='tryton, sale, collect, payment', keywords='tryton, sale, collect, payment',
package_dir={'trytond.modules.sale_payment_collect': '.'}, package_dir={'trytond.modules.%s' % MODULE: '.'},
packages=( packages=[
['trytond.modules.sale_payment_collect'] 'trytond.modules.%s' % MODULE,
+ ['trytond.modules.sale_payment_collect.%s' % p 'trytond.modules.%s.tests' % MODULE,
for p in find_packages()] ],
),
package_data={ package_data={
'trytond.modules.sale_payment_collect': (info.get('xml', []) 'trytond.modules.%s' % MODULE: (info.get('xml', []) + [
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt', 'tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']), 'icons/*.svg', 'tests/*.rst']),
}, },
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
@ -102,44 +107,28 @@ setup(name=name,
'Intended Audience :: Legal Industry', 'Intended Audience :: Legal Industry',
'License :: OSI Approved :: ' 'License :: OSI Approved :: '
'GNU General Public License v3 or later (GPLv3+)', 'GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: Bulgarian',
'Natural Language :: Catalan',
'Natural Language :: Chinese (Simplified)',
'Natural Language :: Czech',
'Natural Language :: Dutch',
'Natural Language :: English', 'Natural Language :: English',
'Natural Language :: Finnish',
'Natural Language :: French',
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Indonesian',
'Natural Language :: Italian',
'Natural Language :: Persian',
'Natural Language :: Polish',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish', 'Natural Language :: Spanish',
'Natural Language :: Turkish',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business', 'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
], ],
license='GPL-3', license='GPL-3',
python_requires='>=3.5', python_requires='>=3.6',
install_requires=requires, install_requires=requires,
dependency_links=dependency_links, dependency_links=dependency_links,
zip_safe=False, zip_safe=False,
entry_points=""" entry_points="""
[trytond.modules] [trytond.modules]
sale_payment_collect = trytond.modules.sale_payment_collect %s = trytond.modules.%s
""", # noqa: E501 """ % (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,