blob: 62bb008fa323cfa8fca51599f33189c048a4cbbc [file] [log] [blame]
#!/usr/bin/env python
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import sys
ROOT_PATH = os.path.abspath(__file__ + "/../../..")
sys.path += [os.path.join(ROOT_PATH, "third_party", "pytoml")]
import pytoml
def main():
parser = argparse.ArgumentParser(
"Lists all of the names of crates included in a Cargo.toml file")
help="Path to Cargo.toml",
args = parser.parse_args()
with open(args.cargo_toml, "r") as file:
cargo_toml = pytoml.load(file)
for key in cargo_toml["dependencies"].keys():
print key
target_specs = ['cfg(target_os = "fuchsia")', 'cfg(not(target_os = "fuchsia"))']
for target_spec in target_specs:
for key in cargo_toml.get("target", {}).get(target_spec, {}).get("dependencies", []):
print key
if __name__ == '__main__':