Mercurial > libervia-templates
diff setup.py @ 147:33c7ce833d3f
install: setup.py fix + moved "default" dir in a "sat_templates" dir:
the merge request at https://bugs.goffi.org/mr/view/3 was a good basis, but not fully working ("default" dir was removed), this patch fixes it, and do some improvments:
- moved "default" in "sat_templates" dir, which correspond to the python module, so it can be found easily from python
- added VERSION, and mercurial hash detection, in the same way as for Cagou and backend
- slight modification of classifiers
- replaces tabs coming from MR by spaces
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 02 Jun 2018 17:25:43 +0200 |
parents | 7dc00829c32f |
children | a4b6b8b6fc58 |
line wrap: on
line diff
--- a/setup.py Sat Dec 30 14:13:09 2017 +0100 +++ b/setup.py Sat Jun 02 17:25:43 2018 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -# SàT templates: collection of templates +# SàT templates: collection of templates # Copyright (C) 2017 Xavier Maillard (xavier@maillard.im) # This program is free software: you can redistribute it and/or modify @@ -19,7 +19,7 @@ import os import sys -from setuptools import setup, find_packages +from setuptools import setup base = None NAME = 'sat_templates' @@ -27,14 +27,32 @@ # https://stackoverflow.com/a/36693250 -def get_data_templates_files(directory): +def get_package_data(directory): paths = [] for (path, directories, filenames) in os.walk(directory): - for filename in filenames: - paths.append(os.path.join('..', path, filename)) + for filename in filenames: + paths.append(os.path.join('..', path, filename)) return paths -data_templates_files = get_data_templates_files('default') + +with open(os.path.join(NAME, 'VERSION')) as f: + VERSION = f.read().strip() +is_dev_version = VERSION.endswith('D') + + +def sat_templates_dev_version(): + """Use mercurial data to compute version""" + def version_scheme(version): + return VERSION.replace('D', '.dev0') + + def local_scheme(version): + return "+{rev}.{distance}".format( + rev=version.node[1:], + distance=version.distance) + + return {'version_scheme': version_scheme, + 'local_scheme': local_scheme} + setup_info = dict( name=NAME, @@ -43,13 +61,15 @@ author_email='contact@salut-a-toi.org', url='https://salut-a-toi.org', classifiers=['Development Status :: 3 - Alpha', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 2 :: Only', 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', - 'Operating System :: POSIX :: Linux', - 'Topic :: Communications :: Chat'], + ], install_requires=[], + setup_requires=['setuptools_scm'] if is_dev_version else [], + use_scm_version=sat_templates_dev_version if is_dev_version else False, packages=['sat_templates'], - package_dir={'sat_templates':'default'}, - package_data={'': data_templates_files }, + package_data={'sat_templates': get_package_data('sat_templates') }, data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']), ('share/doc/%s' % NAME, ['COPYING']), ],