-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·194 lines (176 loc) · 5.14 KB
/
setup.py
File metadata and controls
executable file
·194 lines (176 loc) · 5.14 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import setuptools
from setuptools.command.build_ext import build_ext as hookBuild_ext
from subprocess import check_output
import os
import time
from shutil import copy2
from sys import platform
from glob import glob
try:
from babel.messages import frontend as babel
compile_catalog = babel.compile_catalog
except ImportError:
compile_catalog=None
try:
from stdeb.command.sdist_dsc import sdist_dsc
from stdeb.command.bdist_deb import bdist_deb
class sdist_dsc_with_postinst(sdist_dsc):
def run(self):
res = super(sdist_dsc_with_postinst, self).run()
print("Installing vula postinst")
copy2(
'misc/python3-vula.postinst',
self.dist_dir + '/vula-{}/debian/'.format(version),
)
return res
except ImportError:
sdist_dsc = None
sdist_dsc_with_postinst = None
bdist_deb = None
try:
from click_man.commands.man_pages import man_pages
except ImportError:
man_pages = None
try:
os.environ['SOURCE_DATE_EPOCH'] = (
check_output("git log -1 --pretty=%ct", shell=True).decode().strip()
)
except:
os.environ['SOURCE_DATE_EPOCH'] = str(int(time.time()))
if os.path.exists('vula/__version__.py'):
with open("vula/__version__.py", "r") as obj:
version = str(obj.readline().strip())
version = version.split('"')[1]
if os.path.exists('requirements.txt'):
with open("requirements.txt", "r") as obj:
requirements = obj.read().splitlines()
else:
# this makes stdeb work
requirements = []
with open("README.md", "r") as obj:
long_description = obj.read()
linux_data_files = [
(
"/etc/systemd/system/",
[
"configs/systemd/vula.slice",
"configs/systemd/vula.target",
"configs/systemd/vula-discover.target",
"configs/systemd/vula-publish.target",
"configs/systemd/vula-organize-monolithic.target",
"configs/systemd/vula-discover.service",
"configs/systemd/vula-publish.service",
"configs/systemd/vula-organize.service",
"configs/systemd/vula-organize-monolithic.service",
],
),
(
"/etc/dbus-1/system.d/",
['configs/dbus/local.vula.services.conf'],
),
(
"/usr/share/applications",
[
"misc/linux-desktop/vula.desktop"
]
),
(
"/usr/share/icons",
[
"misc/linux-desktop/vula_gui_icon.png"
]
),
(
"/usr/share/dbus-1/system-services/",
[
'configs/dbus/local.vula.organize.service',
'configs/dbus/local.vula.publish.service',
'configs/dbus/local.vula.discover.service',
],
),
(
"/usr/share/polkit-1/actions/",
['configs/polkit/local.vula.organize.Debug.policy'],
),
("/usr/lib/sysusers.d/", ['configs/sysusers.d/vula.conf']),
(
"/usr/share/man/man1/",
glob('man/vula*1'),
),
(
"",
["misc/python3-vula.postinst"],
),
]
# The locations for files on macOS. This differs from Linux in
# that the files are stored in usr/local instead of usr/share.
macos_data_files = [
(
"/usr/local/share/dbus-1/",
['configs/dbus/local.vula.services.conf'],
),
(
"/usr/local/dbus-1/system-services/",
[
'configs/dbus/local.vula.organize.service',
'configs/dbus/local.vula.publish.service',
'configs/dbus/local.vula.discover.service',
],
),
("/usr/local/lib/sysusers.d/", ['configs/sysusers.d/vula.conf']),
(
"/usr/local/man/man1/",
glob('man/vula*1'),
),
(
"",
["misc/python3-vula.postinst"],
),
]
# Uses the macOS specific paths for Darwin (macOS) systems
if platform == "darwin":
our_data_files = macos_data_files
else:
our_data_files = linux_data_files
if platform.startswith("openbsd"):
our_data_files = []
class print_version(hookBuild_ext):
def run(self):
print(version)
setuptools.setup(
name="vula",
version=version,
author="Vula Authors",
author_email="git@vula.link",
description=("Automatic local network encryption"),
long_description=long_description,
long_description_content_type="text/markdown",
license="GPLv3",
url="https://codeberg.org/vula/vula",
packages=setuptools.find_packages(),
keywords="WireGuard, mDNS, encryption",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
],
python_requires=">=3.7",
entry_points={
"console_scripts": [
"vula=vula.__main__:main",
]
},
install_requires=requirements,
data_files=our_data_files,
package_data={'vula': ['vula/locale/*/LC_MESSAGES/*.mo']},
include_package_data=True,
zip_safe=False,
tests_require=["pytest"],
cmdclass=dict(
compile_catalog=compile_catalog,
bdist_deb=bdist_deb,
sdist_dsc=sdist_dsc_with_postinst,
man_pages=man_pages,
version=print_version,
),
)