def symlink(project, version=LATEST): from readthedocs.projects import symlinks version_obj = version_from_slug(project, version) log.info("Symlinking %s", version_obj) symlinks.symlink_subprojects(version_obj) symlinks.symlink_cnames(version_obj) symlinks.symlink_translations(version_obj)
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) 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 symlink(project, version=LATEST): from readthedocs.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 symlink(project): """This is here to avoid circular imports in models.py""" from readthedocs.projects import symlinks log.info("Symlinking %s", project) symlinks.symlink_cnames(project) symlinks.symlink_translations(project) symlinks.symlink_subprojects(project) if project.single_version: symlinks.symlink_single_version(project) else: symlinks.remove_symlink_single_version(project)
def test_symlink_basic(self): """Test basic scenario, language english, translation german""" symlink_translations(self.project) 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 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() if not pdf: clear_pdf_artifacts(version) if not epub: clear_epub_artifacts(version) 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) 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))))
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)) ))