Browse Source

Expose worker & homeserver as entrypoints in `setup.py` (#11449)

Co-authored-by: reivilibre <oliverw@matrix.org>
Maximilian Bosch 2 years ago
parent
commit
42bf020463
3 changed files with 12 additions and 1 deletions
  1. 1 0
      changelog.d/11449.feature
  2. 6 0
      setup.py
  3. 5 1
      synapse/app/generic_worker.py

+ 1 - 0
changelog.d/11449.feature

@@ -0,0 +1 @@
+Expose synapse_homeserver and synapse_worker commands as entry points to run Synapse's main process and worker processes, respectively. Contributed by @Ma27.

+ 6 - 0
setup.py

@@ -152,6 +152,12 @@ setup(
     long_description=long_description,
     long_description_content_type="text/x-rst",
     python_requires="~=3.6",
+    entry_points={
+        "console_scripts": [
+            "synapse_homeserver = synapse.app.homeserver:main",
+            "synapse_worker = synapse.app.generic_worker:main",
+        ]
+    },
     classifiers=[
         "Development Status :: 5 - Production/Stable",
         "Topic :: Communications :: Chat",

+ 5 - 1
synapse/app/generic_worker.py

@@ -505,6 +505,10 @@ def start(config_options: List[str]) -> None:
     _base.start_worker_reactor("synapse-generic-worker", config)
 
 
-if __name__ == "__main__":
+def main() -> None:
     with LoggingContext("main"):
         start(sys.argv[1:])
+
+
+if __name__ == "__main__":
+    main()