-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·117 lines (109 loc) · 4.16 KB
/
setup.py
File metadata and controls
executable file
·117 lines (109 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env python
#
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
import json
import os
import re
import subprocess
from setuptools import setup, find_packages
curdir = os.path.dirname(__file__)
version_cache = os.path.join(curdir, 'charmtools', 'VERSION')
try:
version = subprocess.check_output(
['git', 'describe', '--tags', '--always'],
cwd=curdir, stderr=subprocess.DEVNULL
).decode('UTF-8').strip().lstrip('v')
except Exception:
version = 'unknown'
parts = version.split('-', 2)
# Convert git describe to PEP 440: e.g. '3.0.8-12-gea043cd' -> '3.0.8.post12+gea043cd'
m = re.match(r'^(\d+\.\d+\.\d+)-.*(\d+)-g(.+)$', version)
if m:
version = '{}.post{}+g{}'.format(m.group(1), m.group(2), m.group(3))
elif not re.match(r'^\d+\.\d+', version):
# Bare commit hash or non-semver string — treat as unknown
version = 'unknown'
if version == 'unknown':
# during install; use cached VERSION
try:
with open(version_cache, 'r') as fh:
version_file = fh.read().strip()
try:
info = json.loads(version_file)
version = info.get('version', version_file)
except Exception:
version = version_file
except Exception:
version = None
else:
# during build; update cached VERSION
if len(parts) >= 3:
info = {'version': version, 'git': '+' + parts[1] + '-' + parts[2], 'gitn': parts[1]}
else:
info = {'version': version, 'git': '', 'gitn': 0}
with open(version_cache, 'w') as fh:
fh.write(json.dumps(info))
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as fh:
readme = fh.read()
setup(
name='charm-tools',
version=version,
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=[
'cheetah3>=3.0.0,<4.0',
'pyyaml>=5.0,!=5.4.0,!=5.4.1,!=6.0,<7.0',
'requests>=2.0.0,<3.0.0',
'blessings<2.0',
'ruamel.yaml<0.16.0;python_version < "3.7"',
'pathspec<=0.3.4;python_version < "3.7"',
'ruamel.yaml<0.18;python_version >= "3.7"',
'pathspec<0.11;python_version >= "3.7"',
'otherstuf<=1.1.0',
'path<17',
'pip>=1.5.4',
'jujubundlelib<0.6',
'virtualenv>=1.11.4,<21',
'colander<1.9',
'jsonschema<4.18.0',
'keyring<24',
'secretstorage<3.4',
'dict2colander==0.2',
'requirements-parser<0.6',
'setuptools<82.0',
],
include_package_data=True,
maintainer='Cory Johns',
maintainer_email='johnsca@gmail.com',
description=('Tools for building and maintaining Juju charms'),
long_description=readme,
license='GPL v3',
url='https://github.com/juju/charm-tools',
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python",
],
entry_points={
'console_scripts': [
'charm-build = charmtools.build.builder:main',
'charm-create = charmtools.create:main',
'charm-help = charmtools.cli:usage',
'charm-layers = charmtools.build.builder:inspect',
'charm-proof = charmtools.proof:main',
'charm-pull-source = charmtools.pullsource:main',
'charm-version = charmtools.version:main',
],
'charmtools.templates': [
'bash = charmtools.templates.bash:BashCharmTemplate',
'reactive-python = charmtools.templates.reactive_python:ReactivePythonCharmTemplate', # noqa: E501
'reactive-bash = charmtools.templates.reactive_bash:ReactiveBashCharmTemplate', # noqa: E501
'python-basic = charmtools.templates.python:PythonCharmTemplate',
'python = charmtools.templates.python_services:PythonServicesCharmTemplate', # noqa: E501
'ansible = charmtools.templates.ansible:AnsibleCharmTemplate',
'chef = charmtools.templates.chef:ChefCharmTemplate',
'powershell = charmtools.templates.powershell:PowerShellCharmTemplate', # noqa: E501
]
},
)