예제 #1
0
def _parse_deps_file_line(basejs_file, roots, line, must_exist=True):
  match = parse_deps_regex.match(line)
  if not(match):
    return None

  js_file = tree_builder.get_real_path_for_file(basejs_file, roots, match.group(1), must_exist)
  if js_file == None:
    return None

  namespaces_provided = match.group(2).replace("'", "").replace(" ", "").split(",")
  tree_builder.add_namespaces_to_tree(namespaces_provided)
  namespaces_required = match.group(3).replace("'", "").replace(" ", "").split(",")

  config.db["dependencies"][js_file] = {
    "timestamp": time.localtime(),
    "namespaces_provided": namespaces_provided,
    "namespaces_required": namespaces_required
  }

  return js_file
예제 #2
0
 def test_add_namespaces_to_tree_get_inserted_into_deps_tree(self):
   tree_builder.add_namespaces_to_tree(["ns.ns1", "ns.ns2", "ns.ns3", "ns4"])
   self.assertEqual({"ns": {
     "ns1": {}, "ns2": {}, "ns3": {}
   }, "ns4": {}}, config.db["deps_tree"])