python-language-server: init at 2020-04-24
This commit is contained in:
committed by
Frederik Rietdijk
parent
699563af7f
commit
d963bf30f5
37
pkgs/development/dotnet-modules/python-language-server/process_lockfile.py
Executable file
37
pkgs/development/dotnet-modules/python-language-server/process_lockfile.py
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
def process_section(name, section):
|
||||
packages = set()
|
||||
|
||||
if "resolved" in section:
|
||||
packages.add((name, section["resolved"]))
|
||||
|
||||
if "dependencies" in section:
|
||||
for name in section["dependencies"]:
|
||||
packages.add((name, section["dependencies"][name]))
|
||||
|
||||
return packages
|
||||
|
||||
|
||||
def main():
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
tree = json.loads(f.read())
|
||||
|
||||
packages = set()
|
||||
|
||||
topDependencies = tree["dependencies"]
|
||||
|
||||
for area in topDependencies:
|
||||
for name in topDependencies[area]:
|
||||
packages = packages.union(process_section(name, topDependencies[area][name]))
|
||||
|
||||
for (name, version) in packages:
|
||||
print("%s %s" % (name, version))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user