File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
node/flatpak_node_generator/providers Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,23 @@ def is_git_version(version: str) -> bool:
4444 return len ([p for p in url .path .split ('/' ) if p ]) == 2
4545 return False
4646
47+ @staticmethod
48+ def is_yarn_v1_lockfile (path : Path ) -> bool :
49+ if path .exists ():
50+ with open (path , encoding = 'utf-8' ) as f :
51+ for i , line in enumerate (f ):
52+ if i > 10 :
53+ break
54+ if '# yarn lockfile v1' in line .strip ():
55+ return True
56+ return False
57+
4758 def parse_lockfile (self , lockfile : Path ) -> Dict [str , Any ]:
59+ if not self .is_yarn_v1_lockfile (lockfile ):
60+ raise NotImplementedError (
61+ 'Only yarn v1 lockfiles are supported. See https://classic.yarnpkg.com/'
62+ )
63+
4864 def _iter_lines () -> Iterator [Tuple [int , str ]]:
4965 indent = ' '
5066 for line in lockfile .open ():
You can’t perform that action at this time.
0 commit comments