-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathbuild-rpm.py
executable file
·43 lines (34 loc) · 1.02 KB
/
build-rpm.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import inspect
import os
import shutil
import subprocess
import sys
root = os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
)
with open(os.path.join(root, "share", "version.txt")) as f:
version = f.read().strip()
def main():
build_path = os.path.join(root, "build")
dist_path = os.path.join(root, "dist")
print("* Deleting old build and dist")
if os.path.exists(build_path):
shutil.rmtree(build_path)
if os.path.exists(dist_path):
shutil.rmtree(dist_path)
print("* Building RPM package")
subprocess.run(
"python3 setup.py bdist_rpm --requires='podman,python3-pyside2,python3-appdirs,python3-click,python3-pyxdg,python3-colorama'",
shell=True,
cwd=root,
check=True,
)
print("")
print("* To install run:")
print("sudo dnf install dist/dangerzone-{}-1.noarch.rpm".format(version))
if __name__ == "__main__":
main()