According to the text just above https://docs.python.org/3/library/exceptions.html#EnvironmentError, `EnvironmentError` has been an alias of `OSError` since Python 3.3. Replacing it makes the code more consistent since `OSError` is used in other places in the code too.
When a linker process fails, `failed` will be set to a value other than `None`. When a second linker process fails, the `else` case will be taken because `failed is None`, which executes `compile_cmd.on_success()`. This function tries to rename or move the file generated by the linker but since the linker process failed, the file will most likely not exist. This will throw an error, which will prevent printing the actual error message from the linker.
Files are built in order by size anyway and mtime sort makes link order
mtime dependent which breaks reproducible builds on openSUSE as they
modify mtimes randomnly. See #1804
`file` and `arguments` are accessed using the square bracket syntax, while `output` is accessed using `.get()`. This commit uses square brackets for all three. This will throw a `KeyError` if `compilation_database` does not have the key, which is the correct behaviour IMO.
The macOS specific `package()` code changes the directory. This didn't cause any problems before 9135387cfa141e9ec27271bc41d5b6c43da90197 since `compile_commands.json` was written to the filesystem before `package()` was called. This is not the case anymore, which results in `compile_commands.json` being written into the `kitty.app` bundle. I fixed the problem by using a context manager to change the direcctory back after `kitty.app` was created.
Now there is only one launcher. Which means it can be used to start
kitty with profiling and ASAN in the natural way. The recommended
way to run kitty from source is now:
./kitty/launcher/kitty
The launcher also automatically re-execs to resolve symlinks on macOS.
I see a couple problems with using git to determine the files to delete:
- git needs to be installed
- The manual cleaning code is supposed to function correctly, so why not always use it? That way bugs in the manual cleaning code are also more likely to get discovered
- If some files ignored by git should not be deleted, they need to be added to a sort of blacklist. If some files should be deleted by the manual cleanup code, they need to be added to a sort of whitelist. If someone forgets to add files to one of these lists, then not deleting files that should be deleted is better than deleting files that should not be deleted.