Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Sep 11, 2023
1 parent 239ec4a commit 087dc3c
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,6 @@ def handle(self) -> int:
if self.option("no-root"):
return 0

# Prior to https://github.com/python-poetry/poetry-core/pull/629
# the existence of a module/package was checked when creating the
# EditableBuilder. Afterwards, the existence is checked after
# executing the build script (if there is one),
# i.e. during EditableBuilder.build().
try:
builder = EditableBuilder(self.poetry, self.env, self.io)
except (ModuleOrPackageNotFound, FileNotFoundError) as e:
# This is likely due to the fact that the project is an application
# not following the structure expected by Poetry
# If this is a true error it will be picked up later by build anyway.
self.line_error(
f"The current project could not be installed: <error>{e}</error>\n"
"If you do not want to install the current project"
" use <c1>--no-root</c1>",
style="warning",
)
return 0

log_install = (
"<b>Installing</> the current project:"
f" <c1>{self.poetry.package.pretty_name}</c1>"
Expand All @@ -189,7 +170,13 @@ def handle(self) -> int:
self.line("")
return 0

# Prior to https://github.com/python-poetry/poetry-core/pull/629
# the existence of a module/package was checked when creating the
# EditableBuilder. Afterwards, the existence is checked after
# executing the build script (if there is one),
# i.e. during EditableBuilder.build().
try:
builder = EditableBuilder(self.poetry, self.env, self.io)
builder.build()
except (ModuleOrPackageNotFound, FileNotFoundError) as e:
# This is likely due to the fact that the project is an application
Expand Down

0 comments on commit 087dc3c

Please sign in to comment.