Skip to content

Commit

Permalink
Fix moving of man, pdf and epub files.
Browse files Browse the repository at this point in the history
Bug only affected single server installs. When MULTIPLE_APP_SERVERS
is not set, the pdf, man, and epub files were being built, but were not
being moved to the /media directory.
  • Loading branch information
toffer committed Feb 28, 2012
1 parent bedc3f0 commit ada5b1d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
19 changes: 11 additions & 8 deletions readthedocs/doc_builder/backends/sphinx_epub.py
@@ -1,3 +1,4 @@
from glob import glob
import os
from doc_builder.base import restoring_chdir
from doc_builder.backends.sphinx import Builder as HtmlBuilder
Expand Down Expand Up @@ -30,11 +31,13 @@ def move(self):
'epub',
project.slug,
self.version.slug)
from_file = os.path.join(outputted_path, "*.epub")
to_file = os.path.join(to_path, "%s.epub" % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
from_globs = glob(os.path.join(outputted_path, "*.epub"))
if from_globs:
from_file = from_globs[0]
to_file = os.path.join(to_path, "%s.epub" % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
19 changes: 11 additions & 8 deletions readthedocs/doc_builder/backends/sphinx_man.py
@@ -1,3 +1,4 @@
from glob import glob
import os

from django.conf import settings
Expand Down Expand Up @@ -30,11 +31,13 @@ def move(self):
'man',
project.slug,
self.version.slug)
from_file = os.path.join(outputted_path, "*.1")
to_file = os.path.join(to_path, '%s.1' % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
from_globs = glob(os.path.join(outputted_path, "*.1"))
if from_globs:
from_file = from_globs[0]
to_file = os.path.join(to_path, '%s.1' % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
18 changes: 10 additions & 8 deletions readthedocs/doc_builder/backends/sphinx_pdf.py
Expand Up @@ -40,14 +40,16 @@ def build(self):
'pdf',
project.slug,
self.version.slug)
from_file = os.path.join(os.getcwd(), "*.pdf")
to_file = os.path.join(to_path, '%s.pdf' % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
from_globs = glob(os.path.join(os.getcwd(), "*.pdf"))
if from_globs:
from_file = from_globs[0]
to_file = os.path.join(to_path, '%s.pdf' % project.slug)
if getattr(settings, "MULTIPLE_APP_SERVERS", None):
copy_file_to_app_servers(from_file, to_file)
else:
if not os.path.exists(to_path):
os.makedirs(to_path)
run('mv -f %s %s' % (from_file, to_file))
else:
print "PDF Building failed. Moving on."
return (latex_results, pdf_results)
Expand Down

0 comments on commit ada5b1d

Please sign in to comment.