-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
97 lines (82 loc) · 2.66 KB
/
setup.py
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
from setuptools import setup
import os
VERSION = '1.0.6'
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.md'),
encoding='utf8',
) as fp:
return fp.read()
from setuptools.command.install import install
from setuptools.command.develop import develop
class CommandMixin(object):
"""From: https://stackoverflow.com/a/53833930"""
user_options = [
('deploy=', None, 'Set deploy to a different name'),
('secrets=', None, 'Set secrets to a different name'),
]
def initialize_options(self):
super().initialize_options()
# Initialize options
self.deploy = None
self.secrets = None
def finalize_options(self):
# Validate options
super().finalize_options()
def run(self):
# Use options
global deploy
global secrets
if self.deploy is not None:
deploy = self.deploy
else:
deploy = 'deploy'
if self.secrets is not None:
secrets = self.secrets
else:
secrets = 'secrets'
super().run()
class InstallCommand(CommandMixin, install):
user_options = getattr(install, 'user_options', []) + CommandMixin.user_options
class DevelopCommand(CommandMixin, develop):
user_options = getattr(develop, 'user_options', []) + CommandMixin.user_options
setup(
# This is an attempt to make the command names customizable but the approach
# is not working. Despite being marked as global variables above, they
# do not seem to be available here for the entry points value.
#cmdclass={
# 'install': InstallCommand,
# 'develop': DevelopCommand,
#},
name='git-deploy',
description='Ansible-based git-subcommand deployment',
long_description=get_long_description(),
long_description_content_type='text/markdown',
author='Northwestern University Knight Lab',
url='https://github.com/NUKnightLab/git-deploy',
project_urls={
'Issues': 'https://github.com/NUKnightLab/git-deploy/issues',
'Changelog': 'https://github.com/NUKnightLab/git-deploy/blob/master/Changelog.md'
},
license='MIT',
version=VERSION,
packages=['gitdeploy'],
entry_points="""
[console_scripts]
git-deploy=gitdeploy.cli.deploy:run_deploy
git-secrets=gitdeploy.cli.secrets:run_secrets
""",
install_requires=[
'GitPython',
'ansible',
'click',
'click-option-group',
'python-dotenv',
'rich',
'typer',
],
extras_require={
'test': ['pytest']
},
tests_require=['git-deploy[test]'],
)