Esempio n. 1
0
def main():
    default_noto = notoconfig.get("noto")
    default_cldr = notoconfig.get("cldr")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--cldr",
        help="directory of local cldr svn repo (default %s)" % default_cldr,
        default=default_cldr,
    )
    parser.add_argument("--update_cldr",
                        help="update cldr before running",
                        action="store_true")
    parser.add_argument("--cldr_tag",
                        help="tag name to use for cldr (default empty)",
                        default="")
    parser.add_argument(
        "--noto",
        help="directory of local noto git repo (default %s)" % default_noto,
        default=default_noto,
    )
    parser.add_argument("--branch",
                        help="confirm current branch of noto git repo")
    args = parser.parse_args()

    if not args.cldr or not args.noto:
        print("Missing either or both of cldr and noto locations.")
        return

    if args.branch:
        cur_branch = tool_utils.git_get_branch(args.noto)
        if cur_branch != args.branch:
            print("Expected branch '%s' but %s is in branch '%s'." %
                  (args.branch, args.noto, cur_branch))
            return

    update_cldr(args.noto, args.cldr, args.update_cldr, args.cldr_tag)
Esempio n. 2
0
def resolve_path(somepath):
    """Resolve a path that might start with noto path shorthand. If
  the path is empty, is '-', or the shorthand is not defined,
  returns None. Example: '[fonts]/hinted'."""

    if not somepath or somepath == '-':
        return None
    m = noto_re.match(somepath)
    if m:
        base, rest = m.groups()
        if base == 'adobe':
            key = 'adobe_data'
        elif base == 'mti':
            key = 'monotype_data'
        elif base == 'afdko':
            key = 'afdko'
        else:
            key = 'noto_' + base
        base = notoconfig.get(key)
        while rest.startswith(path.sep):
            rest = rest[len(path.sep):]
        somepath = path.join(base, rest)
    return path.realpath(path.abspath(path.expanduser(somepath)))
Esempio n. 3
0
def resolve_path(somepath):
  """Resolve a path that might start with noto path shorthand. If
  the path is empty, is '-', or the shorthand is not defined,
  returns None. Example: '[fonts]/hinted'."""

  if not somepath or somepath == '-':
    return None
  m = noto_re.match(somepath)
  if m:
    base, rest = m.groups()
    if base == 'adobe':
      key = 'adobe_data'
    elif base == 'mti':
      key = 'monotype_data'
    elif base == 'afdko':
      key = 'afdko'
    else:
      key = 'noto_' + base
    base = notoconfig.get(key)
    while rest.startswith(path.sep):
      rest = rest[len(path.sep):]
    somepath = path.join(base, rest)
  return path.realpath(path.abspath(path.expanduser(somepath)))