← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~bastian-germann/openlp/main into lp:openlp

 

Bastian Germann has proposed merging lp:~bastian-germann/openlp/main into lp:openlp.

Commit message:
Use start script __main__.py which enables 'python -m openlp'

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~bastian-germann/openlp/main/+merge/372443

The situation with OpenLP exporting two packages (openlp and run_openlp) is unpythonic. There is an obvious fix for that: using __main__.py. A neat side effect: It enables starting OpenLP via 'python -m openlp'.

As packages will have to be touched anyway because the start script was renamed to run_openlp.py during the current development cycle we should take the chance and do it the right way.
-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== renamed file 'run_openlp.py' => 'openlp/__main__.py' (properties changed: +x to -x)
--- run_openlp.py	2019-07-02 21:19:30 +0000
+++ openlp/__main__.py	2019-09-06 22:34:51 +0000
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
 

=== added file 'run_openlp.py'
--- run_openlp.py	1970-01-01 00:00:00 +0000
+++ run_openlp.py	2019-09-06 22:34:51 +0000
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+##########################################################################
+# OpenLP - Open Source Lyrics Projection                                 #
+# ---------------------------------------------------------------------- #
+# Copyright (c) 2008-2019 OpenLP Developers                              #
+# ---------------------------------------------------------------------- #
+# This program is free software: you can redistribute it and/or modify   #
+# it under the terms of the GNU General Public License as published by   #
+# the Free Software Foundation, either version 3 of the License, or      #
+# (at your option) any later version.                                    #
+#                                                                        #
+# This program is distributed in the hope that it will be useful,        #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of         #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
+# GNU General Public License for more details.                           #
+#                                                                        #
+# You should have received a copy of the GNU General Public License      #
+# along with this program.  If not, see <https://www.gnu.org/licenses/>. #
+##########################################################################
+"""
+A compatibility entrypoint for OpenLP
+"""
+from openlp import __main__
+
+if __name__ == '__main__':
+    __main__.start()

=== modified file 'setup.py'
--- setup.py	2019-08-03 18:19:25 +0000
+++ setup.py	2019-09-06 22:34:51 +0000
@@ -161,7 +161,6 @@
     url='https://openlp.org/',
     license='GPL-3.0-or-later',
     packages=find_packages(exclude=['ez_setup', 'tests*']),
-    py_modules=['run_openlp'],
     include_package_data=True,
     zip_safe=False,
     python_requires='>=3.6',
@@ -209,5 +208,5 @@
         'python-xlib; platform_system=="Linux"'
     ],
     setup_requires=['pytest-runner'],
-    entry_points={'gui_scripts': ['openlp = run_openlp:start']}
+    entry_points={'gui_scripts': ['openlp = openlp.__main__:start']}
 )


Follow ups