Skip to content

Commit

Permalink
simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Apr 9, 2022
1 parent 9e3e099 commit c90768c
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/poetry_plugin_export/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,9 @@ def _export_requirements_txt(self, cwd: Path, output: IO | str) -> None:
ops = solver.solve().calculate_operations()
packages = sorted((op.package for op in ops), key=lambda pkg: pkg.name)

# Get project dependencies.
if self._groups is not None:
root_package = self._poetry.package.with_dependency_groups(
list(self._groups), only=True
)
else:
root_package = self._poetry.package.without_optional_dependency_groups()

for dependency_package in self._poetry.locker.get_project_dependency_packages(
project_requires=root_package.all_requires,
project_python_marker=root_package.python_marker,
project_requires=root.all_requires,
project_python_marker=root.python_marker,
dev=True,
extras=self._extras,
):
Expand Down Expand Up @@ -162,11 +154,9 @@ def _export_requirements_txt(self, cwd: Path, output: IO | str) -> None:

hashes.append(f"{algorithm}:{h}")

if hashes:
line += " \\\n"
for i, h in enumerate(hashes):
suffix = " \\\n" if i < len(hashes) - 1 else ""
line += f" --hash={h}{suffix}"
for h in hashes:
line += f" \\\n --hash={h}"

dependency_lines.add(line)

content += "\n".join(sorted(dependency_lines))
Expand Down

0 comments on commit c90768c

Please sign in to comment.