annotate setup.py @ 4:bf14f603f5e4 4.4 tip

Add From to email header issue6632 review40511002
author Cédric Krier <ced@b2ck.com>
date Fri, 28 Jul 2017 09:16:29 +0200
parents 3bdf81dab3c8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
1 #!/usr/bin/env python
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
2 # This file is part of Tryton. The COPYRIGHT file at the top level of
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
3 # this repository contains the full copyright notices and license terms.
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
4
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
5 from setuptools import setup
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
6 import re
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
7 import os
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
8 import io
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
9 try:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
10 from configparser import ConfigParser
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
11 except ImportError:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
12 from ConfigParser import ConfigParser
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
13
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
14
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
15 def read(fname):
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
16 return io.open(
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
17 os.path.join(os.path.dirname(__file__), fname),
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
18 'r', encoding='utf-8').read()
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
19
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
20
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
21 def get_require_version(name):
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
22 if minor_version % 2:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
23 require = '%s >= %s.%s.dev0, < %s.%s'
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
24 else:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
25 require = '%s >= %s.%s, < %s.%s'
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
26 require %= (name, major_version, minor_version,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
27 major_version, minor_version + 1)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
28 return require
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
29
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
30 config = ConfigParser()
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
31 config.readfp(open('tryton.cfg'))
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
32 info = dict(config.items('tryton'))
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
33 for key in ('depends', 'extras_depend', 'xml'):
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
34 if key in info:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
35 info[key] = info[key].strip().splitlines()
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
36 version = info.get('version', '0.0.1')
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
37 major_version, minor_version, _ = version.split('.', 2)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
38 major_version = int(major_version)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
39 minor_version = int(minor_version)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
40 name = 'trytond_notification_email'
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
41
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
42 download_url = 'http://downloads.tryton.org/%s.%s/' % (
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
43 major_version, minor_version)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
44 if minor_version % 2:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
45 version = '%s.%s.dev0' % (major_version, minor_version)
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
46 download_url = (
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
47 'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
48 name[8:], name, version))
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
49
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
50 requires = []
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
51 for dep in info.get('depends', []):
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
52 if not re.match(r'(ir|res)(\W|$)', dep):
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
53 requires.append(get_require_version('trytond_%s' % dep))
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
54 requires.append(get_require_version('trytond'))
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
55
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
56 tests_require = []
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
57 try:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
58 from unittest import mock
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
59 mock.__version__
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
60 except ImportError:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
61 tests_require.append('mock')
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
62 dependency_links = []
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
63 if minor_version % 2:
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
64 # Add development index for testing with proteus
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
65 dependency_links.append('https://trydevpi.tryton.org/')
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
66
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
67 setup(name=name,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
68 version=version,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
69 description='Tryton module for sending email notifications',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
70 long_description=read('README'),
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
71 author='Tryton',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
72 author_email='issue_tracker@tryton.org',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
73 url='http://www.tryton.org/',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
74 download_url=download_url,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
75 keywords='tryton email notification',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
76 package_dir={'trytond.modules.notification_email': '.'},
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
77 packages=[
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
78 'trytond.modules.notification_email',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
79 'trytond.modules.notification_email.tests',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
80 ],
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
81 package_data={
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
82 'trytond.modules.notification_email': (info.get('xml', [])
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
83 + ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
84 'icons/*.svg', 'tests/*.rst']),
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
85 },
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
86 classifiers=[
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
87 'Development Status :: 5 - Production/Stable',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
88 'Environment :: Plugins',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
89 'Framework :: Tryton',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
90 'Intended Audience :: Developers',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
91 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
92 'Natural Language :: Bulgarian',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
93 'Natural Language :: Catalan',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
94 'Natural Language :: Chinese (Simplified)',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
95 'Natural Language :: Czech',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
96 'Natural Language :: Dutch',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
97 'Natural Language :: English',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
98 'Natural Language :: French',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
99 'Natural Language :: German',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
100 'Natural Language :: Hungarian',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
101 'Natural Language :: Italian',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
102 'Natural Language :: Polish',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
103 'Natural Language :: Portuguese (Brazilian)',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
104 'Natural Language :: Russian',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
105 'Natural Language :: Slovenian',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
106 'Natural Language :: Spanish',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
107 'Operating System :: OS Independent',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
108 'Programming Language :: Python :: 2.7',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
109 'Programming Language :: Python :: 3.3',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
110 'Programming Language :: Python :: 3.4',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
111 'Programming Language :: Python :: 3.5',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
112 'Programming Language :: Python :: Implementation :: CPython',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
113 'Programming Language :: Python :: Implementation :: PyPy',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
114 'Topic :: Office/Business',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
115 ],
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
116 license='GPL-3',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
117 install_requires=requires,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
118 extras_require={
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
119 'html2text': ['html2text'],
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
120 },
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
121 dependency_links=dependency_links,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
122 zip_safe=False,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
123 entry_points="""
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
124 [trytond.modules]
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
125 notification_email = trytond.modules.notification_email
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
126 """,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
127 test_suite='tests',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
128 test_loader='trytond.test_loader:Loader',
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
129 tests_require=tests_require,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
130 use_2to3=True,
3bdf81dab3c8 Initial commit
Cédric Krier <ced@b2ck.com>
parents:
diff changeset
131 )