I'm writing a Python script which performs creates and modifies several files in a directory specified by the user. As part of the process, my script will download and build a toolchain used by my script. A few of the tools will need to be built and added to the PATH environment variable so my script as well as the entire toolchain itself can execute them. Once my script is complete, the toolchain will not be needed and should be discarded.
I considered creating a temporary directory for the toolchain either in the working directory or at the user's home folder and deleting it when my script completes. Unfortunately, the user may want to rerun my script which would incur the expense of downloading and rebuilding the toolchain again. I could instruct the user to delete them when they're sure they're done with my script, but I prefer a more elegant solution.
What the best practice for such a scenario in UNIX? I figure there must be a standard location UNIX uses for temporary files where they are periodically purged. It would be great if it worked across the different flavors of UNIX few, if any, modifications.