-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix incorrect sys.argv[0] path when calling project scripts #6737
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
Merged
radoering
merged 24 commits into
python-poetry:master
from
wagnerluis1982:fix-incorrect-executable-path
Jan 23, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7273f41
fix: RunCommand calling scripts with incorrect executable path
chdsbd 9173580
Python 2 compatibility
chdsbd 6209264
Add basic test
chdsbd 399ed6d
doc
chdsbd 1a915a9
Rewrite test to run project script
wagnerluis1982 121e42f
simplify code
wagnerluis1982 85174c7
fix type on RunCommand.run_script
wagnerluis1982 ee4a2a7
fix test for windows platform
wagnerluis1982 fd4cee7
replace comments for a nice docstring
wagnerluis1982 c925e39
rename Env.{_bin => get_bin_path}
wagnerluis1982 7ae7d32
Merge remote-tracking branch 'origin/master' into fix-incorrect-execu…
wagnerluis1982 4c919b8
rename test method
wagnerluis1982 81232c0
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 c761cfe
improve test readability
wagnerluis1982 e0e01eb
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 c1d579f
rewrite test assertion
wagnerluis1982 74b725e
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 0846cd6
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 02c9919
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 e4de1a4
use script_dirs instead of bin_path, make test more realistic
radoering 2bdc670
add script extension ".cmd" when on windows
wagnerluis1982 713a1de
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 a758197
do not change args list
wagnerluis1982 bf6c3ca
Merge branch 'master' into fix-incorrect-executable-path
wagnerluis1982 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
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import sys | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
||
| def main() -> int: | ||
| path = Path(sys.argv[0]) | ||
| if sys.argv[1] == "absolute": | ||
| if not path.is_absolute(): | ||
| raise RuntimeError(f"sys.argv[0] is not an absolute path: {path}") | ||
| if not path.exists(): | ||
| raise RuntimeError(f"sys.argv[0] does not exist: {path}") | ||
| else: | ||
| if path.is_absolute(): | ||
| raise RuntimeError(f"sys.argv[0] is an absolute path: {path}") | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise sys.exit(main()) |
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.
Uh oh!
There was an error while loading. Please reload this page.