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
|
#!/usr/bin/env python3
import os
import inspect
import subprocess
import shutil
import glob
root = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
)
)
def run(cmd, cwd=None):
subprocess.run(cmd, cwd=cwd, check=True)
def main():
cli_dir = os.path.join(root, "cli")
desktop_dir = os.path.join(root, "desktop")
print("○ Clean up from last build")
if os.path.exists(os.path.join(cli_dir, "dist")):
shutil.rmtree(os.path.join(cli_dir, "dist"))
if os.path.exists(os.path.join(desktop_dir, "linux")):
shutil.rmtree(os.path.join(desktop_dir, "linux"))
print("○ Building onionshare-cli")
run(["poetry", "install"], cli_dir)
run(["poetry", "build"], cli_dir)
whl_filename = glob.glob(os.path.join(cli_dir, "dist", "*.whl"))[0]
whl_basename = os.path.basename(whl_filename)
shutil.copyfile(whl_filename, os.path.join(desktop_dir, whl_basename))
print("○ Create the binary")
run(["briefcase", "create"], desktop_dir)
print("○ Create the AppImage")
run(["briefcase", "build"], desktop_dir)
if __name__ == "__main__":
main()
|