20
20
import paver .setuputils
21
21
paver .setuputils .install_distutils_tasks ()
22
22
import paver .doctools
23
+ import docpaver
23
24
24
25
# What project are we building?
25
26
PROJECT = 'virtualenvwrapper'
49
50
author = 'Doug Hellmann' ,
50
51
author_email = '[email protected] ' ,
51
52
52
- url = 'http://www.doughellmann.com/projects/virtualenvwrapper/' ,
53
+ url = 'http://www.doughellmann.com/projects/%s/' % PROJECT ,
53
54
download_url = 'http://www.doughellmann.com/downloads/%s-%s.tar.gz' % \
54
55
(PROJECT , VERSION ),
55
56
78
79
79
80
sphinx = Bunch (
80
81
docroot = '.' ,
81
- builddir = 'docs' ,
82
82
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' ,
83
105
),
84
106
85
107
sdist = Bunch (
94
116
95
117
)
96
118
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
+
97
144
def remake_directories (* dirnames ):
98
145
"""Remove the directories and recreate them.
99
146
"""
@@ -105,14 +152,21 @@ def remake_directories(*dirnames):
105
152
return
106
153
107
154
@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 ))
114
167
return
115
168
169
+
116
170
@task
117
171
@needs (['html' ,
118
172
'generate_setup' , 'minilib' ,
0 commit comments