Fix: setup.py

This commit is contained in:
sinergia 2024-06-26 15:02:23 -05:00
parent 85318fc1b7
commit 347c70d4be
2 changed files with 70 additions and 89 deletions

0
README.rst Normal file
View File

155
setup.py
View File

@ -1,111 +1,69 @@
#!/usr/bin/env python
# encoding: utf-8
from setuptools import setup
import re
import os
#!/usr/bin/env python3
import io
import os
import re
from configparser import ConfigParser
MODULE = 'sale_payment'
PREFIX = 'trytonspain'
MODULE2PREFIX = {'sale_shop': 'trytonzz'}
OWNER = {
'nantic':'NaN-tic',
'trytonzz':'nanticzz',
}
from setuptools import find_packages, setup
MODULE2PREFIX = {}
def read(fname):
return io.open(
content = io.open(
os.path.join(os.path.dirname(__file__), fname),
'r', encoding='utf-8').read()
content = re.sub(
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
return content
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
else:
require = '%s >= %s.%s, < %s.%s'
require %= (name, major_version, minor_version,
major_version, minor_version + 1)
return require
def get_requires(depends='depends'):
requires = []
for dep in info.get(depends, []):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')
owner = OWNER.get(prefix, prefix)
if prefix == 'trytond':
requires.append(get_require_version('%s_%s' % (prefix, dep)))
else:
requires.append(
'%(prefix)s-%(dep)s@git+https://github.com/%(owner)s/'
'trytond-%(dep)s.git@%(branch)s'
'#egg=%(prefix)s-%(dep)s-%(series)s'%{
'prefix': prefix,
'owner': owner,
'dep':dep,
'branch': branch,
'series': series,})
return requires
config = ConfigParser()
config.readfp(open('tryton.cfg'))
config.read_file(open(os.path.join(os.path.dirname(__file__), '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 = 'trytondo_sale_payment'
requires = []
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')
requires.append(get_require_version('%s_%s' % (prefix, dep)))
requires.append(get_require_version('trytond'))
series = '%s.%s' % (major_version, minor_version)
if minor_version % 2:
branch = 'master'
else:
branch = series
tests_require = [get_require_version('proteus')]
requires += get_requires('depends')
tests_require = [
get_require_version('proteus'),
]
tests_require += get_requires('extras_depend')
requires += [get_require_version('trytond_account_statement')]
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'),
author='trytonspain',
url='http://www.nan-tic.com/',
download_url='https://github.com:trytonspain/trytond-sale_payment',
package_dir={'trytond.modules.%s' % MODULE: '.'},
packages=[
'trytond.modules.%s' % MODULE,
'trytond.modules.%s.tests' % MODULE,
],
description='Fork NaNtic sale_payment',
long_description=read('README.rst'),
author='OneCluster',
author_email='info@onecluster.org',
url='http://www.tryton.org/',
keywords='',
package_dir={'trytond.modules.sale_payment': '.'},
packages=(
['trytond.modules.sale_payment']
+ ['trytond.modules.sale_payment.%s' % p
for p in find_packages()]
),
package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.rst', 'view/*.xml',
'icons/*.svg']),
},
project_urls = {
"Source Code": 'https://github.com:trytonspain/trytond-sale_payment'
'trytond.modules.sale_payment': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst', 'tests/*.json']),
},
classifiers=[
'Development Status :: 5 - Production/Stable',
@ -114,25 +72,48 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'Intended Audience :: Developers',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Legal Industry',
'License :: OSI Approved :: GNU General Public License (GPL)',
'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 :: Romanian',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Natural Language :: Turkish',
'Natural Language :: Ukrainian',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Office/Business',
],
license='GPL-3',
install_requires=requires,
dependency_links=dependency_links,
python_requires='>=3.8',
# install_requires=requires,
extras_require={
'test': tests_require,
},
zip_safe=False,
entry_points="""
[trytond.modules]
%s = trytond.modules.%s
""" % (MODULE, MODULE),
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
sale_payment = trytond.modules.sale_payment
""", # noqa: E501
)