Ejemplo n.º 1
0
    def fix(self, check=True):
        if check:
            if not self.is_valid():
                return False
            return True

        if self.is_valid():
            logger.info(u'OK: Designer "{}"'.format(content.get('designer', '')))
            return True

        from bakery_cli.scripts.genmetadata import striplines
        content = {}
        with io.open(self.fontpath, 'r', encoding="utf-8") as fp:
            content = json.load(fp, object_pairs_hook=collections.OrderedDict)

        content['designer'] = 'Multiple Designers'
        with io.open(self.fontpath, 'w', encoding='utf-8') as f:
            contents = json.dumps(content, indent=2, ensure_ascii=False)
            f.write(striplines(contents))
        return True
Ejemplo n.º 2
0
    def fix(self, check=True):
        if check:
            if not self.is_valid():
                return False
            return True

        if self.is_valid():
            logger.info(u'OK: Designer "{}"'.format(content.get(
                'designer', '')))
            return True

        from bakery_cli.scripts.genmetadata import striplines
        content = {}
        with io.open(self.fontpath, 'r', encoding="utf-8") as fp:
            content = json.load(fp, object_pairs_hook=collections.OrderedDict)

        content['designer'] = 'Multiple Designers'
        with io.open(self.fontpath, 'w', encoding='utf-8') as f:
            contents = json.dumps(content, indent=2, ensure_ascii=False)
            f.write(striplines(contents))
        return True
                    if metadataJson['visibility'] == 'External' and argv.verbose:
                        print('OK: {} visibility'.format(family))
                    elif not argv.autofix:
                        print('ER: {} visibility is "{}" should be "External"'.format(family, metadataJson['visibility']), file=sys.stderr)
                    elif argv.autofix:
                        visibility = metadataJson['visibility']

                        from bakery_cli.scripts.genmetadata import striplines
                        content = {}
                        with io.open(metadataJsonFile, 'r', encoding="utf-8") as fp:
                            content = json.load(fp, object_pairs_hook=collections.OrderedDict)

                        content['visibility'] == 'External'
                        with io.open(metadataJsonFile + '.fix', 'w', encoding='utf-8') as f:
                            contents = json.dumps(content, indent=2, ensure_ascii=False)
                            f.write(striplines(contents))

                        print('ER: {} visibility is "{}" is now "External"'.format(family, visibility), file=sys.stderr)
            except ValueError:
                print('ER: {}-{} in API but not in Github'.format(family, style), file=sys.stderr)

        for font in metadataJson['fonts']:
            try:
                webfontStyles.index(str(font['weight']) + str(font['style']))
            except ValueError:
                print('ER: {} in Github but not in API'.format(font['filename']), file=sys.stderr)

        metadataJsonList.append(metadataJsonFile)

                        from bakery_cli.scripts.genmetadata import striplines
                        content = {}
                        with io.open(metadataJsonFile, 'r',
                                     encoding="utf-8") as fp:
                            content = json.load(
                                fp, object_pairs_hook=collections.OrderedDict)

                        content['visibility'] == 'External'
                        with io.open(metadataJsonFile + '.fix',
                                     'w',
                                     encoding='utf-8') as f:
                            contents = json.dumps(content,
                                                  indent=2,
                                                  ensure_ascii=False)
                            f.write(striplines(contents))

                        print('ER: {} visibility is "{}" is now "External"'.
                              format(family, visibility),
                              file=sys.stderr)
            except ValueError:
                print('ER: {}-{} in API but not in Github'.format(
                    family, style),
                      file=sys.stderr)

        for font in metadataJson['fonts']:
            try:
                webfontStyles.index(str(font['weight']) + str(font['style']))
            except ValueError:
                print('ER: {} in Github but not in API'.format(
                    font['filename']),