-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
109 lines (98 loc) · 3.25 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
98
99
100
101
102
103
104
105
106
107
108
109
import os
import shutil
import subprocess
import sys
from setuptools import find_packages, setup
from setuptools.command.install import install
class InstallPrivatePackages(install):
def _package_dirname(self):
return os.path.join(
self.install_lib, "dodo_commands", "dependencies", "packages"
)
def _bin_dirname(self):
return os.path.join(self.install_lib, "dodo_commands", "bin")
def _install_packages(self, package_dirname):
if not os.path.exists(package_dirname):
os.makedirs(package_dirname)
for dependency in [
"python-dotenv==0.12.0",
"plumbum==1.6.8",
"ruamel.yaml==0.16.10",
"parsimonious==0.8.1",
"six==1.14.0",
"funcy==1.14",
"ansimarkup==1.4.0",
"argcomplete==1.11.1",
"semantic_version==2.8.4",
]:
try:
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"--target",
package_dirname,
dependency,
]
)
except: # noqa
pass
def _install_autocomplete_scripts(self, bin_dirname):
bash_autocomplete_dir = "/etc/bash_completion.d/"
fish_autocomplete_dir = "/etc/fish/conf.d/"
for f, d in (
("dodo_autocomplete.sh", bash_autocomplete_dir),
("dodo_autocomplete.fish", fish_autocomplete_dir),
):
try:
if not os.path.exists(d):
os.makedirs(d)
shutil.copy(os.path.join(bin_dirname, f), d)
except: # noqa
pass
def run(self):
super(InstallPrivatePackages, self).run()
self._install_packages(self._package_dirname())
self._install_autocomplete_scripts(self._bin_dirname())
setup(
name="dodo-commands",
version="0.51.0",
description="Project-aware development environments, inspired by django-manage",
long_description="Project-aware development environments, inspired by django-manage",
long_description_content_type="text/x-rst",
url="https://github.com/mnieber/dodo-commands",
download_url="https://github.com/mnieber/dodo-commands/tarball/0.51.0",
author="Maarten Nieber",
author_email="[email protected]",
license="MIT",
packages=find_packages(),
package_data={
"dodo_commands": [
"bin/*.sh",
"bin/*.fish",
"extra/dodo_standard_commands/*.meta",
"extra/dodo_docker_commands/*.meta",
"extra/fish/functions/*.fish",
"extra/fish/conf.d/*.fish",
]
},
entry_points={
"console_scripts": [
"dodo=dodo_commands.dodo:main",
]
},
data_files=[
(
"/etc/bash_completion.d",
[
"dodo_commands/bin/dodo_autocomplete.sh",
],
),
("/etc/fish/conf.d", ["dodo_commands/bin/dodo_autocomplete.fish"]),
],
cmdclass={"install": InstallPrivatePackages},
install_requires=[],
zip_safe=False,
)