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
|
import re
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -67,6 +68,15 @@ class Project:
|
||||||
def get_extra_path(self):
|
def get_extra_path(self):
|
||||||
return [self.root.joinpath("node_modules/.bin"), self.root.joinpath("env/bin")]
|
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
|
@dataclass
|
||||||
class Process:
|
class Process:
|
||||||
|
|
|
@ -68,15 +68,7 @@ async def run_process_command(project: Project, process: Process):
|
||||||
*command,
|
*command,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
env={
|
env={**os.environ, **project.get_environment(), "CATFISH_IDENT": process.ident},
|
||||||
**os.environ,
|
|
||||||
**project.env,
|
|
||||||
"PYTHONUNBUFFERED": "1",
|
|
||||||
"CATFISH_IDENT": process.ident,
|
|
||||||
"PATH": "{}:{}".format(
|
|
||||||
":".join(map(str, project.get_extra_path())), os.environ["PATH"]
|
|
||||||
),
|
|
||||||
},
|
|
||||||
cwd=project.root
|
cwd=project.root
|
||||||
)
|
)
|
||||||
asyncio.ensure_future(publish_stdout_for(proc, process))
|
asyncio.ensure_future(publish_stdout_for(proc, process))
|
||||||
|
|
Reference in a new issue