Re: [ANNOUNCE] Kconfiglib menuconfig implementation

From: Ulf Magnusson
Date: Sat May 19 2018 - 23:29:47 EST


On Sun, May 20, 2018 at 5:51 AM, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
> On 05/19/2018 08:45 PM, Randy Dunlap wrote:
>> On 05/08/2018 09:59 AM, Ulf Magnusson wrote:
>>> Hello,
>>>
>>> I've added incremental search for jumping directly to a symbol now.
>>> Regular expressions are supported as well.
>>>
>>> Some screenshots below:
>>>
>>> https://raw.githubusercontent.com/ulfalizer/Kconfiglib/screenshots/screenshots/ss10.png
>>> https://raw.githubusercontent.com/ulfalizer/Kconfiglib/screenshots/screenshots/ss11.png
>>> https://raw.githubusercontent.com/ulfalizer/Kconfiglib/screenshots/screenshots/ss13.png
>>>
>>> The last screenshot shows how things might look after you jump to a
>>> symbol. The jumped-to symbol wasn't visible in this case, so show-all
>>> mode was turned on automatically.
>>
>> Hi Ulf,
>>
>>
>> Hm, OK, I used the trick that you supplied a few weeks ago and I have the UI now.
>>
>> ARCH=x86 SRCARCH=x86 KERNELVERSION=`make kernelversion` \
>> Kconfiglib/menuconfig.py
>>
>> so yes, a real Makefile target would be nice. :)
>
>
> Enter: / (search)
> then: * (Bang) [this was just an unlucky typo on my part]
>
> Traceback (most recent call last):
> File "/home/rdunlap/scripts/menuconfig.py", line 1447, in _jump_to_dialog
> for regex in s.split()]
> File "/home/rdunlap/scripts/menuconfig.py", line 1447, in <listcomp>
> for regex in s.split()]
> File "/usr/lib64/python3.4/re.py", line 223, in compile
> return _compile(pattern, flags)
> File "/usr/lib64/python3.4/re.py", line 294, in _compile
> p = sre_compile.compile(pattern, flags)
> File "/usr/lib64/python3.4/sre_compile.py", line 568, in compile
> p = sre_parse.parse(p, flags)
> File "/usr/lib64/python3.4/sre_parse.py", line 780, in parse
> p = _parse_sub(source, pattern, 0)
> File "/usr/lib64/python3.4/sre_parse.py", line 377, in _parse_sub
> itemsappend(_parse(source, state))
> File "/usr/lib64/python3.4/sre_parse.py", line 586, in _parse
> raise error("nothing to repeat")
> sre_constants.error: nothing to repeat
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/home/rdunlap/scripts/menuconfig.py", line 2389, in <module>
> menuconfig(Kconfig("Kconfig" if len(sys.argv) < 2 else sys.argv[1]))
> File "/home/rdunlap/scripts/menuconfig.py", line 340, in menuconfig
> print(curses.wrapper(_menuconfig))
> File "/usr/lib64/python3.4/curses/__init__.py", line 94, in wrapper
> return func(stdscr, *args, **kwds)
> File "/home/rdunlap/scripts/menuconfig.py", line 483, in _menuconfig
> _jump_to_dialog()
> File "/home/rdunlap/scripts/menuconfig.py", line 1466, in _jump_to_dialog
> bad_re = e.msg
> AttributeError: 'error' object has no attribute 'msg'
>
>
>
> --
> ~Randy

Thanks for the report!

Invalid regular expressions are detected, but it looks like the 'msg'
field of re.error was added in Python 3.5 (you have 3.4).

I'll check if the 'msg' field exists and fall back to just printing
"Invalid regular expression" otherwise. The 'msg' field just gives a
more informative error
("Bad regular expression: nothing to repeat" in this case).

Cheers,
Ulf