Skip to content

Commit

Permalink
adjust export command
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming committed May 13, 2021
1 parent 0743d1a commit 4e3f858
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pdm/cli/commands/export.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import argparse
from pathlib import Path
from typing import cast

from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import sections_group
from pdm.cli.utils import compatible_dev_flag, translate_sections
from pdm.formats import FORMATS
from pdm.models.repositories import LockedRepository
from pdm.project import Project


Expand Down Expand Up @@ -49,11 +51,14 @@ def handle(self, project: Project, options: argparse.Namespace) -> None:
compatible_dev_flag(project, options.dev),
options.sections or (),
)
for section in sections:
if options.pyproject:
if options.pyproject:
for section in sections:
candidates.update(project.get_dependencies(section))
else:
candidates.update(project.get_locked_candidates(section))
else:
locked_repository = cast(
LockedRepository, project.get_provider(for_install=True).repository
)
candidates.update(locked_repository.all_candidates)
candidates.pop(project.meta.name and project.meta.project_name, None)

content = FORMATS[options.format].export(project, candidates.values(), options)
Expand Down

0 comments on commit 4e3f858

Please sign in to comment.