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
a58a0e8f
Unverified
Commit
a58a0e8f
authored
Mar 04, 2023
by
Pablo Emídio S.S
Committed by
GitHub
Mar 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Misconfiguration in ask dependency interactive (#7569)
parent
3e32a4f8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
src/poetry/console/commands/init.py
+7
-2
src/poetry/utils/dependency_specification.py
+1
-1
tests/console/commands/test_init.py
+2
-6
No files found.
src/poetry/console/commands/init.py
View file @
a58a0e8f
...
...
@@ -292,6 +292,11 @@ You can specify a package in the following forms:
)
question
.
set_validator
(
self
.
_validate_package
)
follow_up_question
=
self
.
create_question
(
"
\n
Add a package (leave blank to skip):"
)
follow_up_question
.
set_validator
(
self
.
_validate_package
)
package
=
self
.
ask
(
question
)
while
package
:
constraint
=
self
.
_parse_requirements
([
package
])[
0
]
...
...
@@ -303,7 +308,7 @@ You can specify a package in the following forms:
):
self
.
line
(
f
"Adding <info>{package}</info>"
)
result
.
append
(
constraint
)
package
=
self
.
ask
(
"
\n
Add a package (leave blank to skip):"
)
package
=
self
.
ask
(
follow_up_question
)
continue
canonicalized_name
=
canonicalize_name
(
constraint
[
"name"
])
...
...
@@ -371,7 +376,7 @@ You can specify a package in the following forms:
result
.
append
(
constraint
)
if
self
.
io
.
is_interactive
():
package
=
self
.
ask
(
"
\n
Add a package (leave blank to skip):"
)
package
=
self
.
ask
(
follow_up_question
)
return
result
...
...
src/poetry/utils/dependency_specification.py
View file @
a58a0e8f
...
...
@@ -114,7 +114,7 @@ def _parse_dependency_specification_simple(
require
:
DependencySpec
=
{}
if
" "
in
pair
:
name
,
version
=
pair
.
split
(
" "
,
2
)
name
,
version
=
pair
.
split
(
" "
,
1
)
extras_m
=
re
.
search
(
r"\[([\w\d,-_]+)\]$"
,
name
)
if
extras_m
:
extras
=
[
e
.
strip
()
for
e
in
extras_m
.
group
(
1
)
.
split
(
","
)]
...
...
tests/console/commands/test_init.py
View file @
a58a0e8f
...
...
@@ -595,9 +595,6 @@ pytest = "^3.6.0"
def
test_interactive_with_wrong_dependency_inputs
(
tester
:
CommandTester
,
repo
:
TestRepository
):
repo
.
add_package
(
get_package
(
"pendulum"
,
"2.0.0"
))
repo
.
add_package
(
get_package
(
"pytest"
,
"3.6.0"
))
inputs
=
[
"my-package"
,
# Package name
"1.2.3"
,
# Version
...
...
@@ -606,10 +603,8 @@ def test_interactive_with_wrong_dependency_inputs(
"MIT"
,
# License
"^3.8"
,
# Python
""
,
# Interactive packages
"foo 1.19.2"
,
"pendulum 2.0.0 foo"
,
# Package name and constraint (invalid)
"pendulum 2.0.0"
,
# Package name and constraint (invalid)
"pendulum 2.0.0"
,
# Package name and constraint (invalid)
"pendulum 2.0.0"
,
# Package name and constraint (invalid)
"pendulum@^2.0.0"
,
# Package name and constraint (valid)
""
,
# End package selection
""
,
# Interactive dev packages
...
...
@@ -633,6 +628,7 @@ packages = [{include = "my_package"}]
[tool.poetry.dependencies]
python = "^3.8"
foo = "1.19.2"
pendulum = "^2.0.0"
[tool.poetry.group.dev.dependencies]
...
...
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