login page
This commit is contained in:
49
Lib/site-packages/pipenv/vendor/passa/cli/__init__.py
vendored
Normal file
49
Lib/site-packages/pipenv/vendor/passa/cli/__init__.py
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import argparse
|
||||
import importlib
|
||||
import pkgutil
|
||||
import sys
|
||||
|
||||
from passa import __version__
|
||||
|
||||
|
||||
CURRENT_MODULE_PATH = sys.modules[__name__].__path__
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
root_parser = argparse.ArgumentParser(
|
||||
prog="passa",
|
||||
description="Pipfile project management tool.",
|
||||
)
|
||||
root_parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version="%(prog)s, version {}".format(__version__),
|
||||
help="show the version and exit",
|
||||
)
|
||||
|
||||
subparsers = root_parser.add_subparsers()
|
||||
for _, name, _ in pkgutil.iter_modules(CURRENT_MODULE_PATH, "."):
|
||||
module = importlib.import_module(name, __name__)
|
||||
try:
|
||||
klass = module.Command
|
||||
except AttributeError:
|
||||
continue
|
||||
parser = subparsers.add_parser(klass.name, help=klass.description)
|
||||
command = klass(parser)
|
||||
parser.set_defaults(func=command.run)
|
||||
|
||||
options = root_parser.parse_args(argv)
|
||||
|
||||
try:
|
||||
f = options.func
|
||||
except AttributeError:
|
||||
root_parser.print_help()
|
||||
result = -1
|
||||
else:
|
||||
result = f(options)
|
||||
if result is not None:
|
||||
sys.exit(result)
|
||||
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/__init__.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/__init__.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/_base.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/_base.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/add.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/add.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/clean.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/clean.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/freeze.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/freeze.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/init.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/init.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/install.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/install.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/lock.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/lock.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/options.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/options.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/remove.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/remove.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/sync.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/sync.cpython-38.pyc
vendored
Normal file
Binary file not shown.
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/upgrade.cpython-38.pyc
vendored
Normal file
BIN
Lib/site-packages/pipenv/vendor/passa/cli/__pycache__/upgrade.cpython-38.pyc
vendored
Normal file
Binary file not shown.
61
Lib/site-packages/pipenv/vendor/passa/cli/_base.py
vendored
Normal file
61
Lib/site-packages/pipenv/vendor/passa/cli/_base.py
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .options import project
|
||||
|
||||
|
||||
class BaseCommand(object):
|
||||
"""A CLI command.
|
||||
"""
|
||||
name = None
|
||||
description = None
|
||||
default_arguments = [project]
|
||||
arguments = []
|
||||
|
||||
def __init__(self, parser=None):
|
||||
if not parser:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=os.path.basename(sys.argv[0]),
|
||||
description="Base argument parser for passa"
|
||||
)
|
||||
self.parser = parser
|
||||
self.add_arguments()
|
||||
|
||||
@classmethod
|
||||
def build_parser(cls):
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="passa {}".format(cls.name),
|
||||
description=cls.description,
|
||||
)
|
||||
return cls(parser)
|
||||
|
||||
@classmethod
|
||||
def run_parser(cls):
|
||||
parser = cls.build_parser()
|
||||
parser()
|
||||
|
||||
def __call__(self, argv=None):
|
||||
options = self.parser.parse_args(argv)
|
||||
result = self.main(options)
|
||||
if result is not None:
|
||||
sys.exit(result)
|
||||
|
||||
def add_default_arguments(self):
|
||||
for arg in self.default_arguments:
|
||||
arg.add_to_parser(self.parser)
|
||||
|
||||
def add_arguments(self):
|
||||
self.add_default_arguments()
|
||||
for arg in self.arguments:
|
||||
arg.add_to_parser(self.parser)
|
||||
|
||||
def main(self, options):
|
||||
return self.run(options)
|
||||
|
||||
def run(self, options):
|
||||
raise NotImplementedError
|
||||
29
Lib/site-packages/pipenv/vendor/passa/cli/add.py
vendored
Normal file
29
Lib/site-packages/pipenv/vendor/passa/cli/add.py
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.add import add_packages
|
||||
from ._base import BaseCommand
|
||||
from .options import package_group
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "add"
|
||||
description = "Add packages to project."
|
||||
arguments = [package_group]
|
||||
|
||||
def run(self, options):
|
||||
if not options.editables and not options.packages:
|
||||
self.parser.error("Must supply either a requirement or --editable")
|
||||
return add_packages(
|
||||
packages=options.packages,
|
||||
editables=options.editables,
|
||||
project=options.project,
|
||||
dev=options.dev,
|
||||
sync=options.sync
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
21
Lib/site-packages/pipenv/vendor/passa/cli/clean.py
vendored
Normal file
21
Lib/site-packages/pipenv/vendor/passa/cli/clean.py
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.clean import clean
|
||||
from ._base import BaseCommand
|
||||
from .options import dev, no_default
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "clean"
|
||||
description = "Uninstall unlisted packages from the environment."
|
||||
arguments = [dev, no_default]
|
||||
|
||||
def run(self, options):
|
||||
return clean(project=options.project, default=options.default, dev=options.dev)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
24
Lib/site-packages/pipenv/vendor/passa/cli/freeze.py
vendored
Normal file
24
Lib/site-packages/pipenv/vendor/passa/cli/freeze.py
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.freeze import freeze
|
||||
from ._base import BaseCommand
|
||||
from .options import dev, include_hashes_group, no_default, target
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "freeze"
|
||||
description = "Export project depenencies to requirements.txt."
|
||||
arguments = [dev, no_default, target, include_hashes_group]
|
||||
|
||||
def run(self, options):
|
||||
return freeze(
|
||||
project=options.project, default=options.default, dev=options.dev,
|
||||
include_hashes=options.include_hashes
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
32
Lib/site-packages/pipenv/vendor/passa/cli/init.py
vendored
Normal file
32
Lib/site-packages/pipenv/vendor/passa/cli/init.py
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from ..actions.init import init_project
|
||||
from ._base import BaseCommand
|
||||
from .options import new_project_group
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "init"
|
||||
description = "Create a new project."
|
||||
default_arguments = []
|
||||
arguments = [new_project_group]
|
||||
|
||||
def run(self, options):
|
||||
pipfile_path = os.path.join(options.project, "Pipfile")
|
||||
if os.path.exists(pipfile_path):
|
||||
raise argparse.ArgumentError(
|
||||
"{0!r} is already a Pipfile project".format(options.project),
|
||||
)
|
||||
return init_project(
|
||||
root=options.project, python_version=options.python_version
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
22
Lib/site-packages/pipenv/vendor/passa/cli/install.py
vendored
Normal file
22
Lib/site-packages/pipenv/vendor/passa/cli/install.py
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.install import install
|
||||
from ._base import BaseCommand
|
||||
from .options import dev, no_check, no_clean
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "install"
|
||||
description = "Generate Pipfile.lock to synchronize the environment."
|
||||
arguments = [no_check, dev, no_clean]
|
||||
|
||||
def run(self, options):
|
||||
return install(project=options.project, check=options.check, dev=options.dev,
|
||||
clean=options.clean)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
18
Lib/site-packages/pipenv/vendor/passa/cli/lock.py
vendored
Normal file
18
Lib/site-packages/pipenv/vendor/passa/cli/lock.py
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.lock import lock
|
||||
from ._base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
name = "lock"
|
||||
description = "Generate Pipfile.lock."
|
||||
|
||||
def run(self, options):
|
||||
return lock(project=options.project)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
156
Lib/site-packages/pipenv/vendor/passa/cli/options.py
vendored
Normal file
156
Lib/site-packages/pipenv/vendor/passa/cli/options.py
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
import tomlkit.exceptions
|
||||
|
||||
import passa.models.projects
|
||||
import vistir
|
||||
|
||||
|
||||
PYTHON_VERSION = ".".join(str(v) for v in sys.version_info[:2])
|
||||
|
||||
|
||||
class Project(passa.models.projects.Project):
|
||||
def __init__(self, root, *args, **kwargs):
|
||||
root = vistir.compat.Path(root).absolute()
|
||||
pipfile = root.joinpath("Pipfile")
|
||||
if not pipfile.is_file():
|
||||
raise argparse.ArgumentError(
|
||||
"project", "{0!r} is not a Pipfile project".format(root),
|
||||
)
|
||||
try:
|
||||
super(Project, self).__init__(root.as_posix(), *args, **kwargs)
|
||||
except tomlkit.exceptions.ParseError as e:
|
||||
raise argparse.ArgumentError(
|
||||
"project", "failed to parse Pipfile: {0!r}".format(str(e)),
|
||||
)
|
||||
|
||||
def __name__(self):
|
||||
return "Project Root"
|
||||
|
||||
|
||||
class Option(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def add_to_parser(self, parser):
|
||||
parser.add_argument(*self.args, **self.kwargs)
|
||||
|
||||
def add_to_group(self, group):
|
||||
group.add_argument(*self.args, **self.kwargs)
|
||||
|
||||
|
||||
class ArgumentGroup(object):
|
||||
def __init__(
|
||||
self, name, parser=None,
|
||||
is_mutually_exclusive=False,
|
||||
required=None, options=None):
|
||||
self.name = name
|
||||
self.options = options or []
|
||||
self.parser = parser
|
||||
self.required = required
|
||||
self.is_mutually_exclusive = is_mutually_exclusive
|
||||
self.argument_group = None
|
||||
|
||||
def add_to_parser(self, parser):
|
||||
group = None
|
||||
if self.is_mutually_exclusive:
|
||||
group = parser.add_mutually_exclusive_group(required=self.required)
|
||||
else:
|
||||
group = parser.add_argument_group()
|
||||
for option in self.options:
|
||||
option.add_to_group(group)
|
||||
self.argument_group = group
|
||||
self.parser = parser
|
||||
|
||||
|
||||
project = Option(
|
||||
"--project", metavar="project", default=os.getcwd(), type=Project,
|
||||
help="path to project root (directory containing Pipfile)",
|
||||
)
|
||||
|
||||
new_project = Option(
|
||||
"--project", metavar="project", default=os.getcwd(), type=str,
|
||||
help="path to project root (directory containing Pipfile)",
|
||||
)
|
||||
|
||||
python_version = Option(
|
||||
"--py-version", "--python-version", "--requires-python", metavar="python-version",
|
||||
dest="python_version", default=PYTHON_VERSION, type=str,
|
||||
help="required minor python version for the project"
|
||||
)
|
||||
|
||||
packages = Option(
|
||||
"packages", metavar="package", nargs="*",
|
||||
help="requirement to add (can be used multiple times)",
|
||||
)
|
||||
|
||||
editable = Option(
|
||||
'-e', '--editable', dest='editables', nargs="*", default=[], metavar='path/vcs',
|
||||
help="editable requirement to add (can be used multiple times)",
|
||||
)
|
||||
|
||||
dev = Option(
|
||||
"--dev", action="store_true", default=False,
|
||||
help="Use [dev-packages] for install/freeze/uninstall operations",
|
||||
)
|
||||
|
||||
no_sync = Option(
|
||||
"--no-sync", dest="sync", action="store_false", default=True,
|
||||
help="do not synchronize the environment",
|
||||
)
|
||||
|
||||
target = Option(
|
||||
"-t", "--target", default=None,
|
||||
help="file to export into (default is to print to stdout)"
|
||||
)
|
||||
|
||||
no_default = Option(
|
||||
"--no-default", dest="default", action="store_false", default=True,
|
||||
help="do not include default packages when exporting, importing, or cleaning"
|
||||
)
|
||||
|
||||
include_hashes = Option(
|
||||
"--include-hashes", dest="include_hashes", action="store_true",
|
||||
help="output hashes in requirements.txt (default is to guess)",
|
||||
)
|
||||
|
||||
no_include_hashes = Option(
|
||||
"--no-include-hashes", dest="include_hashes", action="store_false",
|
||||
help="do not output hashes in requirements.txt (default is to guess)",
|
||||
)
|
||||
|
||||
no_check = Option(
|
||||
"--no-check", dest="check", action="store_false", default=True,
|
||||
help="do not check if Pipfile.lock is up to date, always resolve",
|
||||
)
|
||||
|
||||
no_clean = Option(
|
||||
"--no-clean", dest="clean", action="store_false", default=True,
|
||||
help="do not remove packages not specified in Pipfile.lock",
|
||||
)
|
||||
|
||||
dev_only = Option(
|
||||
"--dev", dest="only", action="store_const", const="dev",
|
||||
help="only try to modify [dev-packages]",
|
||||
)
|
||||
|
||||
default_only = Option(
|
||||
"--default", dest="only", action="store_const", const="default",
|
||||
help="only try to modify [default]",
|
||||
)
|
||||
|
||||
strategy = Option(
|
||||
"--strategy", choices=["eager", "only-if-needed"], default="only-if-needed",
|
||||
help="how dependency upgrading is handled",
|
||||
)
|
||||
|
||||
include_hashes_group = ArgumentGroup("include_hashes", is_mutually_exclusive=True, options=[include_hashes, no_include_hashes])
|
||||
dev_group = ArgumentGroup("dev", is_mutually_exclusive="True", options=[dev_only, default_only])
|
||||
package_group = ArgumentGroup("packages", options=[packages, editable, dev, no_sync])
|
||||
new_project_group = ArgumentGroup("new-project", options=[new_project, python_version])
|
||||
22
Lib/site-packages/pipenv/vendor/passa/cli/remove.py
vendored
Normal file
22
Lib/site-packages/pipenv/vendor/passa/cli/remove.py
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.remove import remove
|
||||
from ._base import BaseCommand
|
||||
from .options import dev_group, no_clean, packages
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "remove"
|
||||
description = "Remove packages from project."
|
||||
arguments = [dev_group, no_clean, packages]
|
||||
|
||||
def run(self, options):
|
||||
return remove(project=options.project, only=options.only,
|
||||
packages=options.packages, clean=options.clean)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
21
Lib/site-packages/pipenv/vendor/passa/cli/sync.py
vendored
Normal file
21
Lib/site-packages/pipenv/vendor/passa/cli/sync.py
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.sync import sync
|
||||
from ._base import BaseCommand
|
||||
from .options import dev, no_clean
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "sync"
|
||||
description = "Install Pipfile.lock into the environment."
|
||||
arguments = [dev, no_clean]
|
||||
|
||||
def run(self, options):
|
||||
return sync(project=options.project, dev=options.dev, clean=options.clean)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
21
Lib/site-packages/pipenv/vendor/passa/cli/upgrade.py
vendored
Normal file
21
Lib/site-packages/pipenv/vendor/passa/cli/upgrade.py
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from ..actions.upgrade import upgrade
|
||||
from ._base import BaseCommand
|
||||
from .options import no_clean, no_sync, packages, strategy
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
name = "upgrade"
|
||||
description = "Upgrade packages in project."
|
||||
arguments = [packages, strategy, no_clean, no_sync]
|
||||
|
||||
def run(self, options):
|
||||
return upgrade(project=options.project, strategy=options.strategy,
|
||||
sync=options.sync, packages=options.packages)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Command.run_parser()
|
||||
Reference in New Issue
Block a user