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