Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/projspec/artifact/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def make(self, *args, **kwargs):

def _make(self, *args, **kwargs):
logger.info("running %s", self.cmd)
run_subprocess(self.cmd, cwd=self.proj.url, output=False, **kwargs)
run_subprocess(self.cmd, cwd=self.proj.path, output=False, **kwargs)

def remake(self):
"""Recreate the artifact and any runtime it depends on"""
Expand Down
8 changes: 5 additions & 3 deletions src/projspec/artifact/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ def _make(self, *args, **kwargs) -> None:
:param args: added to the docker run command
:param kwargs: affect the docker run subprocess call
"""
out = run_subprocess(self.cmd, cwd=self.proj.url, **kwargs).stdout
out = run_subprocess(self.cmd, cwd=self.proj.path, **kwargs).stdout
if self.tag:
run_subprocess(["docker", "run", self.tag], cwd=self.proj.url, output=False)
run_subprocess(
["docker", "run", self.tag], cwd=self.proj.path, output=False
)
else:
lines = [
l for l in out.splitlines() if l.startswith(b"Successfully built ")
]
img = lines[-1].split()[-1]
run_subprocess(
["docker", "run", img.decode()] + list(args),
cwd=self.proj.url,
cwd=self.proj.path,
output=False,
**kwargs,
)
Expand Down
6 changes: 3 additions & 3 deletions src/projspec/artifact/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def __init__(
super().__init__(proj, cmd=cmd, **kwargs)

def _make(self, **kwargs):
run_subprocess(self.cmd, cwd=self.proj.url, output=False, **kwargs)
run_subprocess(self.cmd, cwd=self.proj.path, output=False, **kwargs)

def clean(self):
"""Tear down the deployment (e.g. ``helm uninstall <release>``)."""
if self.clean_cmd:
run_subprocess(self.clean_cmd, cwd=self.proj.url, output=False)
run_subprocess(self.clean_cmd, cwd=self.proj.path, output=False)

def _is_done(self) -> bool:
"""Return True when the release exists and is deployed."""
Expand Down Expand Up @@ -80,7 +80,7 @@ def _is_done(self) -> bool:
try:
run_subprocess(
["helm", "status", self.release],
cwd=self.proj.url,
cwd=self.proj.path,
output=False,
)
return True
Expand Down
8 changes: 4 additions & 4 deletions src/projspec/artifact/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ def __init__(self, proj: Project, file: str = "docker-compose.yml", **kwargs):
super().__init__(proj, cmd=cmd, **kwargs)

def _make(self, **kwargs):
run_subprocess(self.cmd, cwd=self.proj.url, output=False, **kwargs)
run_subprocess(self.cmd, cwd=self.proj.path, output=False, **kwargs)

def clean(self):
run_subprocess(
["docker", "compose", "-f", self.compose_file, "down"],
cwd=self.proj.url,
cwd=self.proj.path,
output=False,
)

def _is_done(self) -> bool:
try:
result = run_subprocess(
["docker", "compose", "-f", self.compose_file, "ps", "-q"],
cwd=self.proj.url,
cwd=self.proj.path,
)
return bool(result.stdout.strip())
except Exception:
Expand Down Expand Up @@ -66,7 +66,7 @@ class TerraformPlan(FileArtifact):
icon = "☁️"

def __init__(self, proj: Project, plan_file: str = "plan.tfplan", **kwargs):
fn = f"{proj.url}/{plan_file}"
fn = f"{proj.path}/{plan_file}"
cmd = ["terraform", "plan", "-out", plan_file]
super().__init__(proj, fn=fn, cmd=cmd, **kwargs)

Expand Down
6 changes: 3 additions & 3 deletions src/projspec/artifact/installable.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Wheel(FileArtifact):
icon = "⦿"

def __init__(self, proj, fn=None, **kw):
super().__init__(proj=proj, fn=fn or f"{proj.url}/dist/*.whl", **kw)
super().__init__(proj=proj, fn=fn or f"{proj.path}/dist/*.whl", **kw)

def _is_clean(self) -> bool:
files = self.proj.fs.glob(self.fn)
Expand Down Expand Up @@ -57,7 +57,7 @@ def _make(self, *args, **kwargs):
import re

logger.debug(" ".join(self.cmd))
out = run_subprocess(self.cmd, cwd=self.proj.url).stdout.decode("utf-8")
out = run_subprocess(self.cmd, cwd=self.proj.path).stdout.decode("utf-8")
if fn := re.match(r"'(.*?\.conda)'\n", out):
if os.path.exists(fn.group(1)):
self.fn = fn.group(1)
Expand Down Expand Up @@ -109,4 +109,4 @@ class SystemInstallablePackage(FileArtifact):
def __init__(self, proj, ext: str, fn=None, arch=None, **kw):
self.arch = arch or types[ext]
self.filetype = ext
super().__init__(proj=proj, fn=fn or f"{proj.url}/dist/*.{ext}", **kw)
super().__init__(proj=proj, fn=fn or f"{proj.path}/dist/*.{ext}", **kw)
2 changes: 1 addition & 1 deletion src/projspec/artifact/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _make(self, enqueue=True, **kwargs):
kwargs["output"] = False
proc = run_subprocess(
self.cmd,
cwd=self.proj.url,
cwd=self.proj.path,
popen=True,
**kwargs,
)
Expand Down
2 changes: 1 addition & 1 deletion src/projspec/proj/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def __init__(
:param xtypes: disallow specs whose names are in this set
:param excludes: directory names to ignore. If None, uses default_excludes.
"""
self.path = path
if fs is None:
fs, path = fsspec.url_to_fs(path, **(storage_options or {}))
else:
Expand All @@ -81,6 +80,7 @@ def __init__(
fs is not None
) # guaranteed by the if/else above; url_to_fs lacks return annotation
self.fs = fs
self.path = path
self.url = path # this is the FS-specific variant
self.specs = AttrDict()
self.children = AttrDict()
Expand Down
Loading