Debian Codegraph @

setup.py

raw
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Copyright (c) 2013 Spotify AB
4
5 # This file is part of dh-virtualenv.
6
7 # dh-virtualenv is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation, either version 2 of the
10 # License, or (at your option) any later version.
11
12 # dh-virtualenv is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with dh-virtualenv. If not, see
19 # <http://www.gnu.org/licenses/>.
20
21 import io
22 import re
23 import os
24 import sys
25 import json
26
27 from setuptools import setup
28
29 version_py = os.path.join(os.path.dirname(__file__), "dh_virtualenv", "_version.py")
30 project = {}
31 with io.open(version_py, 'r', encoding='utf-8') as handle:
32 for line in handle:
33 try:
34 key, value = re.match(r"^(\w+) ?= ?u?'(.+?)'$", line).groups()
35 except (AttributeError, TypeError, ValueError):
36 pass
37 else:
38 project[key] = value
39 assert all(x in project for x in ('version', 'author', 'author_email', 'url')), 'Bad metadata in _version.py!'
40
41 project.update(
42 name='dh_virtualenv',
43 description='Debian packaging sequence for Python virtualenvs.',
44 license='GNU General Public License v2 or later',
45 scripts=['bin/dh_virtualenv'],
46 packages=['dh_virtualenv'],
47 classifiers=[
48 'Intended Audience :: Developers',
49 'Intended Audience :: System Administrators',
50 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
51 'Topic :: Software Development :: Build Tools',
52 'Topic :: System :: Installation/Setup',
53 'Topic :: Utilities',
54 ])
55
56 # Ensure "setup.py" is importable by other tools, to access the project's metadata
57 __all__ = ['project']
58 if __name__ == '__main__':
59 if '--metadata' in sys.argv[:2]:
60 json.dump(project, sys.stdout, default=repr, indent=4, sort_keys=True)
61 sys.stdout.write('\n')
62 else:
63 setup(**project)