19SCRIPT_DIR = os.path.dirname(sys.argv[0])
20DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR,
'..'))
34 """Implements the Var syntax."""
40 raise Exception(
"Var is not defined: %s" % var_name)
51 with open(deps_file,
'r')
as fp:
52 deps_content = fp.read()
55 exec (deps_content, global_scope, local_scope)
58 deps = local_scope.get(
'deps', {})
60 for k, v
in deps.items():
61 if 'sdk/third_party/pkg' in k:
62 new_key = k.replace(
'sdk',
'third_party/dart', 1)
63 filtered_deps[new_key] = v
69 project_template =
"""
76 '<!-- This file is generated by '
77 '//third_party/dart/tools/create_pkg_manifest.py. DO NOT EDIT -->\n')
78 with open(manifest_file,
'w')
as manifest:
79 manifest.write(
'<?xml version="1.0" encoding="UTF-8"?>\n')
80 manifest.write(warning)
81 manifest.write(
'<manifest>\n')
82 manifest.write(
' <projects>\n')
83 for path, remote
in sorted(deps.items()):
84 remote_components = remote.split(
'@')
85 remote_url = remote_components[0]
86 remote_version = remote_components[1]
88 project_template % (path, path, remote_url, remote_version))
89 manifest.write(
' </projects>\n')
90 manifest.write(
'</manifest>\n')
95 parser = argparse.ArgumentParser(
96 description=
'A script to generate a jiri manifest for third_party/pkg.')
102 help=
'Input DEPS file.',
103 default=os.path.join(DART_ROOT,
'DEPS'))
108 help=
'Output jiri manifest.',
109 default=os.path.join(DART_ROOT,
'dart_third_party_pkg.manifest'))
111 return parser.parse_args(args)
121if __name__ ==
'__main__':
122 sys.exit(
Main(sys.argv))
def Lookup(self, var_name)
def __init__(self, local_scope)
def WriteManifest(deps, manifest_file)
def ParseDepsFile(deps_file)
const myers::Point & get(const myers::Segment &)