aboutsummaryrefslogtreecommitdiff
path: root/repos.cgi
blob: 5b674641dbec9d061b51f3bd9ec4472ea5a109fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python3

import os

print("Content-type:text/plain\r\n\r\n", end="")

# `ls -d /srv/git/*`
config_filename = os.environ["GITWEB_CONFIG"]
project_root = None
remote_prefix = None

with open(config_filename) as f:
	for line in f.readlines():
		if line.startswith("$projectroot"):
			project_root = line.split('"')[1]
		elif line.startswith("$remote_prefix"):
			remote_prefix = line.split('"')[1]

if project_root is not None or remote_prefix is not None:
	for file in os.scandir(project_root):
            desc=open(f"{file.path}/description").read()
            print(f"{file.name},{remote_prefix}{file.path},{desc}".strip())