Skip to content

Commit c858fef

Browse files
Merge pull request #1109 from Backblaze/fix-license-prettytable-import
Avoid failing on missing extra dependencies in license command
2 parents 8925e69 + bbdbe2e commit c858fef

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

b2/_internal/console_tool.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4297,6 +4297,11 @@ def _run(self, args):
42974297
self._print(self.LICENSE_OUTPUT_FILE.read_text(encoding='utf8'))
42984298
return 0
42994299

4300+
if not (piplicenses and prettytable):
4301+
raise CommandError(
4302+
'In order to run this command, you need to install the `license` extra: pip install b2[license]'
4303+
)
4304+
43004305
if args.dump:
43014306
with self.LICENSE_OUTPUT_FILE.open('w', encoding='utf8') as file:
43024307
self._put_license_text(file, with_packages=args.with_packages)
@@ -4373,7 +4378,6 @@ def _put_license_text_for_packages(self, stream: io.StringIO):
43734378

43744379
@classmethod
43754380
def _get_licenses_dicts(cls) -> list[dict]:
4376-
assert piplicenses, 'In order to run this command, you need to install the `license` extra: pip install b2[license]'
43774381
pipdeptree_run = subprocess.run(
43784382
['pipdeptree', '--json', '-p', 'b2'],
43794383
capture_output=True,

changelog.d/1106.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid failing on missing extra dependencies in `b2 license` command.

0 commit comments

Comments
 (0)