def move(self, **kwargs): project = self.version.project outputted_path = os.path.join(project.conf_dir(self.version.slug), '_build', 'epub') to_path = os.path.join(settings.MEDIA_ROOT, 'epub', project.slug, self.version.slug) 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))
def move(self, **kwargs): #This needs to be thought about more because of all the state above. #We could just shove the filename on the instance or something. project = self.version.project os.chdir(os.path.join(project.conf_dir(self.version.slug), '_build', 'latex')) tex_files = glob('*.tex') for tex_file in tex_files: to_path = os.path.join(settings.MEDIA_ROOT, 'pdf', project.slug, self.version.slug) to_file = os.path.join(to_path, '%s.pdf' % project.slug) # pdflatex names its output predictably: foo.tex -> foo.pdf pdf_filename = os.path.splitext(tex_file)[0] + '.pdf' from_file = os.path.join(os.getcwd(), pdf_filename) 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))
def move(self, **kwargs): #This needs to be thought about more because of all the state above. #We could just shove the filename on the instance or something. project = self.version.project os.chdir( os.path.join(project.conf_dir(self.version.slug), '_build', 'latex')) tex_files = glob('*.tex') for tex_file in tex_files: to_path = os.path.join(settings.MEDIA_ROOT, 'pdf', project.slug, self.version.slug) to_file = os.path.join(to_path, '%s.pdf' % project.slug) # pdflatex names its output predictably: foo.tex -> foo.pdf pdf_filename = os.path.splitext(tex_file)[0] + '.pdf' from_file = os.path.join(os.getcwd(), pdf_filename) 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))
def move(self, **kwargs): project = self.version.project if project.full_build_path(self.version.slug): #Copy the html files. target = project.rtd_build_path(self.version.slug) if "_" in project.slug: new_slug = project.slug.replace('_','-') new_target = target.replace(project.slug, new_slug) #Only replace 1, so user_builds doesn't get replaced >:x targets = [target, new_target] else: targets = [target] for target in targets: if getattr(settings, "MULTIPLE_APP_SERVERS", None): log.info("Copying docs to remote server.") copy_to_app_servers(project.full_build_path(self.version.slug), target) else: if os.path.exists(target): shutil.rmtree(target) log.info("Copying docs on the local filesystem") shutil.copytree(project.full_build_path(self.version.slug), target) #Copy the zip file. to_path = os.path.join(settings.MEDIA_ROOT, 'htmlzip', project.slug, self.version.slug) to_file = os.path.join(to_path, '%s.zip' % project.slug) from_path = project.checkout_path(self.version.slug) from_file = os.path.join(from_path, '%s.zip' % 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: log.warning("Not moving docs, because the build dir is unknown.")