annotate setup.py @ 150:1b214b168948

static (css): set overflow for menu
author Goffi <goffi@goffi.org>
date Mon, 04 Jun 2018 10:22:55 +0200
parents a4b6b8b6fc58
children d9cc8f453baa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
1 #!/usr/bin/env python2
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
3
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
4 # SàT templates: collection of templates
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
5 # Copyright (C) 2017 Xavier Maillard (xavier@maillard.im)
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
6
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
10 # (at your option) any later version.
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
11
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
16
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
19
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
20 import os
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
21 import sys
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
22 from setuptools import setup
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
23
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
24 base = None
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
25 NAME = 'sat_templates'
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
26 is_wheel = 'bdist_wheel' in sys.argv
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
27
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
28 # https://stackoverflow.com/a/36693250
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
29
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
30 def get_package_data(directory):
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
31 paths = []
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
32 for (path, directories, filenames) in os.walk(directory):
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
33 for filename in filenames:
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
34 paths.append(os.path.join('..', path, filename))
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
35 return paths
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
36
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
37
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
38 with open(os.path.join(NAME, 'VERSION')) as f:
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
39 VERSION = f.read().strip()
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
40 is_dev_version = VERSION.endswith('D')
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
41
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
42
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
43 def sat_templates_dev_version():
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
44 """Use mercurial data to compute version"""
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
45 def version_scheme(version):
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
46 return VERSION.replace('D', '.dev0')
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
47
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
48 def local_scheme(version):
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
49 return "+{rev}.{distance}".format(
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
50 rev=version.node[1:],
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
51 distance=version.distance)
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
52
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
53 return {'version_scheme': version_scheme,
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
54 'local_scheme': local_scheme}
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
55
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
56
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
57 setup_info = dict(
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
58 name=NAME,
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
59 version= '0.7D',
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
60 author='Association « Salut à Toi »',
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
61 author_email='contact@salut-a-toi.org',
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
62 url='https://salut-a-toi.org',
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
63 classifiers=['Development Status :: 3 - Alpha',
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
64 'Programming Language :: Python :: 2.7',
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
65 'Programming Language :: Python :: 2 :: Only',
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
66 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
67 ],
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
68 install_requires=[],
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
69 setup_requires=['setuptools_scm'] if is_dev_version else [],
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
70 use_scm_version=sat_templates_dev_version if is_dev_version else False,
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
71 packages=['sat_templates'],
147
33c7ce833d3f install: setup.py fix + moved "default" dir in a "sat_templates" dir:
Goffi <goffi@goffi.org>
parents: 146
diff changeset
72 package_data={'sat_templates': get_package_data('sat_templates') },
146
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
73 zip_safe=True,
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
74 )
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
75
7dc00829c32f Instal sat_templates the python's way
Xavier Maillard <xavier@maillard.im>
parents:
diff changeset
76 setup(**setup_info)