Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dependencies command, which dumps the list of dependencies #241

Merged
merged 2 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bork/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess
import sys

import pep517 # type:ignore
import toml

from . import builder
Expand Down Expand Up @@ -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.')
Expand Down
8 changes: 8 additions & 0 deletions bork/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Comment on lines +44 to +45
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, print(string, file='-') doesn't work — is accepting - a magical click thing? If so, that's pretty neat.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I r'd tfm and yup it's a magical click thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a click thing

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 '
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ python_requires = >=3.6
install_requires =
wheel==0.36.2
build==0.1.0
pep517==0.9.1
packaging==20.8
toml==0.10.2
twine==3.3.0
Expand Down