diff --git a/bork/api.py b/bork/api.py index 2a28da1..914daaf 100644 --- a/bork/api.py +++ b/bork/api.py @@ -4,6 +4,7 @@ import subprocess import sys +import pep517 # type:ignore import toml from . import builder @@ -40,6 +41,11 @@ def clean(): try_delete(name) +def dependencies(): + """Get the list of dependencies.""" + return pep517.meta.load('.').metadata.get_all('Requires-Dist') + + def download(package, release_tag, file_pattern, directory): if file_pattern is None or len(file_pattern) == 0: raise ValueError('file_pattern must be non-empty.') diff --git a/bork/cli.py b/bork/cli.py index 3b18313..c6c6698 100644 --- a/bork/cli.py +++ b/bork/cli.py @@ -40,6 +40,14 @@ def clean(): api.clean() +@cli.command() +@click.option('-o', '--output', type=click.File('w'), default='-', + help='File in which to save the list of dependencies.') +def dependencies(output): + for dep in api.dependencies(): + print(dep, file=output) + + @cli.command() @click.option('--files', default='*.pyz', help='Comma-separated list of filenames to download. Supports '