Write out the conf file before building :)

rtd2
Eric Holscher 2010-08-14 07:58:19 -05:00
parent 2cd45e8814
commit 8c8e4fb07b
3 changed files with 12 additions and 9 deletions

View File

@ -70,6 +70,10 @@ class Project(models.Model):
def primary_conf(self):
return self.confs.get(primary_conf=True)
@property
def template_dir(self):
return os.path.join(settings.DOCROOT, '_template')
def get_rendered_conf(self):
return render_to_string('projects/conf.py.html', {'project': self})

View File

@ -31,17 +31,13 @@ def update_docs(slug, type='git'):
command = 'git clone %s.git %s' % (project.github_repo, project.slug)
print command
run(command)
build_docs(path, project=project)
build_docs(project)
def build_docs(project):
"""
A helper function for the celery task to do the actual doc building.
"""
make_dir = project.find('Makefile')[0].replace('/Makefile', '')
os.chdir(make_dir)
os.system('make html')
conf_dir = project.find('conf.py')[0].replace('/conf.py', '')
os.chdir(conf_dir)
lines = open('conf.py').readlines()
@ -57,3 +53,9 @@ def build_docs(project):
conf.theme = data['html_theme']
conf.path = os.getcwd()
conf.save()
project.write_conf()
make_dir = project.find('Makefile')[0].replace('/Makefile', '')
os.chdir(make_dir)
os.system('make html')

View File

@ -1,12 +1,9 @@
import sys, os
from django.conf import settings
TEMPLATE_DIR = os.path.join(settings.DOCROOT, '_template')
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = [TEMPLATE_DIR, '_templates']
templates_path = ['{{ project.template_dir }}']
# The suffix of source filenames.
source_suffix = '.rst'