示例#1
0
def gen_html():
    """Generate HTML output."""
    rst_files = glob('*.rst')
    dep(map(lambda s: s[:-4] + '.html', rst_files), rst_files, mapping=True)
    for file in glob('*.rst'):
        html_file = file[:-4] + '.html'
        if newer(html_file, file):
            break
        try:
            publish_file(open(file), destination=open(html_file, 'w'),
                         settings_overrides={'halt_level': 1})
        except SystemMessage:
            exit(1)
        print(success('%s generated!' % file))
    print(success('All reST generated!'))
示例#2
0
def gen_manifests():
    """Generate Manifest files."""
    packages = glob('*-*/*/*') + glob('virtual/*/*')
    dep(glob('*-*/*/Manifest') + glob('virtual/*/Manifest'), packages)
    base_dir = os.path.abspath(os.curdir)
    if not SIGN_KEY:
        print(warn('No GnuPG key set!'))
    for package in sorted(packages):
        try:
            os.chdir(package)
            if not any(map(lambda f: newer(f, 'Manifest'), glob('*'))):
                break
            check_call(['repoman', 'manifest'])
            if SIGN_KEY:
                check_call(['gpg', '--local-user', SIGN_KEY, '--clearsign',
                            'Manifest'])
                os.rename('Manifest.asc', 'Manifest')
        finally:
            os.chdir(base_dir)
示例#3
0
def gen_news_sigs():
    """Generate news file signatures."""
    news_files = glob('metadata/news/*/*.txt')
    dep(map(lambda s: s + '.asc', news_files), news_files, mapping=True)
    if not SIGN_KEY:
        raise CommandError(fail('No GnuPG key set!'))
    base_dir = os.path.abspath(os.curdir)
    for path in news_files:
        try:
            dir, file = os.path.split(path)
            os.chdir(dir)
            sign_file = file + '.asc'
            if newer(sign_file, file):
                continue
            # Delete up front, if we can't sign we shouldn't leave stale
            # signatures
            if os.path.exists(sign_file):
                os.unlink(sign_file)
            check_call(['gpg', '--local-user', SIGN_KEY, '--detach-sign',
                        '--armor', file])
        finally:
            os.chdir(base_dir)