Commit 1dd12f7d by Sébastien Eustace

Merge branch 'master' into develop

parents 1cabc09f 0667c67a
import sys import sys
from ...masonry.utils.module import Module
from .venv_command import VenvCommand from .venv_command import VenvCommand
...@@ -25,19 +26,32 @@ class ScriptCommand(VenvCommand): ...@@ -25,19 +26,32 @@ class ScriptCommand(VenvCommand):
module, callable_ = scripts[script].split(':') module, callable_ = scripts[script].split(':')
src_in_sys_path = 'sys.path.append(\'src\'); '\
if self._module.is_in_src() else ''
cmd = ['python', '-c'] cmd = ['python', '-c']
cmd += [ cmd += [
'"import sys; ' '"import sys; '
'from importlib import import_module; ' 'from importlib import import_module; '
'sys.argv = {!r}; ' 'sys.argv = {!r}; {}'
'import_module(\'{}\').{}()"'.format( 'import_module(\'{}\').{}()"'.format(
argv, module, callable_ argv, src_in_sys_path, module, callable_
) )
] ]
self.venv.run(*cmd, shell=True, call=True) 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): def merge_application_definition(self, merge_args=True):
if self._application is None \ if self._application is None \
or (self._application_definition_merged or (self._application_definition_merged
......
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