Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
2.0 kB · 62 lines
Python
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263#!/usr/bin/env python3import sysimport json
if len(sys.argv) == 1: print("usage: ./this-script WORKSPACE", file=sys.stderr) print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr) print("Hail Eris.", file=sys.stderr) sys.exit(1)
http_archives = []
# just the kw args are the dict { name, sha256, urls … }def http_archive(**kw): http_archives.append(kw)# like http_filedef http_file(**kw): http_archives.append(kw)
# this is inverted from http_archive/http_file and bundles multiple archivesdef distdir_tar(**kw): for archive_name in kw['archives']: http_archives.append({ "name": archive_name, "sha256": kw['sha256'][archive_name], "urls": kw['urls'][archive_name] })
# stubs for symbols we are not interested in# might need to be expanded if new bazel releases add symbols to the workspacedef workspace(name): passdef load(*args): passdef bind(**kw): passdef list_source_repository(**kw): passdef new_local_repository(**kw): passdef local_repository(**kw): passDOC_VERSIONS = []def stardoc_repositories(**kw): passdef skydoc_repositories(**kw): passdef rules_sass_dependencies(**kw): passdef node_repositories(**kw): passdef sass_repositories(**kw): passdef register_execution_platforms(*args): passdef rbe_autoconfig(*args, **kw): passdef rules_pkg_dependencies(*args, **kw): passdef winsdk_configure(*args, **kw): passdef register_local_rc_exe_toolchains(*args, **kw): passdef register_toolchains(*args, **kw): passdef debian_deps(): passdef grpc_deps(): passdef grpc_extra_deps(): passdef bazel_skylib_workspace(): pass
# execute the WORKSPACE like it was python code in this module,# using all the function stubs from above.with open(sys.argv[1]) as f: exec(f.read())
# transform to a dict with the names as keysd = { el['name']: el for el in http_archives }
print(json.dumps(d, sort_keys=True, indent=4))