The `python` command may not exist on a system with Python 3 installed.
See https://peps.python.org/pep-0394/ for a discussion of the commands
expected to be installed.
Since Python2 was officially sunsetted almost three years ago
(https://www.python.org/doc/sunset-python-2/), IWYU should prefer
compatibility with newer systems over older ones.
Python code in scripts is still Python3/Python2-compatible, but we will no
longer make an effort to preserve Python2 support over time.
Fixes#1096.
If a compiler wrapper like ccache is used in the compile command
database, then iwyu_tool will only replace the wrapper with
IWYU_EXECUTABLE, while keeping the compiler executable in the
compile_args list. This leads to "error: no such file or directory
'c++'" warnings.
Fixes#789.
FreeBSD has /home linked to /usr/home, so the realpath call in
fixup_compilation_db actually resolved the bogus path to
/usr/home/foobar/Test.cpp and failed the test.
Generate an artifical root dir with uuidgen to reduce/eliminate the risk
of this happening elsewhere.
If the entry looks like this:
{
"arguments": [
....
],
"directory": "/path/to/test",
"file": "Test.cpp"
},
And we invoked iwyu_tool.py in /path/to, then the constructed abs path was
/path/to/Test.cpp, not /path/to/test/Test.cpp, fix this.
This is a breaking change.
Originally, the extra arguments after '--' were only intended for IWYU
args, and so '-Xiwyu' was automatically prepended to each of them to
make life easier on users.
But this made it impossible to add additional Clang args, which is also
a useful feature.
The extra arguments are now forwarded as-written to main and users need
to manually add '-Xiwyu' before every IWYU argument.
shlex.split does not do the right thing on Windows, not even with the
posix=False flag set.
Work around this with a hand-built win_split function, based on the
more or less official specification:
https://docs.microsoft.com/en-us/previous-versions/17w5ykft(v=vs.140)
Add tests.
No behavior change for non-Windows systems.
Fixes#583.
Match cl.exe without case on Windows to allow for e.g. CL.EXE.
Also match 'clang-cl', which could presumably be used as a cross-tool on
non-Windows systems.
Add tests.
User-provided paths are now matched case-insensitively.
Also fix a bug where /a/b/partial would match partial filenames. The new
implementation is stricter and only matches proper directory prefixes or
the full path name.
Closes bug #582.
- Two blank lines between module-level entities.
- Imports after doc comment
- Naming in execute
- Collapse IWYUToolTestBase into IWYUToolTests
No functional change.
Python's multiprocessing module is convenient for task parallelization,
but it is rather weak when it comes to error reporting and handling
KeyboardInterrupt. It was basically impossible to interrupt iwyu_tool
with Ctrl+C.
Also, it seems silly to launch a process just to launch a process --
iwyu_tool.py basically just manages include-what-you-use child
processes.
Remove the use of multiprocessing and handle process scheduling
ourselves.
- Add execute function to run all invocations (asynchronously)
- Move process invocation to Invocation.run
- Make Invocation.from_compile_command a class method to make it easier
to stub Invocation.run when under test.
With this in place, add basic test cases for compile command parsing and
execution.