aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Weth <git@jonathanweth.de>2021-06-23 12:33:28 +0200
committerJonathan Weth <git@jonathanweth.de>2021-06-23 12:33:28 +0200
commited1d15aa02b3c7c1350a5204861d1f8678550fbb (patch)
tree51d4aa7cdee4f90b5f2c3a4188cb80519dd2342d
parent74e02d1953c1ee03a4e7dfc73e80318a24ba56a7 (diff)
downloadRWA.Support.SessionService-ed1d15aa02b3c7c1350a5204861d1f8678550fbb.tar.gz
RWA.Support.SessionService-ed1d15aa02b3c7c1350a5204861d1f8678550fbb.tar.bz2
RWA.Support.SessionService-ed1d15aa02b3c7c1350a5204861d1f8678550fbb.zip
Restructure project directory and provide script for session service
-rw-r--r--docs/admin/01_installation.rst5
-rw-r--r--docs/admin/03_testing.rst2
-rw-r--r--pyproject.toml10
-rw-r--r--rwa/support/sessionservice/config.py (renamed from config.py)0
-rw-r--r--rwa/support/sessionservice/lock.py (renamed from lock.py)0
-rw-r--r--rwa/support/sessionservice/log.py (renamed from log.py)0
-rwxr-xr-xrwa/support/sessionservice/service.py (renamed from service.py)13
-rw-r--r--rwa/support/sessionservice/session.py (renamed from session.py)6
-rw-r--r--rwa/support/sessionservice/trigger.py (renamed from trigger.py)0
-rw-r--r--rwa/support/sessionservice/vnc.py (renamed from vnc.py)0
10 files changed, 22 insertions, 14 deletions
diff --git a/docs/admin/01_installation.rst b/docs/admin/01_installation.rst
index 4b5b45a..461cdf7 100644
--- a/docs/admin/01_installation.rst
+++ b/docs/admin/01_installation.rst
@@ -44,8 +44,3 @@ Now you can continue with :doc:`02_config`.
::
poetry run python test_client.py
-
- # or
-
- poetry run python tox
-
diff --git a/docs/admin/03_testing.rst b/docs/admin/03_testing.rst
index ab427bc..7e447c4 100644
--- a/docs/admin/03_testing.rst
+++ b/docs/admin/03_testing.rst
@@ -12,7 +12,7 @@ so the client can interact with it:
::
- poetry run python service.py
+ poetry run rwa-support-sessionservice
Now you can use the test client to start a test session
and register it in your RWA server. It will return a PIN and
diff --git a/pyproject.toml b/pyproject.toml
index 19c48e6..b742893 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,6 +8,10 @@ authors = [
"Jonathan Weth <dev@jonathanweth.de>"
]
license = "GPL-2.0-or-later"
+packages = [
+ { include = "rwa/" },
+]
+include = ["README.rst", "LICENCE", "org.ArcticaProject.RWASupportSessionService.service", "docs/*", "docs/*/**"]
[tool.poetry.dependencies]
python = "^3.7"
@@ -25,6 +29,12 @@ dynaconf = "^3.0.0"
sphinx = "^3.0"
sphinx-autodoc-typehints = "^1.7"
+[tool.poetry.scripts]
+rwa-support-sessionservice = 'rwa.support.sessionservice.service:main'
+
+[tool.black]
+line-length = 100
+
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
diff --git a/config.py b/rwa/support/sessionservice/config.py
index f0f8369..f0f8369 100644
--- a/config.py
+++ b/rwa/support/sessionservice/config.py
diff --git a/lock.py b/rwa/support/sessionservice/lock.py
index b4e384c..b4e384c 100644
--- a/lock.py
+++ b/rwa/support/sessionservice/lock.py
diff --git a/log.py b/rwa/support/sessionservice/log.py
index ad8bf88..ad8bf88 100644
--- a/log.py
+++ b/rwa/support/sessionservice/log.py
diff --git a/service.py b/rwa/support/sessionservice/service.py
index ada9b15..ae634c8 100755
--- a/service.py
+++ b/rwa/support/sessionservice/service.py
@@ -40,9 +40,9 @@ import dbus.mainloop.glib
import dbus.service
from gi.repository import GLib
-from lock import is_locked, lock, unlock
-from session import Session
-from trigger import TriggerServerThread
+from .lock import is_locked, lock, unlock
+from .session import Session
+from .trigger import TriggerServerThread
ALLOW_ONLY_ONE_SESSION = True
@@ -281,8 +281,7 @@ def str2bool(v: Union[str, bool, int]) -> bool:
else:
raise argparse.ArgumentTypeError("Boolean value expected.")
-
-if __name__ == "__main__":
+def main():
# Check for lock file
if is_locked():
logging.error("The service is already running.")
@@ -335,3 +334,7 @@ if __name__ == "__main__":
logging.info("Remove lock file ...")
unlock()
+
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/session.py b/rwa/support/sessionservice/session.py
index f977669..1dfb6bb 100644
--- a/session.py
+++ b/rwa/support/sessionservice/session.py
@@ -35,9 +35,9 @@ import port_for
import psutil
import requests
-from config import settings
-from log import logging
-from vnc import run_vnc, save_password
+from .config import settings
+from .log import logging
+from .vnc import run_vnc, save_password
API_SERVER = settings.get("api_url", "http://127.0.0.1")
BASE_URL = API_SERVER + "/app/rwasupport/api/"
diff --git a/trigger.py b/rwa/support/sessionservice/trigger.py
index fa9734a..fa9734a 100644
--- a/trigger.py
+++ b/rwa/support/sessionservice/trigger.py
diff --git a/vnc.py b/rwa/support/sessionservice/vnc.py
index 1725532..1725532 100644
--- a/vnc.py
+++ b/rwa/support/sessionservice/vnc.py