-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Adding option to disable pdf/epub builds for sphinx based projects. #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
29f0ff4
Adding sphinx_enable_epub/pdf_build flags to Project model and use th…
gregmuellegger 914eed1
Refactor os.path.exists mocking in readthedocs/rtd_tests/tests/test_b…
gregmuellegger dd058e8
Adding get_builder_class to have clearer interface on how to retrieve…
gregmuellegger b2cefcc
Adding tests for checking if pdf/epub flag is respected in builds.
gregmuellegger 4997755
Adding pdf/epub output format flags to advanced settings in the proje…
gregmuellegger a3ffcfd
Disabling reporting on PDF builds if the build has been disabled by P…
gregmuellegger 93c3ea5
Removing -p option which enabled pdf builds for update_versions and u…
gregmuellegger 25e7908
Removing switches whether to build dash/man formats. Those formats ar…
gregmuellegger 5fd9661
Adding comments about legacy code for existing projects that have man…
gregmuellegger e8a10b3
Removing unused pdf/epub switches from project.tasks. The settings do…
gregmuellegger d530903
Renaming sphinx_enable_*_build fields to enable_*_build.
gregmuellegger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
from builds.models import Version | ||
from django.core.management.base import BaseCommand | ||
from optparse import make_option | ||
from projects.tasks import update_docs | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Custom management command to rebuild documentation for all projects on | ||
the site. Invoked via ``./manage.py update_repos``. | ||
""" | ||
option_list = BaseCommand.option_list + ( | ||
make_option('-p', | ||
action='store_true', | ||
dest='pdf', | ||
default=False, | ||
help='Make a pdf'), | ||
) | ||
|
||
def handle(self, *args, **options): | ||
make_pdf = options['pdf'] | ||
for version in Version.objects.filter(active=True, built=False): | ||
update_docs(version.project_id, pdf=make_pdf, record=False, | ||
update_docs(version.project_id, record=False, | ||
version_pk=version.pk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 159 additions & 0 deletions
159
readthedocs/projects/migrations/0045_add_format_build_options.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# -*- coding: utf-8 -*- | ||
from south.utils import datetime_utils as datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
# Adding field 'Project.sphinx_enable_epub_build' | ||
db.add_column(u'projects_project', 'sphinx_enable_epub_build', | ||
self.gf('django.db.models.fields.BooleanField')(default=True), | ||
keep_default=False) | ||
|
||
# Adding field 'Project.sphinx_enable_pdf_build' | ||
db.add_column(u'projects_project', 'sphinx_enable_pdf_build', | ||
self.gf('django.db.models.fields.BooleanField')(default=True), | ||
keep_default=False) | ||
|
||
|
||
def backwards(self, orm): | ||
# Deleting field 'Project.sphinx_enable_epub_build' | ||
db.delete_column(u'projects_project', 'sphinx_enable_epub_build') | ||
|
||
# Deleting field 'Project.sphinx_enable_pdf_build' | ||
db.delete_column(u'projects_project', 'sphinx_enable_pdf_build') | ||
|
||
|
||
models = { | ||
u'auth.group': { | ||
'Meta': {'object_name': 'Group'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), | ||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) | ||
}, | ||
u'auth.permission': { | ||
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, | ||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | ||
}, | ||
u'auth.user': { | ||
'Meta': {'object_name': 'User'}, | ||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), | ||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), | ||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), | ||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) | ||
}, | ||
u'builds.version': { | ||
'Meta': {'ordering': "['-verbose_name']", 'unique_together': "[('project', 'slug')]", 'object_name': 'Version'}, | ||
'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'built': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'machine': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'privacy_level': ('django.db.models.fields.CharField', [], {'default': "'public'", 'max_length': '20'}), | ||
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'versions'", 'to': u"orm['projects.Project']"}), | ||
'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'supported': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'type': ('django.db.models.fields.CharField', [], {'default': "'unknown'", 'max_length': '20'}), | ||
'uploaded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'verbose_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) | ||
}, | ||
u'contenttypes.contenttype': { | ||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, | ||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | ||
}, | ||
u'projects.emailhook': { | ||
'Meta': {'object_name': 'EmailHook'}, | ||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'emailhook_notifications'", 'to': u"orm['projects.Project']"}) | ||
}, | ||
u'projects.importedfile': { | ||
'Meta': {'object_name': 'ImportedFile'}, | ||
'commit': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'md5': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'path': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'imported_files'", 'to': u"orm['projects.Project']"}), | ||
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), | ||
'version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'imported_files'", 'null': 'True', 'to': u"orm['builds.Version']"}) | ||
}, | ||
u'projects.project': { | ||
'Meta': {'ordering': "('slug',)", 'object_name': 'Project'}, | ||
'allow_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'analytics_code': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), | ||
'canonical_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}), | ||
'comment_moderation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'conf_py_file': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), | ||
'copyright': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), | ||
'default_branch': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}), | ||
'default_version': ('django.db.models.fields.CharField', [], {'default': "'latest'", 'max_length': '255'}), | ||
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
'django_packages_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), | ||
'documentation_type': ('django.db.models.fields.CharField', [], {'default': "'auto'", 'max_length': '20'}), | ||
'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '20'}), | ||
'main_language_project': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'translations'", 'null': 'True', 'to': u"orm['projects.Project']"}), | ||
'mirror': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'modified_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'num_major': ('django.db.models.fields.IntegerField', [], {'default': '2', 'max_length': '3', 'null': 'True', 'blank': 'True'}), | ||
'num_minor': ('django.db.models.fields.IntegerField', [], {'default': '2', 'max_length': '3', 'null': 'True', 'blank': 'True'}), | ||
'num_point': ('django.db.models.fields.IntegerField', [], {'default': '2', 'max_length': '3', 'null': 'True', 'blank': 'True'}), | ||
'path': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'privacy_level': ('django.db.models.fields.CharField', [], {'default': "'public'", 'max_length': '20'}), | ||
'programming_language': ('django.db.models.fields.CharField', [], {'default': "'words'", 'max_length': '20', 'blank': 'True'}), | ||
'project_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}), | ||
'pub_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | ||
'python_interpreter': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '20'}), | ||
'related_projects': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['projects.Project']", 'null': 'True', 'through': u"orm['projects.ProjectRelationship']", 'blank': 'True'}), | ||
'repo': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
'repo_type': ('django.db.models.fields.CharField', [], {'default': "'git'", 'max_length': '10'}), | ||
'requirements_file': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}), | ||
'single_version': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'skip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}), | ||
'sphinx_enable_epub_build': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'sphinx_enable_pdf_build': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'suffix': ('django.db.models.fields.CharField', [], {'default': "'.rst'", 'max_length': '10'}), | ||
'theme': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '20'}), | ||
'use_system_packages': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'use_virtualenv': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'projects'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}), | ||
'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), | ||
'version_privacy_level': ('django.db.models.fields.CharField', [], {'default': "'public'", 'max_length': '20'}) | ||
}, | ||
u'projects.projectrelationship': { | ||
'Meta': {'object_name': 'ProjectRelationship'}, | ||
'child': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'superprojects'", 'to': u"orm['projects.Project']"}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subprojects'", 'to': u"orm['projects.Project']"}) | ||
}, | ||
u'projects.webhook': { | ||
'Meta': {'object_name': 'WebHook'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'webhook_notifications'", 'to': u"orm['projects.Project']"}), | ||
'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) | ||
} | ||
} | ||
|
||
complete_apps = ['projects'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably leave the "sphinx" naming off these. They should be global settings for the project, and respected where they need to be, but having "sphinx" in the name feels weird.
For example, if we ever added PDF support to other builder backends, we would use this to respect that setting, not add a 'mkdocs_enable_epub_build' option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to keep this PR as is, and address the naming stuff in a v2 where we move it into a completely separate model, or into a YAML file, as well, if it's a lot of work to rename all this stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's really straightforward to rename the field again. It should be a simple search&replace. I will do so on Thursday.