Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Honestly I have a solution, but honestly I could not give a medal for their work to the pip devs. Pip has a --no-clean flag. On the docs, it preserves the temporary directories for further ana...
#1: Initial revision
Honestly I have a solution, but honestly I could not give a medal for their work to the pip devs. 1. Pip has a `--no-clean` flag. On the docs, it preserves the temporary directories for further analyse. In the reality, it preserves only some of them, and the others will be still deleted. But that is a good first try - if you have luck, you can find what you want to. 2. Somewhere I have also read, pip actually has configuration files, whose pathes you can get with the command `pip config -v list`. It has a .ini syntax and there are multiple places where you can ask pip to not delete things. 3. And this is what I have done. I have *executed pip with hooking the deletion-related libc calls to a doing-nothing function.* On this way, pip could not delete anything, note it might cause problems in the compilation, but it is also a working method. The steps are: 3.1. Create a .c file with this, for example with the name `hook.c`: ``` int unlink(char* path) { return 0; } int unlinkat(int dirfd, char* pathname, int flags) { return 0; } int rmdir(char* path) { return 0; } ``` Then compile it to shared lib with the command `gcc -shared -o hook.so hook.c`. Now, if you execute any command by prefixing it with a `LD_PRELOAD=/path/to/hook.so pip ....`, then it won't be able to delete anything any more. But it will think, it could. All the file or directory related libc calls will return success - but actually without doing anything.