\n')
fh.write('\n\n\n')
fh.close()
def render_repo(repo):
print('Generating HTML for %s…' % repo)
target_dir = os.path.join(WWW_DIR, repo)
if os.path.isdir(target_dir):
shutil.rmtree(target_dir)
os.makedirs(target_dir)
subprocess.check_call(['stagit', get_repo_dir(repo)], cwd=target_dir)
def render_all():
for repo in os.listdir(WWW_DIR):
path = os.path.join(WWW_DIR, repo)
if os.path.isdir(path):
shutil.rmtree(path)
for repo in config.iter_repos():
if config.getboolean(repo, 'http'):
render_repo(repo)
render_index()
if __name__ == '__main__':
all_repos = set(config.iter_repos())
phy_repos = set(fn[:-4] for fn in os.listdir(REPO_DIR) if fn.endswith('.git'))
stale_repos = phy_repos - all_repos
print('Updating repos …')
for repo in all_repos:
update_repo(repo)
if stale_repos:
print('Warning: stale files for deleted repos:', ', '.join(stale_repos))
render_all()