[meld/flatpak-ci] bin/meld: Refactor our entry point to be saner



commit bd05c54c1ac394bdbf4403b99488d4eac62473e0
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Dec 20 08:03:00 2019 +1000

    bin/meld: Refactor our entry point to be saner

 bin/meld | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/bin/meld b/bin/meld
old mode 100644
new mode 100755
index 8ffa5f88..6627d176
--- a/bin/meld
+++ b/bin/meld
@@ -403,7 +403,20 @@ def environment_hacks():
             pass
 
 
-if __name__ == '__main__':
+def run_application():
+    from meld.meldapp import MeldApp
+
+    app = MeldApp()
+
+    if sys.platform != 'win32':
+        from gi.repository import GLib
+        GLib.unix_signal_add(
+            GLib.PRIORITY_DEFAULT, signal.SIGINT, lambda *args: app.quit())
+
+    return app.run(sys.argv)
+
+
+def main():
     setup_logging()
     disable_stdout_buffering()
     check_requirements()
@@ -411,14 +424,8 @@ if __name__ == '__main__':
     setup_resources()
     setup_settings()
     environment_hacks()
+    return run_application()
 
-    from meld.meldapp import MeldApp
-    app = MeldApp()
-
-    if sys.platform != 'win32':
-        from gi.repository import GLib
-        GLib.unix_signal_add(
-            GLib.PRIORITY_DEFAULT, signal.SIGINT, lambda *args: app.quit())
 
-    status = app.run(sys.argv)
-    sys.exit(status)
+if __name__ == '__main__':
+    sys.exit(main())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]