Skip to content

Commit

Permalink
Include Pimlico's license in list
Browse files Browse the repository at this point in the history
  • Loading branch information
markgw committed Oct 7, 2020
1 parent 61a79be commit 0db09d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/python/pimlico/cli/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
from pimlico.cli.subcommands import PimlicoCLISubcommand
from pimlico.core.config import get_dependencies
from pimlico.core.dependencies.base import install_dependencies
from pimlico.core.dependencies.licenses import NOT_RELEVANT
from pimlico.core.dependencies.licenses import NOT_RELEVANT, pimlico_license
from pimlico.utils.format import title_box


# This file is part of Pimlico
# Copyright (C) 2016 Mark Granroth-Wilding
# Licensed under the GNU GPL v3.0 - http://www.gnu.org/licenses/gpl-3.0.en.html


class InstallCmd(PimlicoCLISubcommand):
"""
Install missing dependencies.
Expand Down Expand Up @@ -113,13 +108,19 @@ def run_command(self, pipeline, opts):
if dep.license is not NOT_RELEVANT:
licenses.setdefault(dep.license, []).append(dep)

pim_core_done = False
for license, lic_deps in licenses.items():
if license is None:
print(title_box("License unknown"))
print("Check the software's homepage for a license\n")
else:
print(title_box(license.name))

if license is pimlico_license:
# We should also include Pimlico itself in the list
print("Pimlico core library")
pim_core_done = True

for dep in lic_deps:
# If there's no license, show a link to the homepage if possible
if license is None and dep.homepage_url is not None:
Expand All @@ -128,3 +129,9 @@ def run_command(self, pipeline, opts):
homepage = ""
print("{}{}".format(dep.name, homepage))
print()

if not pim_core_done:
print(title_box(pimlico_license.name))
print("Pimlico core library")
print()

5 changes: 4 additions & 1 deletion src/python/pimlico/core/dependencies/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ def __init__(self, name, description=None, url=None):
description="This is simply a placeholder to denote that it is not relevant to say what the license of "
"the software in question is. For example, it might be part of some other licensed software, "
"whose license is already covered elsewhere."
)
)

# Mark this license as the one we use for Pimlico itself, for easy reference
pimlico_license = GNU_LGPL_V2

0 comments on commit 0db09d2

Please sign in to comment.