Source code for dob.copyright

# This file exists within 'dob':
#
#   https://github.com/hotoffthehamster/dob
#
# Copyright © 2018-2020 Landon Bouma,  2015-2016 Eric Goller.  All rights reserved.
#
# 'dob' is free software: you can redistribute it and/or modify it under the terms
# of the GNU General Public License  as  published by the Free Software Foundation,
# either version 3  of the License,  or  (at your option)  any   later    version.
#
# 'dob' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY  or  FITNESS FOR A PARTICULAR
# PURPOSE.  See  the  GNU General Public License  for  more details.
#
# You can find the GNU General Public License reprinted in the file titled 'LICENSE',
# or visit <http://www.gnu.org/licenses/>.

"""Copyright output UX methods."""

import os
from datetime import datetime

from gettext import gettext as _

from dob_bright.termio import click_echo

from . import (
    get_version,
    __arg0name__,
    __author_name__,
    __author_link__,
    __package_name__
)

__all__ = (
    'assemble_copyright',
    'echo_copyright',
    'echo_license',
)








[docs]def echo_license(): license = """ {app_name} is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. {app_name} is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """.strip() license_txt = license.format(app_name=__package_name__) # MAYBE: (lb): Prefer the LICENSE file? # FIXME: LICENSE is probably not copied via pip-install. # This will be good learning on installing non-package files. license_path = os.path.join( os.path.dirname(__file__), '..', 'LICENSE', ) if os.path.exists(license_path): with open(license_path, 'rb') as f: license_txt = f.read().decode('utf-8').strip() click_echo(license_txt)