Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
161b19cb
Unverified
Commit
161b19cb
authored
Apr 05, 2023
by
Wagner Macedo
Committed by
GitHub
Apr 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
poetry run: deprecate uninstalled entry points (#7606)
parent
7585c375
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
src/poetry/console/commands/run.py
+14
-0
tests/console/commands/test_run.py
+14
-0
No files found.
src/poetry/console/commands/run.py
View file @
161b19cb
...
...
@@ -63,6 +63,9 @@ class RunCommand(EnvCommand):
if
script_path
.
exists
():
args
=
[
str
(
script_path
),
*
args
[
1
:]]
break
else
:
# If we reach this point, the script is not installed
self
.
_warning_not_installed_script
(
args
[
0
])
if
isinstance
(
script
,
dict
):
script
=
script
[
"callable"
]
...
...
@@ -81,3 +84,14 @@ class RunCommand(EnvCommand):
]
return
self
.
env
.
execute
(
*
cmd
)
def
_warning_not_installed_script
(
self
,
script
:
str
)
->
None
:
message
=
f
"""
\
Warning: '{script}' is an entry point defined in pyproject.toml, but it's not
\
installed as a script. You may get improper `sys.argv[0]`.
The support to run uninstalled scripts will be removed in a future release.
Run `poetry install` to resolve and get rid of this message.
"""
self
.
line_error
(
message
,
style
=
"warning"
)
tests/console/commands/test_run.py
View file @
161b19cb
...
...
@@ -180,3 +180,17 @@ def test_run_script_sys_argv0(
)
argv1
=
"absolute"
if
installed_script
else
"relative"
assert
tester
.
execute
(
f
"check-argv0 {argv1}"
)
==
0
if
installed_script
:
expected_message
=
""
else
:
expected_message
=
"""
\
Warning: 'check-argv0' is an entry point defined in pyproject.toml, but it's not
\
installed as a script. You may get improper `sys.argv[0]`.
The support to run uninstalled scripts will be removed in a future release.
Run `poetry install` to resolve and get rid of this message.
"""
assert
tester
.
io
.
fetch_error
()
==
expected_message
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment