Move environment definition onto Project
This commit is contained in:
parent
ae5b3eeefb
commit
f6c8d5b19d
2 changed files with 11 additions and 9 deletions
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
@ -67,6 +68,15 @@ class Project:
|
|||
def get_extra_path(self):
|
||||
return [self.root.joinpath("node_modules/.bin"), self.root.joinpath("env/bin")]
|
||||
|
||||
def get_environment(self):
|
||||
return {
|
||||
**self.env,
|
||||
"PYTHONUNBUFFERED": "1",
|
||||
"PATH": "{}:{}".format(
|
||||
":".join(map(str, self.get_extra_path())), os.environ["PATH"]
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class Process:
|
||||
|
|
|
@ -68,15 +68,7 @@ async def run_process_command(project: Project, process: Process):
|
|||
*command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
env={
|
||||
**os.environ,
|
||||
**project.env,
|
||||
"PYTHONUNBUFFERED": "1",
|
||||
"CATFISH_IDENT": process.ident,
|
||||
"PATH": "{}:{}".format(
|
||||
":".join(map(str, project.get_extra_path())), os.environ["PATH"]
|
||||
),
|
||||
},
|
||||
env={**os.environ, **project.get_environment(), "CATFISH_IDENT": process.ident},
|
||||
cwd=project.root
|
||||
)
|
||||
asyncio.ensure_future(publish_stdout_for(proc, process))
|
||||
|
|
Reference in a new issue