Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed May 21, 2018
2 parents 1cabc09 + 0667c67 commit 1dd12f7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions poetry/console/commands/script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys

from ...masonry.utils.module import Module
from .venv_command import VenvCommand


Expand All @@ -25,19 +26,32 @@ def handle(self):

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}; '
'sys.argv = {!r}; {}'
'import_module(\'{}\').{}()"'.format(
argv, module, callable_
argv, src_in_sys_path, module, callable_
)
]

self.venv.run(*cmd, shell=True, call=True)

@property
def _module(self):
poetry = self.poetry
package = poetry.package
path = poetry.file.parent
module = Module(
package.name, path.as_posix()
)
return module

def merge_application_definition(self, merge_args=True):
if self._application is None \
or (self._application_definition_merged
Expand Down

0 comments on commit 1dd12f7

Please sign in to comment.