[Buildroot] [PATCH 1/4] support/testing: add python-mako runtime test

Romain Naour romain.naour at smile.fr
Thu Jul 13 07:42:16 UTC 2023


Le 13/07/2023 à 09:36, Romain Naour a écrit :
> Hello Thomas, All,
> 
> Le 12/07/2023 à 21:46, Thomas Petazzoni via buildroot a écrit :
>> On Wed, 12 Jul 2023 21:43:57 +0200
>> Thomas Petazzoni <thomas.petazzoni at bootlin.com> wrote:
>>
>>> I might not have grasped the full scale of the issue, but my feeling is
>>> that:
>>>
>>> - python-mako needs markupsafe unconditionally, as demonstrated by your
>>>   test TestPythonPy3Mako. So python-mako should unconditionally select
>>>   BR2_PACKAGE_PYTHON_MARKUPSAFE
>>>
>>> - python-mako only needs pygments/babel as optional dependencies so
>>>   your patches 2/4 and 3/4 are fine
>>>
>>> - in order to fix bug #15628, we need to ensure that the piglit package
>>>   selects BR2_PACKAGE_PYTHON_MAKO_EXT_PYGMENTPLUGIN, so that
>>>   python-mako is installed with pygments support
>>>
>>> Does that make sense ?
>>
>> I got it wrong, your basic test shows that both pygments and markupsafe
>> are needed for a basic usage of python-mako:
>>
>> $ ./support/testing/run-tests -o ../outputs/ -k tests.package.test_python_mako.TestPythonPy3Mako
>> 21:32:04 TestPythonPy3Mako                        Starting
>> 21:32:04 TestPythonPy3Mako                        Building
>> 21:34:55 TestPythonPy3Mako                        Building done
>> 21:35:01 TestPythonPy3Mako                        Cleaning up
>> F
>> ======================================================================
>> FAIL: test_run (tests.package.test_python_mako.TestPythonPy3Mako)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "/home/thomas/buildroot/buildroot/support/testing/tests/package/test_python.py", line 137, in test_run
>>     self.run_sample_scripts()
>>   File "/home/thomas/buildroot/buildroot/support/testing/tests/package/test_python.py", line 132, in run_sample_scripts
>>     self.assertRunOk(cmd, timeout=self.timeout)
>>   File "/home/thomas/buildroot/buildroot/support/testing/infra/basetest.py", line 95, in assertRunOk
>>     self.assertEqual(
>> AssertionError: 1 != 0 : 
>> Failed to run: python sample_python_mako.py
>> output was:
>>   Traceback (most recent call last):
>>     File "/usr/lib/python3.11/site-packages/mako/exceptions.py", line 287, in _install_highlighting
>>     File "/usr/lib/python3.11/site-packages/mako/exceptions.py", line 271, in _install_pygments
>>     File "/usr/lib/python3.11/site-packages/mako/ext/pygmentplugin.py", line 7, in <module>
>>   ModuleNotFoundError: No module named 'pygments'

IIRC, I didn't have this error while testing with TestPythonPy3Mako with
Sebastian patch applied and ammanded to remove pygments dependency.

Best regards,
Romain


>>   
>>   During handling of the above exception, another exception occurred:
>>   
>>   Traceback (most recent call last):
>>     File "/root/sample_python_mako.py", line 1, in <module>
>>       from mako import runtime
>>     File "/usr/lib/python3.11/site-packages/mako/runtime.py", line 15, in <module>
>>     File "/usr/lib/python3.11/site-packages/mako/exceptions.py", line 292, in <module>
>>     File "/usr/lib/python3.11/site-packages/mako/exceptions.py", line 289, in _install_highlighting
>>     File "/usr/lib/python3.11/site-packages/mako/exceptions.py", line 277, in _install_fallback
>>     File "/usr/lib/python3.11/site-packages/mako/filters.py", line 14, in <module>
>>   ModuleNotFoundError: No module named 'markupsafe'
>>
>> ----------------------------------------------------------------------
>> Ran 1 test in 177.157s
>>
>> FAILED (failures=1)
>>
>> So to me it looks like the patch from Sebastian is correct, and
>> therefore your PATCH 2/4 adding an option to enable pygments support
>> does not make sense because pygments is needed unconditionally by
>> python-mako.
>>
>> Thoughts?
> 
> Actually the patch from Sebastian should be part of this series but without
> selecting pygments.
> 
> It's unclear for me if pygments and babel are really mandatory runtime
> dependencies of mako. Indeed, pygments and babel are used by "mako extension"
> and may not be used at all when using python-mako.
> 
> Do we really want to handle such "mako extension" ?
> 
> Otherwise, I'm fine to add them as runtime dependencies of mako.
> 
> Best regards,
> Romain
> 
>>
>> Thomas
> 




More information about the buildroot mailing list