mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 18:50:43 -06:00
chore: seperate share/default source logic
This commit is contained in:
parent
0b26c8cb48
commit
ca67431a79
1 changed files with 7 additions and 6 deletions
|
@ -51,7 +51,7 @@ from typing import (
|
||||||
Type,
|
Type,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "23.5a1-dev"
|
__version__ = "23.5a1-1-g0b26c8c-dev"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -64,10 +64,8 @@ class Config:
|
||||||
srccache: Path = (
|
srccache: Path = (
|
||||||
Path(os.getenv("XDG_CACHE_HOME", Path.home() / ".cache")) / "viv" / "src"
|
Path(os.getenv("XDG_CACHE_HOME", Path.home() / ".cache")) / "viv" / "src"
|
||||||
)
|
)
|
||||||
srcdefault: Path = (
|
share: Path = (
|
||||||
Path(os.getenv("XDG_DATA_HOME", Path.home() / ".local" / "share"))
|
Path(os.getenv("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "viv"
|
||||||
/ "viv"
|
|
||||||
/ "viv.py"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
|
@ -76,7 +74,8 @@ class Config:
|
||||||
parents=True,
|
parents=True,
|
||||||
exist_ok=True,
|
exist_ok=True,
|
||||||
)
|
)
|
||||||
self.srcdefault.parent.mkdir(parents=True, exist_ok=True)
|
self.share.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.srcdefault = self.share / "viv.py"
|
||||||
|
|
||||||
|
|
||||||
c = Config()
|
c = Config()
|
||||||
|
@ -466,12 +465,14 @@ class ViVenv:
|
||||||
def dump_info(self, write: bool = False) -> None:
|
def dump_info(self, write: bool = False) -> None:
|
||||||
# TODO: include associated files in 'info'
|
# TODO: include associated files in 'info'
|
||||||
# means it needs to be loaded first
|
# means it needs to be loaded first
|
||||||
|
# or keep a seperate file hash in c.share?
|
||||||
info = {
|
info = {
|
||||||
"created": str(datetime.today()),
|
"created": str(datetime.today()),
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
"spec": self.spec,
|
"spec": self.spec,
|
||||||
"exe": self.exe,
|
"exe": self.exe,
|
||||||
}
|
}
|
||||||
|
|
||||||
# save metadata to json file
|
# save metadata to json file
|
||||||
if write:
|
if write:
|
||||||
with (self.path / "viv-info.json").open("w") as f:
|
with (self.path / "viv-info.json").open("w") as f:
|
||||||
|
|
Loading…
Reference in a new issue