gitosis/gitosis/util.py
Tommi Virtanen 2078a0c828 Write gitweb projects.list to ~/gitosis, not inside the gitosis-admin repo.
This allows running gitweb as a separate user without needing to allow it
read access to gitosis-admin.git. Running as separate user will still most
likely require a ``chgrp www-data`` of the relevant repositories, but
nothing not already decided public needs to be exposed.

Existing gitweb users will need to adjust their gitweb.conf to point to
the new location of the projects.list file.

Removing the old projects.list from
~git/repositories/gitosis-admin.git/projects.list is safe once gitweb
has switched to using the new location.
2007-11-29 00:40:34 +02:00

30 lines
804 B
Python

import errno
import os
from ConfigParser import NoSectionError, NoOptionError
def mkdir(*a, **kw):
try:
os.mkdir(*a, **kw)
except OSError, e:
if e.errno == errno.EEXIST:
pass
else:
raise
def getRepositoryDir(config):
repositories = os.path.expanduser('~')
try:
path = config.get('gitosis', 'repositories')
except (NoSectionError, NoOptionError):
repositories = os.path.join(repositories, 'repositories')
else:
repositories = os.path.join(repositories, path)
return repositories
def getGeneratedFilesDir(config):
try:
generated = config.get('gitosis', 'generate-files-in')
except (NoSectionError, NoOptionError):
generated = os.path.expanduser('~/gitosis')
return generated