This is an archive of the discontinued LLVM Phabricator instance.

[flang][lit] Introduce `%python_b` in LIT configuration
AbandonedPublic

Authored by awarzynski on Aug 13 2021, 2:23 AM.

Details

Summary

In order to prevent Python from generating the pycache directory, we
need to pass the -B flag [1]. To this end, a new LIT variable is
introduced, %python_b, that expands to python -B.

This is currently only required in Flang as it uses
flang/test/Semantics/common.py that's imported in tests that use
%python. In order to speed-up re-use, this Python module is
pre-compiled by-default and saved in flang/test/Semantics/__pycache__.

This was brought up in a post-commit review in [2]

[1] https://docs.python.org/3/using/cmdline.html#id1
[2] https://reviews.llvm.org/D107041

Diff Detail

Event Timeline

awarzynski created this revision.Aug 13 2021, 2:23 AM
awarzynski requested review of this revision.Aug 13 2021, 2:23 AM
Herald added a project: Restricted Project. · View Herald Transcript
awarzynski added a project: Restricted Project.

I am against this change. It slows down python script execution.

Creating .pyc files is expected behaviour and also happens when running LLVM's non-flang python scripts such as llvm-lit. *.pyc is already in the top-level .gitignore.