Public bug reported:

Fresh package from today still has the problem of clang-view unable to
import module ScanView.

This is the same bug as in: https://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=838572

Proposed fix does work if applied locally.

Copied from the link:
Hello,

scan-view-3.9 fails to find the needed python modules:

$ scan-view-3.9 scan-build-master/
Traceback (most recent call last):
  File "/usr/bin/scan-view-3.9", line 143, in <module>
    main()
  File "/usr/bin/scan-view-3.9", line 140, in main
    run(port, args, args.root)
  File "/usr/bin/scan-view-3.9", line 70, in run
    import ScanView
ImportError: No module named ScanView

the problem is that os.path.dirname(__file__) is /usr/bin and not
/usr/share/clang/scan-view-3.9/bin
as expected by the script.

A quick way to fix that is to hardcode the scan-view dir:

$ diff -u ../bin/scan-view.old ../bin/scan-view
--- ../bin/scan-view.old        2016-09-22 16:31:01.209052200 +0200
+++ ../bin/scan-view    2016-09-22 16:39:19.383579819 +0200
@@ -22,6 +22,8 @@
 kDefaultPort = 8181
 kMaxPortsToTry = 100

+BASE_DIR = '/usr/share/clang/scan-view-3.9'
+
 ###


@@ -61,7 +63,7 @@

 def run(port, options, root):
     # Prefer to look relative to the installed binary
-    share = os.path.dirname(__file__) + "/../share/"
+    share = os.path.join(BASE_DIR, 'share')
     if not os.path.isdir(share):
         # Otherwise look relative to the source
         share = os.path.dirname(__file__) + "/../../scan-view/share"

** Affects: llvm-toolchain-3.9 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1660622

Title:
  clang-view cannot import module ScanView

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-3.9/+bug/1660622/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to