File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ import toml
2+
3+ from projspec .proj import ProjectSpec
4+ from projspec .utils import AttrDict
5+
6+
7+ class PyScriptSpec (ProjectSpec ):
8+ def match (self ) -> bool :
9+ basenames = [_ .rsplit ("/" , 1 )[0 ] for _ in self .root .filelist ]
10+ return "pyscript.toml" in basenames or "pyscript.json" in basenames
11+
12+ def parse (self ) -> None :
13+ try :
14+ with self .root .fs .open (f"{ self .root .url } /pyscript.toml" ) as f :
15+ meta = toml .load (f )
16+ except FileNotFoundError :
17+ with self .root .fs .open (f"{ self .root .url } /pyscript.json" ) as f :
18+ meta = toml .load (f )
19+ cont = AttrDict ()
20+ if "packages" in meta :
21+ cont ["environment" ] = AttrDict (default = meta ["packages" ])
22+ self ._contents = cont
23+
24+ # perhaps a local deployment can be a reasonable artifact
25+ # https://github.com/pyscript/pyscript-cli
26+ self ._artifacts = AttrDict ()
You can’t perform that action at this time.
0 commit comments