Loading CHANGELOG.md +1 −0 Changes for CHANGELOG.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ ### Added - Added support for virtualenv autogeneration (Python 3.6+ only). - Added the `run` command to execute commands inside the created virtualenvs. ### Fixed Loading poetry/console/application.py +40 −1 Changes for poetry/console/application.py: 40 added lines, 1 removed line. Original line number Diff line number Diff line import os from cleo import Application as BaseApplication from cleo.inputs import ArgvInput from cleo.outputs import ConsoleOutput from poetry.io.raw_argv_input import RawArgvInput from poetry.poetry import Poetry from poetry.utils.venv import Venv from .commands import AboutCommand from .commands import AddCommand Loading @@ -14,6 +16,7 @@ from .commands import LockCommand from .commands import NewCommand from .commands import PublishCommand from .commands import RemoveCommand from .commands import RunCommand from .commands import ShowCommand from .commands import UpdateCommand Loading @@ -24,6 +27,7 @@ class Application(BaseApplication): super().__init__('Poetry', Poetry.VERSION) self._poetry = None self._skip_io_configuration = False @property def poetry(self) -> Poetry: Loading @@ -37,6 +41,40 @@ class Application(BaseApplication): def reset_poetry(self) -> None: self._poetry = None def run(self, i=None, o=None) -> int: if i is None: i = ArgvInput() if o is None: o = ConsoleOutput() name = i.get_first_argument() if name == 'run': self._skip_io_configuration = True i = RawArgvInput() return super().run(i, o) def do_run(self, i, o): name = self.get_command_name(i) if name != 'run': return super().do_run(i, o) command = self.find(name) self._running_command = command status_code = command.run(i, o) self._running_command = None return status_code def configure_io(self, i, o): if self._skip_io_configuration: return super().configure_io(i, o) def get_default_commands(self) -> list: commands = super(Application, self).get_default_commands() Loading @@ -50,6 +88,7 @@ class Application(BaseApplication): NewCommand(), PublishCommand(), RemoveCommand(), RunCommand(), ShowCommand(), UpdateCommand(), ] poetry/console/commands/__init__.py +1 −0 Changes for poetry/console/commands/__init__.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,5 +7,6 @@ from .lock import LockCommand from .new import NewCommand from .publish import PublishCommand from .remove import RemoveCommand from .run import RunCommand from .show import ShowCommand from .update import UpdateCommand poetry/console/commands/run.py 0 → 100644 +32 −0 Changes for poetry/console/commands/run.py: 32 added lines, 0 removed lines. Original line number Diff line number Diff line from .venv_command import VenvCommand class RunCommand(VenvCommand): """ Runs a command in the appropriate environment. run { args* : The command and arguments/options to run. } """ def handle(self): args = self.argument('args') venv = self.venv return venv.exec(*args) def merge_application_definition(self, merge_args=True): if self._application is None \ or (self._application_definition_merged and (self._application_definition_merged_with_args or not merge_args)): return if merge_args: current_arguments = self._definition.get_arguments() self._definition.set_arguments(self._application.get_definition().get_arguments()) self._definition.add_arguments(current_arguments) self._application_definition_merged = True if merge_args: self._application_definition_merged_with_args = True poetry/io/raw_argv_input.py 0 → 100644 +16 −0 Changes for poetry/io/raw_argv_input.py: 16 added lines, 0 removed lines. Original line number Diff line number Diff line import sys from cleo.inputs import ArgvInput class RawArgvInput(ArgvInput): def parse(self): self._parsed = self._tokens while True: try: token = self._parsed.pop(0) except IndexError: break self.parse_argument(token) Loading
CHANGELOG.md +1 −0 Changes for CHANGELOG.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ ### Added - Added support for virtualenv autogeneration (Python 3.6+ only). - Added the `run` command to execute commands inside the created virtualenvs. ### Fixed Loading
poetry/console/application.py +40 −1 Changes for poetry/console/application.py: 40 added lines, 1 removed line. Original line number Diff line number Diff line import os from cleo import Application as BaseApplication from cleo.inputs import ArgvInput from cleo.outputs import ConsoleOutput from poetry.io.raw_argv_input import RawArgvInput from poetry.poetry import Poetry from poetry.utils.venv import Venv from .commands import AboutCommand from .commands import AddCommand Loading @@ -14,6 +16,7 @@ from .commands import LockCommand from .commands import NewCommand from .commands import PublishCommand from .commands import RemoveCommand from .commands import RunCommand from .commands import ShowCommand from .commands import UpdateCommand Loading @@ -24,6 +27,7 @@ class Application(BaseApplication): super().__init__('Poetry', Poetry.VERSION) self._poetry = None self._skip_io_configuration = False @property def poetry(self) -> Poetry: Loading @@ -37,6 +41,40 @@ class Application(BaseApplication): def reset_poetry(self) -> None: self._poetry = None def run(self, i=None, o=None) -> int: if i is None: i = ArgvInput() if o is None: o = ConsoleOutput() name = i.get_first_argument() if name == 'run': self._skip_io_configuration = True i = RawArgvInput() return super().run(i, o) def do_run(self, i, o): name = self.get_command_name(i) if name != 'run': return super().do_run(i, o) command = self.find(name) self._running_command = command status_code = command.run(i, o) self._running_command = None return status_code def configure_io(self, i, o): if self._skip_io_configuration: return super().configure_io(i, o) def get_default_commands(self) -> list: commands = super(Application, self).get_default_commands() Loading @@ -50,6 +88,7 @@ class Application(BaseApplication): NewCommand(), PublishCommand(), RemoveCommand(), RunCommand(), ShowCommand(), UpdateCommand(), ]
poetry/console/commands/__init__.py +1 −0 Changes for poetry/console/commands/__init__.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,5 +7,6 @@ from .lock import LockCommand from .new import NewCommand from .publish import PublishCommand from .remove import RemoveCommand from .run import RunCommand from .show import ShowCommand from .update import UpdateCommand
poetry/console/commands/run.py 0 → 100644 +32 −0 Changes for poetry/console/commands/run.py: 32 added lines, 0 removed lines. Original line number Diff line number Diff line from .venv_command import VenvCommand class RunCommand(VenvCommand): """ Runs a command in the appropriate environment. run { args* : The command and arguments/options to run. } """ def handle(self): args = self.argument('args') venv = self.venv return venv.exec(*args) def merge_application_definition(self, merge_args=True): if self._application is None \ or (self._application_definition_merged and (self._application_definition_merged_with_args or not merge_args)): return if merge_args: current_arguments = self._definition.get_arguments() self._definition.set_arguments(self._application.get_definition().get_arguments()) self._definition.add_arguments(current_arguments) self._application_definition_merged = True if merge_args: self._application_definition_merged_with_args = True
poetry/io/raw_argv_input.py 0 → 100644 +16 −0 Changes for poetry/io/raw_argv_input.py: 16 added lines, 0 removed lines. Original line number Diff line number Diff line import sys from cleo.inputs import ArgvInput class RawArgvInput(ArgvInput): def parse(self): self._parsed = self._tokens while True: try: token = self._parsed.pop(0) except IndexError: break self.parse_argument(token)