-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
executable file
·93 lines (84 loc) · 2.76 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
#!/usr/bin/python3
import os
import shutil
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
with open("README.md", "r") as f:
readme = f.read()
class CompletionDevelop(develop):
def run(self):
if os.access("/etc/bash_completion.d", os.W_OK):
shutil.copyfile("extrafiles/completion.sh", "/etc/bash_completion.d/xbstrap")
else:
print(
"Insufficient permissions to install the bash completion script to"
" /etc/bash_completion.d"
)
if os.access("/usr/share/fish/vendor_completions.d/", os.W_OK):
shutil.copyfile(
"extrafiles/completion.fish", "/usr/share/fish/vendor_completions.d/xbstrap.fish"
)
else:
print(
"Insufficient permissions to install the fish completion script to"
" /usr/share/fish/vendor_completions.d"
)
develop.run(self)
class CompletionInstall(install):
def run(self):
if os.access("/etc/bash_completion.d", os.W_OK):
shutil.copyfile("extrafiles/completion.sh", "/etc/bash_completion.d/xbstrap")
else:
print(
"Insufficient permissions to install the bash completion script to"
" /etc/bash_completion.d"
)
if os.access("/usr/share/fish/vendor_completions.d/", os.W_OK):
shutil.copyfile(
"extrafiles/completion.fish", "/usr/share/fish/vendor_completions.d/xbstrap.fish"
)
else:
print(
"Insufficient permissions to install the fish completion script to"
" /usr/share/fish/vendor_completions.d"
)
install.run(self)
setup(
name="xbstrap",
version="0.32.1",
packages=find_packages(),
package_data={"xbstrap": ["schema.yml"]},
install_requires=[
"colorama",
"jsonschema",
"pyyaml",
"zstandard", # For xbps support.
],
extras_require={
"test": [
"black",
"flake8",
"pep8-naming",
"flake8-isort",
]
},
cmdclass={
"develop": CompletionDevelop,
"install": CompletionInstall,
},
entry_points={
"console_scripts": [
"xbstrap = xbstrap:main",
"xbstrap-pipeline = xbstrap.pipeline:main",
"xbstrap-mirror = xbstrap.mirror:main",
]
},
# Package metadata.
author="Alexander van der Grinten",
author_email="[email protected]",
license="MIT",
url="https://github.com/managarm/xbstrap",
long_description=readme,
long_description_content_type="text/markdown",
)