def finish_build(version, build, results): """ Build Finished, do house keeping bits """ (ret, out, err) = results['html'] if 'no targets are out of date.' in out: log.info(LOG_TEMPLATE.format(project=version.project.slug, version=version.slug, msg="Build Unchanged")) else: if ret == 0: log.info(LOG_TEMPLATE.format(project=version.project.slug, version=version.slug, msg="Successful Build")) #update_search(version) #fileify.delay(version.pk) symlinks.symlink_cnames(version) symlinks.symlink_translations(version) symlinks.symlink_subprojects(version) if version.project.single_version: symlinks.symlink_single_version(version) else: symlinks.remove_symlink_single_version(version) # This requires database access, must disable it for now. #send_notifications(version, build) else: log.warning(LOG_TEMPLATE.format(project=version.project.slug, version=version.slug, msg="Failed HTML Build"))
def symlink(project, version='latest'): from projects import symlinks v = version_from_slug(project, version) log.info("Symlinking %s" % v) symlinks.symlink_subprojects(v) symlinks.symlink_cnames(v) symlinks.symlink_translations(v)
def symlink(project, version=LATEST): from projects import symlinks v = version_from_slug(project, version) log.info("Symlinking %s" % v) symlinks.symlink_subprojects(v) symlinks.symlink_cnames(v) symlinks.symlink_translations(v)
def test_symlink_no_english(self): '''Test language german, no english This should symlink the translation to 'en' even though there is no 'en' language in translations or project language ''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' version = self.project.translations.first() self.project.translations.remove(version) self.project.save() self.assertNotIn(version, self.project.translations.all()) self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {project}/rtd-builds {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args)) ))
def test_symlink_no_english(self): '''Test language german, no english This should symlink the translation to 'en' even though there is no 'en' language in translations or project language ''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' version = self.project.translations.first() self.project.translations.remove(version) self.project.save() self.assertNotIn(version, self.project.translations.all()) self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {project}/rtd-builds {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args))))
def test_symlink_no_english(self): '''Test language german, no english This should symlink the translation to 'en' even though there is no 'en' language in translations or project language ''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' version = self.project.translations.first() self.project.translations.remove(version) self.project.save() self.assertNotIn(version, self.project.translations.all()) self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {project}/rtd-builds {project}/translations/en', ] for (i, command) in enumerate(commands): self.assertEqual(self.commands[i], command.format(**self.args), msg=('Command {0} mismatch, expecting {1}' .format(i, self.commands[i])))
def finish_build( version_pk, build_pk, hostname=None, html=False, localmedia=False, search=False, pdf=False, epub=False ): """ Build Finished, do house keeping bits """ version = Version.objects.get(pk=version_pk) build = Build.objects.get(pk=build_pk) if html: version.active = True version.built = True version.save() move_files( version_pk=version_pk, hostname=hostname, html=html, localmedia=localmedia, search=search, pdf=pdf, epub=epub ) symlinks.symlink_cnames(version) symlinks.symlink_translations(version) symlinks.symlink_subprojects(version) if version.project.single_version: symlinks.symlink_single_version(version) else: symlinks.remove_symlink_single_version(version) # Delayed tasks update_static_metadata.delay(version.project.pk) fileify.delay(version.pk, commit=build.commit) update_search.delay(version.pk, commit=build.commit) if not html and version.slug != STABLE and build.exit_code != 423: send_notifications.delay(version.pk, build_pk=build.pk)
def test_symlink_basic(self): '''Test basic scenario, language english, translation german''' symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {translation}/rtd-builds {project}/translations/de', 'ln -nsf {builds} {project}/translations/en', ] for (i, command) in enumerate(commands): self.assertEqual(self.commands[i], command.format(**self.args), msg=('Command {0} mismatch, expecting {1}' .format(i, self.commands[i])))
def test_symlink_basic(self): '''Test basic scenario, language english, translation german''' symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {translation}/rtd-builds {project}/translations/de', 'ln -nsf {builds} {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args))))
def test_symlink_basic(self): '''Test basic scenario, language english, translation german''' symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {translation}/rtd-builds {project}/translations/de', 'ln -nsf {builds} {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args)) ))
def finish_build(version_pk, build_pk, hostname=None, html=False, localmedia=False, search=False, pdf=False, epub=False): """ Build Finished, do house keeping bits """ version = Version.objects.get(pk=version_pk) build = Build.objects.get(pk=build_pk) if html: version.active = True version.built = True version.save() move_files( version_pk=version_pk, hostname=hostname, html=html, localmedia=localmedia, search=search, pdf=pdf, epub=epub, ) symlinks.symlink_cnames(version) symlinks.symlink_translations(version) symlinks.symlink_subprojects(version) if version.project.single_version: symlinks.symlink_single_version(version) else: symlinks.remove_symlink_single_version(version) # Delayed tasks update_static_metadata.delay(version.project.pk) fileify.delay(version.pk, commit=build.commit) update_search.delay(version.pk, commit=build.commit) if not html and version.slug != 'stable' and build.exit_code != 423: send_notifications.delay(version.pk, build_pk=build.pk)
def test_symlink_non_english(self): '''Test language german, translation english''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' self.translation.language = 'en' self.project.save() self.translation.save() self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {translation}/rtd-builds {project}/translations/en', ] for (i, command) in enumerate(commands): self.assertEqual(self.commands[i], command.format(**self.args), msg=('Command {0} mismatch, expecting {1}' .format(i, self.commands[i])))
def test_symlink_non_english(self): '''Test language german, translation english''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' self.translation.language = 'en' self.project.save() self.translation.save() self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {translation}/rtd-builds {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args))))
def test_symlink_non_english(self): '''Test language german, translation english''' # Change the languages, and then clear commands, as project.save calls # the symlinking self.project.language = 'de' self.translation.language = 'en' self.project.save() self.translation.save() self.commands = [] symlink_translations(self.project.versions.first()) commands = [ 'mkdir -p {project}/translations', 'ln -nsf {project}/rtd-builds {project}/translations/de', 'ln -nsf {translation}/rtd-builds {project}/translations/en', ] for command in commands: self.assertIsNotNone( self.commands.pop( self.commands.index(command.format(**self.args)) ))