[Python-apps-team] Bug#930457: mu-editor: debugger broken.

Peter Green plugwash-urgent at p10link.net
Thu Jun 13 04:06:53 BST 2019


Package: mu-editor Severity: important x-debbugs-cc: ntoll at ntoll.org x-debbugs-cc: ben at raspberrypi.org x-debbugs-cc: knowledgejunkie at gmail.com Ben Nuttal recently informed my that trying to use the "debug" button in mu-editor in Debian buster results in

> Traceback (most recent call last):
>
> File "/usr/share/mu-editor/mu/mu-debug.py", line 4, in <module>
>
> from mu.app import debug
>
> ModuleNotFoundError: No module named 'mu'
>
Investigation shows that this is the result of failure to find mu-related python modules. mu-editor itself finds them because the mu-editor executable (AFTER following the symlink) is located in /usr/share/mu-editor but the mu-debug helper script is in a subdirectory and so does not find them.

The simplest fix seems to be to adjust sys.path[0] in mu-debug.py I whipped up (and tested) a patch to do that. While working on that I noticed that the clean target was broken, so I fixed that too. knowledgejunkie: are you ok if I go ahead and NMU this and ask the release team for an unblock? (if I get no response i'll NMU in 5 days, but I'd really like to move sooner given how little time is available before release)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/python-apps-team/attachments/20190613/164fe600/attachment.html>
-------------- next part --------------
diff -Nru mu-editor-1.0.2+dfsg/debian/changelog mu-editor-1.0.2+dfsg/debian/changelog
--- mu-editor-1.0.2+dfsg/debian/changelog	2019-02-28 02:43:16.000000000 +0000
+++ mu-editor-1.0.2+dfsg/debian/changelog	2019-06-13 02:03:44.000000000 +0000
@@ -1,3 +1,12 @@
+mu-editor (1.0.2+dfsg-2.1) unstable; urgency=medium
+
+  * Non-Maintainer upload.
+  * Adjust sys.path[0] in mu/mu-debug.py so that debugger works
+    (Closes: ???)
+  * Fix clean target.
+
+ -- Peter Michael Green <plugwash at debian.org>  Thu, 13 Jun 2019 02:03:44 +0000
+
 mu-editor (1.0.2+dfsg-2) unstable; urgency=medium
 
   * d/gbp.conf: use pristine-tar
diff -Nru mu-editor-1.0.2+dfsg/debian/patches/mu-debug-alter-sys.path.patch mu-editor-1.0.2+dfsg/debian/patches/mu-debug-alter-sys.path.patch
--- mu-editor-1.0.2+dfsg/debian/patches/mu-debug-alter-sys.path.patch	1970-01-01 00:00:00.000000000 +0000
+++ mu-editor-1.0.2+dfsg/debian/patches/mu-debug-alter-sys.path.patch	2019-06-13 02:03:44.000000000 +0000
@@ -0,0 +1,23 @@
+Description:  Adjust sys.path[0] in mu/mu-debug.py so that debugger works
+ Debian installs mu-editor's modules in a directory that is not on the
+ global python path. mu-editor finds the modules through sys.path[0]
+ pointing at /usr/share/mu-editor, unfortunately for mu-debug.py 
+ sys.path[0] is /usr/share/mu-editor/mu, so the modules are not found
+ adjust sys.path[0] in mu-editor.py to fix this issue
+Author: Peter Michael Green <plugwash at debian.org>
+Last-Update: 2019-06-13
+
+--- mu-editor-1.0.2+dfsg.orig/mu/mu-debug.py
++++ mu-editor-1.0.2+dfsg/mu/mu-debug.py
+@@ -1,6 +1,11 @@
+ #!/usr/bin/env python3
+ import os
+ import sys
++
++#Remove last path element from sys.path[0] so that mu modules can be found relative to this executable.
++import os.path
++sys.path[0] = os.path.dirname(sys.path[0])
++
+ from mu.app import debug
+ 
+ 
diff -Nru mu-editor-1.0.2+dfsg/debian/patches/series mu-editor-1.0.2+dfsg/debian/patches/series
--- mu-editor-1.0.2+dfsg/debian/patches/series	2019-02-28 02:43:16.000000000 +0000
+++ mu-editor-1.0.2+dfsg/debian/patches/series	2019-06-13 02:03:44.000000000 +0000
@@ -8,3 +8,4 @@
 remove-non-dfsg-images-from-docs
 remove-non-dfsg-resources
 test_app_icon_as_string
+mu-debug-alter-sys.path.patch
diff -Nru mu-editor-1.0.2+dfsg/debian/rules mu-editor-1.0.2+dfsg/debian/rules
--- mu-editor-1.0.2+dfsg/debian/rules	2019-02-28 02:43:16.000000000 +0000
+++ mu-editor-1.0.2+dfsg/debian/rules	2019-06-13 02:03:44.000000000 +0000
@@ -27,6 +27,9 @@
 override_dh_auto_clean:
 	dh_auto_clean
 	rm -rf docs/html
+	rm -f debian/mu-editor.1
+	rm -f debian/mu-editor.1.md
+	rm -rf .pytest_cache
 
 override_dh_auto_build:
 	dh_auto_build


More information about the Python-apps-team mailing list