DEPRECATED -- Rewritten and moved to https://github.com/NiklasRosenstein/shut/. 🌊 Shore is a distribution and release management tool for pure Python packages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

# -*- coding: utf8 -*-
# Copyright (c) 2020 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
"""
This package implements the Shut CLI.
"""
from shut import __version__
from shut.model import Project
from nr.proxy import Proxy
import click
import logging
import os
context = Proxy(lambda: click.get_current_context().obj)
project = Proxy(lambda: click.get_current_context().obj['project'])
@click.group()
@click.option('-C', '--cwd', metavar='path', help='Run as if shut was started inside the specified directory.')
@click.option('-v', '--verbose', count=True, help='Increase the log verbosity.')
@click.option('-q', '--quiet', is_flag=True, help='Quiet mode, wins over --verbose.')
@click.version_option(__version__)
def shut(cwd, verbose, quiet):
"""
Shut is a tool to manage the lifecycle of pure Python packages. It automates tasks such
as bootstrapping a project, bumping version numbers, managing changelogs and publishing
packages to PyPI all the while performing sanity checks.
Shut makes strong assumptions on the project structure and assumes that the source-control
system of choice is Git.
"""
if cwd:
os.chdir(cwd)
ctx = click.get_current_context()
ctx.ensure_object(dict)
context['quiet'] = quiet
context['project'] = Project()
if quiet:
level = logging.CRITICAL
elif verbose >= 2:
level = logging.DEBUG
elif verbose >= 1:
level = logging.INFO
else:
level = logging.WARNING
logging.basicConfig(
format='[%(levelname)s|%(asctime)s|%(name)s]: %(message)s',
level=level,
)
from . import changelog
from . import classifiers
from . import license
from . import mono
from . import pkg