[mypyc] Introduce subcommand to mypyc command line interface - #9030
[mypyc] Introduce subcommand to mypyc command line interface#9030TH3CHARLie wants to merge 6 commits into
Conversation
JukkaL
left a comment
There was a problem hiding this comment.
Thanks for the PR! The new command line will be a big usability improvement. I left a bunch of ideas about how to improve this further.
| except OSError as e: | ||
| print('Error "{}" occurred when removing {}'.format(e.strerror, file)) | ||
| for directory in directories: | ||
| shutil.rmtree(directory) |
There was a problem hiding this comment.
Can you also delete the build directory, if it's empty now? Also, we should delete the shared libraries outside the build directory (but somehow only those what have been compiled with mypyc using this build directory).
| directories = [] | ||
| # TODO: this simply hardcodes what generates now | ||
| # a better solution is to use some configuration files | ||
| # maybe use a `.mypyc_cache` folder to store them |
There was a problem hiding this comment.
Brainstorming: maybe the build directory should be renamed to something with mypyc in the name, perhaps __mypyc__ or something, and then we can assume that everything in the directory are owned by us can be deleted.
There was a problem hiding this comment.
__mypyc__ would be a decent choice, but I am worried about the generated shared object files. Currently, we place them under cwd. To clean them, we probably need to search all *.so in cwd and delete them, which IMO is not a good approach.
There was a problem hiding this comment.
Deleting the .so files would make the command much more useful, I think.
We should be able to maintain the paths to all generated .so files in a file under build/__mypyc__ and delete only the files we have generated. If we are still worried that we may deleting the wrong files, we can also record the mtime and size of the files, and only delete files if the mtime and size match what we have recorded.
There was a problem hiding this comment.
This approach looks way better. Let's try go with __mypyc__ to place all the *.c, *.h, ops.txt, setup.py(or any other intermediate scripts) and __mypyc__/.mypyc_meta(the name can be tweak) to record such file information.
|
I've lost the branch for this both locally and on Github, so I am creating a new PR for this. |
related mypyc/mypyc#739