-
Notifications
You must be signed in to change notification settings - Fork 81
BUG: Deleting a file from an editable install #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import functools | ||
| import importlib.abc | ||
| import os | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
| import warnings | ||
|
|
@@ -63,6 +64,8 @@ def __init__( | |
| hook_name: str, | ||
| project_path: str, | ||
| build_path: str, | ||
| install_dir: str, | ||
| uninstall_old: bool, | ||
| import_paths: List[str], | ||
| top_level_modules: List[str], | ||
| rebuild_commands: List[List[str]], | ||
|
|
@@ -72,6 +75,8 @@ def __init__( | |
| self._hook_name = hook_name | ||
| self._project_path = project_path | ||
| self._build_path = build_path | ||
| self.install_dir = install_dir | ||
| self.uninstall_old = uninstall_old | ||
| self._import_paths = import_paths | ||
| self._top_level_modules = top_level_modules | ||
| self._rebuild_commands = rebuild_commands | ||
|
|
@@ -115,6 +120,9 @@ def _proc(self, command: List[str]) -> None: | |
| @functools.lru_cache(maxsize=1) | ||
| def rebuild(self) -> None: | ||
| self._debug(f'{{cyan}}{{bold}}+ rebuilding {self._project_path}{{reset}}') | ||
| if self.uninstall_old: | ||
| if os.path.exists(self.install_dir): | ||
| shutil.rmtree(self.install_dir) | ||
|
Comment on lines
+123
to
+125
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this approach. IMO saving the list of previous installed files and manually deleting the ones that are not installed by Meson anymore would be a better way to deal with this. |
||
| for command in self._rebuild_commands: | ||
| self._proc(command) | ||
| self._debug('{cyan}{bold}+ successfully rebuilt{reset}') | ||
|
|
@@ -148,6 +156,8 @@ def install( | |
| hook_name: str, | ||
| project_path: str, | ||
| build_path: str, | ||
| install_dir: str, | ||
| uninstall_old: bool, | ||
| import_paths: List[str], | ||
| top_level_modules: List[str], | ||
| rebuild_commands: List[List[str]], | ||
|
|
@@ -163,6 +173,8 @@ def install( | |
| hook_name, | ||
| project_path, | ||
| build_path, | ||
| install_dir, | ||
| uninstall_old, | ||
| import_paths, | ||
| top_level_modules, | ||
| rebuild_commands, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print('Deleted file exists') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this? It's quite important, at least verbose mode is completely unusable without it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't do anything anymore as of this PR.
This is because we nuke the install dir before hand ( to get rid of files that shouldn't exist anymore, since they were deleted), so the destination file will never exist.
For reference, see #87 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that we have to do this, but the only other way, I think, is to patch meson, and I don't think we should leave editable installs broken in the meantime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, making the verbose mode effectively unusable seems worse than not cleaning up some now-unused old file (the chance of actual breakage is quite small here). So I'm ambivalent about this change.
That said, I don't use editable installs and there's further improvements in the pipeline, so I'll just register as neutral on this one; fine if others want to merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, this old file is still importable if the directory had an init.py, which can be confusing at the very least, and maybe cause problems(I'm thinking maybe if someone did a star import?).