mirror of
https://github.com/clearml/clearml-agent
synced 2025-01-31 17:16:51 +00:00
Fix poetry support
This commit is contained in:
parent
f829d80a49
commit
98fe162878
@ -3,7 +3,7 @@ from functools import wraps
|
|||||||
import attr
|
import attr
|
||||||
import sys
|
import sys
|
||||||
from pathlib2 import Path
|
from pathlib2 import Path
|
||||||
from trains_agent.helper.process import Argv, DEVNULL
|
from trains_agent.helper.process import Argv, DEVNULL, check_if_command_exists
|
||||||
from trains_agent.session import Session, POETRY
|
from trains_agent.session import Session, POETRY
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +56,10 @@ class PoetryConfig:
|
|||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
func = kwargs.pop("func", Argv.get_output)
|
func = kwargs.pop("func", Argv.get_output)
|
||||||
kwargs.setdefault("stdin", DEVNULL)
|
kwargs.setdefault("stdin", DEVNULL)
|
||||||
argv = Argv(self._python, "-m", "poetry", *args)
|
if check_if_command_exists("poetry"):
|
||||||
|
argv = Argv("poetry", *args)
|
||||||
|
else:
|
||||||
|
argv = Argv(self._python, "-m", "poetry", *args)
|
||||||
self.log.debug("running: %s", argv)
|
self.log.debug("running: %s", argv)
|
||||||
return func(argv, **kwargs)
|
return func(argv, **kwargs)
|
||||||
|
|
||||||
@ -102,7 +105,10 @@ class PoetryAPI(object):
|
|||||||
return {"pip": [parts[0]+'=='+parts[1]+' # '+' '.join(parts[2:]) for parts in lines]}
|
return {"pip": [parts[0]+'=='+parts[1]+' # '+' '.join(parts[2:]) for parts in lines]}
|
||||||
|
|
||||||
def get_python_command(self, extra):
|
def get_python_command(self, extra):
|
||||||
return Argv("poetry", "run", "python", *extra)
|
if check_if_command_exists("poetry"):
|
||||||
|
return Argv("poetry", "run", "python", *extra)
|
||||||
|
else:
|
||||||
|
return Argv(self.config._python, "-m", "poetry", "run", "python", *extra)
|
||||||
|
|
||||||
def upgrade_pip(self, *args, **kwargs):
|
def upgrade_pip(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user