Skip to content

Commit dcd20d0

Browse files
committed
incorporate personal site templates into a build that lets me generate hosted docs
--HG-- rename : docsource/conf.py => sphinx/pkg/conf.py
1 parent cb88e74 commit dcd20d0

File tree

7 files changed

+378
-210
lines changed

7 files changed

+378
-210
lines changed

.hgignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ setup.py
66
trace.txt
77
docs
88
*.pyc
9+
sphinx/web/templates/base.html
910

1011
syntax: re
1112
.DS_Store
13+
^web/

docsource/Makefile

Lines changed: 0 additions & 88 deletions
This file was deleted.

docsource/make.bat

Lines changed: 0 additions & 112 deletions
This file was deleted.

pavement.py

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import paver.setuputils
2121
paver.setuputils.install_distutils_tasks()
2222
import paver.doctools
23+
import docpaver
2324

2425
# What project are we building?
2526
PROJECT = 'virtualenvwrapper'
@@ -49,7 +50,7 @@
4950
author = 'Doug Hellmann',
5051
author_email = '[email protected]',
5152

52-
url = 'http://www.doughellmann.com/projects/virtualenvwrapper/',
53+
url = 'http://www.doughellmann.com/projects/%s/' % PROJECT,
5354
download_url = 'http://www.doughellmann.com/downloads/%s-%s.tar.gz' % \
5455
(PROJECT, VERSION),
5556

@@ -78,8 +79,29 @@
7879

7980
sphinx = Bunch(
8081
docroot='.',
81-
builddir='docs',
8282
sourcedir='docsource',
83+
builder='html',
84+
template_args={'project':PROJECT}
85+
),
86+
87+
html=Bunch(
88+
templates='pkg',
89+
builddir='docs',
90+
confdir='sphinx/pkg',
91+
),
92+
93+
website=Bunch(
94+
templates = 'web',
95+
builddir = 'web',
96+
confdir='sphinx/web',
97+
98+
# What server hosts the website?
99+
server = 'www.doughellmann.com',
100+
server_path = '/var/www/doughellmann/DocumentRoot/docs/%s/' % PROJECT,
101+
102+
# What template should be used for the web site HTML?
103+
template_source = '~/Devel/personal/doughellmann/templates/base.html',
104+
template_dest = 'sphinx/web/templates/base.html',
83105
),
84106

85107
sdist = Bunch(
@@ -94,6 +116,31 @@
94116

95117
)
96118

119+
@task
120+
def html(options):
121+
# Build the docs
122+
docpaver.html(options)
123+
# Move them into place for packaging
124+
destdir = path(PROJECT) / 'docs'
125+
destdir.rmtree()
126+
builtdocs = path(options.builddir) / "html"
127+
builtdocs.move(destdir)
128+
return
129+
130+
@task
131+
def website(options):
132+
"""Create local copy of website files.
133+
"""
134+
# Make sure the base template is updated
135+
dest = path(options.website.template_dest).expanduser()
136+
src = path(options.website.template_source).expanduser()
137+
if not dest.exists() or (src.mtime > dest.mtime):
138+
dest.dirname().mkdir()
139+
src.copy(dest)
140+
# Build the docs
141+
docpaver.run_sphinx(options, 'website')
142+
return
143+
97144
def remake_directories(*dirnames):
98145
"""Remove the directories and recreate them.
99146
"""
@@ -105,14 +152,21 @@ def remake_directories(*dirnames):
105152
return
106153

107154
@task
108-
@needs('paver.doctools.html')
109-
def html(options):
110-
destdir = path(PROJECT) / 'docs'
111-
destdir.rmtree()
112-
builtdocs = path(options.builddir) / "html"
113-
builtdocs.move(destdir)
155+
def installwebsite(options):
156+
"""Rebuild and copy website files to the remote server.
157+
"""
158+
# Clean up
159+
remake_directories(options.website.builddir)
160+
# Rebuild
161+
website(options)
162+
# Copy to the server
163+
os.environ['RSYNC_RSH'] = '/usr/bin/ssh'
164+
src_path = path(options.website.builddir) / 'html'
165+
sh('cd %s; rsync --archive --delete --verbose . %s:%s' %
166+
(src_path, options.website.server, options.website.server_path))
114167
return
115168

169+
116170
@task
117171
@needs(['html',
118172
'generate_setup', 'minilib',

docsource/conf.py renamed to sphinx/pkg/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
extensions = []
2626

2727
# Add any paths that contain templates here, relative to this directory.
28-
templates_path = ['_templates']
28+
templates_path = ['templates']
2929

3030
# The suffix of source filenames.
3131
source_suffix = '.rst'
@@ -120,7 +120,7 @@
120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
122122
# so a file named "default.css" will overwrite the builtin "default.css".
123-
html_static_path = ['_static']
123+
html_static_path = ['static']
124124

125125
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126126
# using the given strftime format.

0 commit comments

Comments
 (0)