Kaynağa Gözat

Service files + qdarkstyle script

Maarten van den Berg 6 yıl önce
ebeveyn
işleme
8432bd5b6e
3 değiştirilmiş dosya ile 46 ekleme ve 1 silme
  1. 43 0
      bin/install-service-files.py
  2. 1 0
      bin/qdarkstyle-hotfix
  3. 2 1
      setup.py

+ 43 - 0
bin/install-service-files.py

@@ -0,0 +1,43 @@
1
+import os.path
2
+import sys
3
+
4
+systemd_user_dir = os.path.expanduser('~/.config/systemd/user')
5
+
6
+python_interpreter_dir = os.path.dirname(sys.executable)
7
+uwsgi_path = os.path.join(python_interpreter_dir, 'uwsgi')
8
+piket_client_path = os.path.join(python_interpreter_dir, 'piket-client')
9
+
10
+server_template = f"""[Unit]
11
+Description=piket server daemon
12
+
13
+[Service]
14
+ExecStart={uwsgi_path} --http :5000 --master --threads 2 --module piket_server:app
15
+KillSignal=SIGINT
16
+Type=notify
17
+NotifyAccess=all
18
+
19
+[Install]
20
+WantedBy=default.target
21
+"""
22
+
23
+client_template = f"""[Unit]
24
+Description=piket client
25
+Requires=piket-server.service
26
+After=piket-server.service
27
+
28
+[Service]
29
+ExecStart={piket_client_path}
30
+
31
+[Install]
32
+WantedBy=graphical.target
33
+"""
34
+
35
+os.makedirs(systemd_user_dir, exist_ok=True)
36
+
37
+with open(os.path.join(systemd_user_dir, 'piket-server.service'), 'w') as f:
38
+    f.write(server_template)
39
+
40
+with open(os.path.join(systemd_user_dir, 'piket-client.service'), 'w') as f:
41
+    f.write(client_template)
42
+
43
+print("Done! Don't forget to systemctl --user daemon-reload.")

+ 1 - 0
bin/qdarkstyle-hotfix

@@ -0,0 +1 @@
1
+pip install -I 'qdarkstyle@https://github.com/ColinDuquesnoy/QDarkStyleSheet/tarball/d089f12f674c78285302e509745a68cc3fa4bb3b#sha256=83902ddd331b61036568c2d179fc302e5f448b5c6b2e2bd3dec4ffb76725c113'

+ 2 - 1
setup.py

@@ -43,10 +43,11 @@ setup(
43 43
                 'SQLAlchemy',
44 44
                 'Flask-SQLAlchemy',
45 45
                 'alembic',
46
+                'uwsgi',
46 47
             ],
47 48
             'client': [
48 49
                 'PySide2',
49
-                'qdarkstyle@https://github.com/ColinDuquesnoy/QDarkStyleSheet/tarball/d089f12f674c78285302e509745a68cc3fa4bb3b#sha256=83902ddd331b61036568c2d179fc302e5f448b5c6b2e2bd3dec4ffb76725c113',
50
+                'qdarkstyle>=2.6.0',
50 51
                 'requests',
51 52
                 'simpleaudio',
52 53
             ],