[Bug 270670] devel/llvm*: LLVM_SUFFIX with '-' breaks llvm Python modules

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 06 Apr 2023 16:02:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270670

            Bug ID: 270670
           Summary: devel/llvm*: LLVM_SUFFIX with '-' breaks llvm Python
                    modules
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: kaktus@FreeBSD.org

Created attachment 241325
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=241325&action=edit
proposed patch

I found an issue with the lit tool that comes bundled with llvm (if the LIT
options is selected).

% lit-devel
  File "/usr/local/bin/lit-devel", line 3
    from lit-devel.main import main
            ^
SyntaxError: invalid syntax

Lit is written in Python.  The issue is that the LLVM_SUFFIX contains a '-' and
sed that is being run during the build to add the LLVM_SUFFIX to filenames
inadvertently converts also a Python module name.  Python doesn't support
importing modules with dashes in names.

I'm attaching a patch that resolved that issue for me.  It uses an underscore
variant of the LLVM_SUFFIX ('_' in a module name is accepted) to change the
relevant parts of python lib so lit-devel becomes lit_devel, the script name
keeps the expected name of lit-LLVM_SUFFIX.

I only tested it on llvm-devel.

-- 
You are receiving this mail because:
You are the assignee for the bug.