Fix: setup.py
This commit is contained in:
parent
85318fc1b7
commit
347c70d4be
0
README.rst
Normal file
0
README.rst
Normal file
159
setup.py
159
setup.py
@ -1,112 +1,70 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
import io
|
import io
|
||||||
|
import os
|
||||||
|
import re
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
MODULE = 'sale_payment'
|
from setuptools import find_packages, setup
|
||||||
PREFIX = 'trytonspain'
|
|
||||||
MODULE2PREFIX = {'sale_shop': 'trytonzz'}
|
MODULE2PREFIX = {}
|
||||||
OWNER = {
|
|
||||||
'nantic':'NaN-tic',
|
|
||||||
'trytonzz':'nanticzz',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def read(fname):
|
def read(fname):
|
||||||
return io.open(
|
content = 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()
|
||||||
|
content = re.sub(
|
||||||
|
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
def get_require_version(name):
|
def get_require_version(name):
|
||||||
if minor_version % 2:
|
require = '%s >= %s.%s, < %s.%s'
|
||||||
require = '%s >= %s.%s.dev0, < %s.%s'
|
|
||||||
else:
|
|
||||||
require = '%s >= %s.%s, < %s.%s'
|
|
||||||
require %= (name, major_version, minor_version,
|
require %= (name, major_version, minor_version,
|
||||||
major_version, minor_version + 1)
|
major_version, minor_version + 1)
|
||||||
return require
|
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 = ConfigParser()
|
||||||
config.readfp(open('tryton.cfg'))
|
config.read_file(open(os.path.join(os.path.dirname(__file__), '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 = 'trytondo_sale_payment'
|
||||||
|
|
||||||
requires = []
|
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)
|
tests_require = [get_require_version('proteus')]
|
||||||
if minor_version % 2:
|
|
||||||
branch = 'master'
|
|
||||||
else:
|
|
||||||
branch = series
|
|
||||||
|
|
||||||
requires += get_requires('depends')
|
setup(name=name,
|
||||||
|
|
||||||
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),
|
|
||||||
version=version,
|
version=version,
|
||||||
description='',
|
description='Fork NaNtic sale_payment',
|
||||||
long_description=read('README'),
|
long_description=read('README.rst'),
|
||||||
author='trytonspain',
|
author='OneCluster',
|
||||||
url='http://www.nan-tic.com/',
|
author_email='info@onecluster.org',
|
||||||
download_url='https://github.com:trytonspain/trytond-sale_payment',
|
url='http://www.tryton.org/',
|
||||||
package_dir={'trytond.modules.%s' % MODULE: '.'},
|
keywords='',
|
||||||
packages=[
|
package_dir={'trytond.modules.sale_payment': '.'},
|
||||||
'trytond.modules.%s' % MODULE,
|
packages=(
|
||||||
'trytond.modules.%s.tests' % MODULE,
|
['trytond.modules.sale_payment']
|
||||||
],
|
+ ['trytond.modules.sale_payment.%s' % p
|
||||||
|
for p in find_packages()]
|
||||||
|
),
|
||||||
package_data={
|
package_data={
|
||||||
'trytond.modules.%s' % MODULE: (info.get('xml', [])
|
'trytond.modules.sale_payment': (info.get('xml', [])
|
||||||
+ ['tryton.cfg', 'locale/*.po', 'tests/*.rst', 'view/*.xml',
|
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
|
||||||
'icons/*.svg']),
|
'icons/*.svg', 'tests/*.rst', 'tests/*.json']),
|
||||||
},
|
},
|
||||||
project_urls = {
|
|
||||||
"Source Code": 'https://github.com:trytonspain/trytond-sale_payment'
|
|
||||||
},
|
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
'Environment :: Plugins',
|
'Environment :: Plugins',
|
||||||
@ -114,25 +72,48 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
|||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Intended Audience :: Financial and Insurance Industry',
|
'Intended Audience :: Financial and Insurance Industry',
|
||||||
'Intended Audience :: Legal 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 :: 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 :: Romanian',
|
||||||
|
'Natural Language :: Russian',
|
||||||
|
'Natural Language :: Slovenian',
|
||||||
'Natural Language :: Spanish',
|
'Natural Language :: Spanish',
|
||||||
|
'Natural Language :: Turkish',
|
||||||
|
'Natural Language :: Ukrainian',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.7',
|
'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',
|
'Topic :: Office/Business',
|
||||||
],
|
],
|
||||||
license='GPL-3',
|
license='GPL-3',
|
||||||
install_requires=requires,
|
python_requires='>=3.8',
|
||||||
dependency_links=dependency_links,
|
# install_requires=requires,
|
||||||
|
extras_require={
|
||||||
|
'test': tests_require,
|
||||||
|
},
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
entry_points="""
|
entry_points="""
|
||||||
[trytond.modules]
|
[trytond.modules]
|
||||||
%s = trytond.modules.%s
|
sale_payment = trytond.modules.sale_payment
|
||||||
""" % (MODULE, MODULE),
|
""", # noqa: E501
|
||||||
test_suite='tests',
|
)
|
||||||
test_loader='trytond.test_loader:Loader',
|
|
||||||
tests_require=tests_require,
|
|
||||||
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user