comparison setup.py @ 405:c56a728412f1

file organisation + setup refactoring: - `/src` has been renamed to `/sat_pubsub`, this is the recommended naming convention - revamped `setup.py` on the basis of SàT's `setup.py` - added a `VERSION` which is the unique place where version number will now be set - use same trick as in SàT to specify dev version (`D` at the end) - use setuptools_scm to retrieve Mercurial hash when in dev version
author Goffi <goffi@goffi.org>
date Fri, 16 Aug 2019 12:00:02 +0200
parents 26e46a3043e5
children a58610ab2983
comparison
equal deleted inserted replaced
404:105a0772eedd 405:c56a728412f1
1 #!/usr/bin/python 1 #!/usr/bin/env python3
2 #-*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2003-2011 Ralph Meijer 4 # SAT: an XMPP client
5 # Copyright (C) 2011-2014 Jérôme Poisson <goffi@goffi.org> 5 # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
6 7
7 # This program is free software: you can redistribute it and/or modify 8 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by 9 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or 10 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version. 11 # (at your option) any later version.
15 # GNU Affero General Public License for more details. 16 # GNU Affero General Public License for more details.
16 17
17 # You should have received a copy of the GNU Affero General Public License 18 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 20
20 # This program is based on Idavoll (http://idavoll.ik.nu/), 21 from setuptools import setup, find_packages
21 # originaly written by Ralph Meijer (http://ralphm.net/blog/) 22 import os
22 # It is sublicensed under AGPL v3 (or any later version) as allowed
23 # by the original license.
24 23
25 # Here is a copy of the original license: 24 NAME = 'sat_pubsub'
26
27 # Copyright (c) 2003-2011 Ralph Meijer
28
29 # Permission is hereby granted, free of charge, to any person obtaining
30 # a copy of this software and associated documentation files (the
31 # "Software"), to deal in the Software without restriction, including
32 # without limitation the rights to use, copy, modify, merge, publish,
33 # distribute, sublicense, and/or sell copies of the Software, and to
34 # permit persons to whom the Software is furnished to do so, subject to
35 # the following conditions:
36
37 # The above copyright notice and this permission notice shall be
38 # included in all copies or substantial portions of the Software.
39
40 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
44 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
45 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
46 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47
48 import sys
49 from setuptools import setup
50 from src import __version__
51
52
53 # seen here: http://stackoverflow.com/questions/7275295
54 try:
55 from setuptools.command import egg_info
56 egg_info.write_toplevel_names
57 except (ImportError, AttributeError):
58 pass
59 else:
60 def _top_level_package(name):
61 return name.split('.', 1)[0]
62
63 def _hacked_write_toplevel_names(cmd, basename, filename):
64 pkgs = dict.fromkeys(
65 [_top_level_package(k)
66 for k in cmd.distribution.iter_distribution_names()
67 if _top_level_package(k) != "twisted"
68 ]
69 )
70 cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n')
71
72 egg_info.write_toplevel_names = _hacked_write_toplevel_names
73
74 25
75 install_requires = [ 26 install_requires = [
76 'wokkel >= 0.7.1', 27 'wokkel >= 0.7.1',
28 'psycopg2',
77 'simplejson', 29 'simplejson',
30 'uuid',
31 'sat_tmp',
78 ] 32 ]
79 33
80 if sys.version_info < (2, 5):
81 install_requires.append('uuid')
82 34
83 setup(name='sat_pubsub', 35 with open(os.path.join(NAME, 'VERSION')) as f:
84 version=__version__, 36 VERSION = f.read().strip()
85 description=u'XMPP Publish-Subscribe Service Component, build for the need of the « Salut à Toi » project', 37 is_dev_version = VERSION.endswith('D')
86 maintainer='Jérôme Poisson', 38
87 maintainer_email='goffi@goffi.org', 39
88 url='http://repos.goffi.org/sat_pubsub', 40 def sat_dev_version():
89 license='AGPLv3+', 41 """Use mercurial data to compute version"""
90 package_dir={'sat_pubsub': 'src', 42 def version_scheme(version):
91 'twisted': 'src/twisted'}, 43 return VERSION.replace('D', '.dev0')
92 packages=[ 44
93 'sat_pubsub', 45 def local_scheme(version):
94 'sat_pubsub.test', 46 return "+{rev}.{distance}".format(
95 'twisted.plugins', 47 rev=version.node[1:],
96 ], 48 distance=version.distance)
97 package_data={'twisted.plugins': ['src/twisted/plugins/pubsub.py']}, 49
98 data_files=[('share/sat_pubsub', ['db/pubsub.sql'])], 50 return {'version_scheme': version_scheme,
99 zip_safe=False, 51 'local_scheme': local_scheme}
52
53
54 setup(name=NAME,
55 version=VERSION,
56 description=u'XMPP Publish-Subscribe Service Component, build for the need of '
57 u'the « Salut à Toi » project',
58 author='Association « Salut à Toi »',
59 author_email='goffi@goffi.org',
60 url='https://salut-a-toi.org',
61 classifiers=['Development Status :: 5',
62 'Framework :: Twisted',
63 'License :: OSI Approved :: GNU Affero General Public License v3 '
64 'or later (AGPLv3+)',
65 'Operating System :: POSIX :: Linux',
66 'Topic :: Communications :: Chat'],
67 packages=find_packages() + ['twisted.plugins'],
68 data_files=[(os.path.join('share/doc', NAME),
69 ['CHANGELOG', 'COPYING', 'README']),
70 ],
71 zip_safe=True,
72 setup_requires=['setuptools_scm'] if is_dev_version else [],
73 use_scm_version=sat_dev_version if is_dev_version else False,
100 install_requires=install_requires, 74 install_requires=install_requires,
101 ) 75 package_data={'sat_pubsub': ['VERSION']},
76 python_requires='~=2.7',
77 )