Commit 51bd2283 by Sébastien Eustace

Remove deprecated commands

parent f83b55a4
from .env_command import EnvCommand
class DevelopCommand(EnvCommand):
"""
Installs the current project in development mode. (<error>Deprecated</error>)
develop
"""
help = """\
The <info>develop</> command is deprecated. Please use <info>install</info> instead.
"""
def handle(self):
self.line("<warning>develop is deprecated use install instead.</warning>")
self.line("")
return self.call("install")
from .env_command import EnvCommand
class ScriptCommand(EnvCommand):
"""
Executes a script defined in <comment>pyproject.toml</comment>. (<error>Deprecated</error>)
script
{ script-name : The name of the script to execute }
{ args?* : The command and arguments/options to pass to the script. }
"""
help = """The <info>script</> command is deprecated. Please use <info>run</info> instead.
"""
def handle(self):
self.line("<warning>script is deprecated use run instead.</warning>")
self.line("")
script = self.argument("script-name")
argv = [script] + self.argument("args")
scripts = self.poetry.local_config.get("scripts")
if not scripts:
raise RuntimeError("No scripts defined in pyproject.toml")
if script not in scripts:
raise ValueError("Script {} is not defined".format(script))
module, callable_ = scripts[script].split(":")
src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src() else ""
cmd = ["python", "-c"]
cmd += [
'"import sys; '
"from importlib import import_module; "
"sys.argv = {!r}; {}"
"import_module('{}').{}()\"".format(
argv, src_in_sys_path, module, callable_
)
]
self.env.run(*cmd, shell=True, call=True)
@property
def _module(self):
from ...masonry.utils.module import Module
poetry = self.poetry
package = poetry.package
path = poetry.file.parent
module = Module(package.name, path.as_posix())
return module
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment