2020import paver .setuputils
2121paver .setuputils .install_distutils_tasks ()
2222import paver .doctools
23+ import docpaver
2324
2425# What project are we building?
2526PROJECT = 'virtualenvwrapper'
4950 author = 'Doug Hellmann' ,
5051 author_email = 'doug.hellmann@gmail.com' ,
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
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 (
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+
97144def 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' ,
0 commit comments