Permalink
Browse files

so much flake8

  • Loading branch information...
1 parent 825324c commit 1c0dfc5efa18dc1d0abec7cb0b04cff1ae9a0a1e @wraithan wraithan committed Apr 7, 2013
Showing with 1,097 additions and 783 deletions.
  1. +15 −9 deploy/fab/fabfile.py
  2. +5 −1 deploy/fabfile.py
  3. +3 −3 docs/_ext/djangodocs.py
  4. +15 −12 docs/conf.py
  5. +13 −4 fabfile-development.py
  6. +28 −6 fabfile.py
  7. +1 −0 readthedocs/bookmarks/admin.py
  8. +6 −3 readthedocs/bookmarks/models.py
  9. +10 −8 readthedocs/bookmarks/urls.py
  10. +4 −0 readthedocs/bookmarks/views.py
  11. +1 −0 readthedocs/core/admin.py
  12. +1 −0 readthedocs/core/context_processors.py
  13. +12 −12 readthedocs/core/djangome_urls.py
  14. +6 −6 readthedocs/core/forms.py
  15. +2 −0 readthedocs/core/hacks.py
  16. +7 −11 readthedocs/core/management/commands/build_files.py
  17. +0 −2 readthedocs/core/management/commands/import_intersphinx.py
  18. +9 −10 readthedocs/core/management/commands/sync_builds.py
  19. +19 −23 readthedocs/core/management/commands/update_repos.py
  20. +6 −7 readthedocs/core/management/commands/update_versions.py
  21. +8 −5 readthedocs/core/middleware.py
  22. +12 −5 readthedocs/core/models.py
  23. +2 −1 readthedocs/core/search_sites.py
  24. +17 −14 readthedocs/core/subdomain_urls.py
  25. +8 −5 readthedocs/core/templatetags/core_tags.py
  26. +11 −6 readthedocs/core/underscore_middleware.py
  27. +9 −4 readthedocs/core/utils.py
  28. +93 −59 readthedocs/core/views.py
  29. +31 −18 readthedocs/djangome/views.py
  30. +5 −1 readthedocs/projects/admin.py
  31. +1 −1 readthedocs/projects/exceptions.py
  32. +2 −0 readthedocs/projects/feeds.py
  33. +7 −3 readthedocs/projects/filters.py
  34. +37 −15 readthedocs/projects/forms.py
  35. +152 −124 readthedocs/projects/models.py
  36. +12 −5 readthedocs/projects/search_indexes.py
  37. +117 −70 readthedocs/projects/tasks.py
  38. +4 −1 readthedocs/projects/templatetags/projects_tags.py
  39. +45 −44 readthedocs/projects/urls/private.py
  40. +23 −22 readthedocs/projects/urls/public.py
  41. +24 −10 readthedocs/projects/utils.py
  42. +52 −18 readthedocs/projects/views/private.py
  43. +19 −12 readthedocs/projects/views/public.py
  44. +15 −13 readthedocs/rtd_tests/fixtures/sample_repo/source/conf.py
  45. +11 −11 readthedocs/rtd_tests/tests/__init__.py
  46. +1 −0 readthedocs/rtd_tests/tests/base.py
  47. +49 −50 readthedocs/rtd_tests/tests/test_api.py
  48. +2 −2 readthedocs/rtd_tests/tests/test_backend.py
  49. +1 −0 readthedocs/rtd_tests/tests/test_hacks.py
  50. +10 −11 readthedocs/rtd_tests/tests/test_middlware.py
  51. +13 −10 readthedocs/rtd_tests/tests/test_post_commit_hooks.py
  52. +55 −56 readthedocs/rtd_tests/tests/test_privacy.py
  53. +29 −16 readthedocs/rtd_tests/tests/test_redirects.py
  54. +1 −0 readthedocs/rtd_tests/tests/test_urls.py
  55. +15 −19 readthedocs/rtd_tests/tests/view_tests.py
  56. +1 −1 readthedocs/settings/base.py
  57. +1 −1 readthedocs/tastyapi/__init__.py
  58. +8 −3 readthedocs/tastyapi/client.py
  59. +31 −30 readthedocs/urls.py
View
@@ -1,12 +1,13 @@
import os
-from fabric.api import *
+from fabric.api import cd, env, put, run, sudo
import fabtools
cwd = os.getcwd()
all_users = ['docs', 'builder']
required_dirs = ['checkouts', 'etc', 'run', 'log']
+
def all():
install_packages('build')
install_packages('web')
@@ -15,12 +16,14 @@ def all():
checkout('docs')
setup_env('docs')
+
def build():
install_packages('build')
users('docs')
checkout('docs')
setup_env('docs')
+
def web():
install_packages('web')
users('docs')
@@ -42,9 +45,9 @@ def install_packages(type):
sudo(
'apt-get install -y git-core python-dev '
'postgresql-client libpq-dev subversion graphviz '
- 'curl sqlite libxml2-dev libxslt-dev vim g++ python-numpy python-scipy '
- 'build-essential texlive-full libevent-dev libmysqlclient-dev '
- 'python-m2crypto'
+ 'curl sqlite libxml2-dev libxslt-dev vim g++ python-numpy '
+ 'python-scipy build-essential texlive-full libevent-dev '
+ 'libmysqlclient-dev python-m2crypto'
)
sudo('pip install -U mercurial')
if type == 'db':
@@ -53,7 +56,6 @@ def install_packages(type):
sudo('apt-get install -y nginx')
-
def users(user=None):
if user:
users = [user]
@@ -66,7 +68,8 @@ def users(user=None):
if not fabtools.files.is_file('%s/.ssh/authorized_keys' % home):
sudo('mkdir -p %s/.ssh' % home)
- put('keys/*.pub', '%s/.ssh/authorized_keys' % home, mode=700, use_sudo=True)
+ put('keys/*.pub', '%s/.ssh/authorized_keys' % home, mode=700,
+ use_sudo=True)
sudo('chown -R %s:%s %s' % (user, user, home))
sudo('chmod -R 700 %s' % home)
sudo('mkdir -p /var/build')
@@ -90,7 +93,8 @@ def checkout(user=None):
run('git clone git://github.com/rtfd/readthedocs.org.git')
if not fabtools.files.is_file('%s/bin/python' % home):
run('virtualenv %s' % home)
- run('%s/bin/pip install -U -r %s/checkouts/readthedocs.org/deploy_requirements.txt' % (home, home))
+ run(('%s/bin/pip install -U -r %s/checkouts/readthedocs.org/'
+ 'deploy_requirements.txt') % (home, home))
def setup_env(user=None):
@@ -102,10 +106,11 @@ def setup_env(user=None):
env.user = user
home = '/home/%s' % user
put('files/bash_profile', '%s/.bash_profile' % home)
- put('files/%s_supervisord.conf' % user, '%s/etc/supervisord.conf' % home)
- #put('files/%s_local_settings.py' % user, '%s/checkouts/readthedocs.org/readthedocs/settings/local_settings.py' % home)
+ put('files/%s_supervisord.conf' % user,
+ '%s/etc/supervisord.conf' % home)
run('%s/bin/pip install -U supervisor ipython gunicorn' % home)
+
def fix_perms(user=None):
if user:
users = [user]
@@ -116,6 +121,7 @@ def fix_perms(user=None):
home = '/home/%s' % user
sudo('chown -R %s:%s %s' % (user, user, home))
+
def setup_db():
env.user = "docs"
home = '/home/%s' % env.user
View
@@ -11,23 +11,27 @@
def install_chef():
sudo('apt-get update', pty=True)
- sudo('apt-get install -y git-core libopenssl-ruby rubygems ruby ruby-dev', pty=True)
+ sudo('apt-get install -y git-core libopenssl-ruby rubygems ruby ruby-dev',
+ pty=True)
#sudo('gem install chef --no-ri --no-rdoc', pty=True)
sudo('gem install chef --no-ri --no-rdoc --version=0.10.2', pty=True)
def sync_config():
local('rsync -av . %s@%s:/etc/chef' % (env.user, env.hosts[0]))
+
def update():
sync_config()
sudo('cd /etc/chef && %s' % env.chef_executable, pty=True)
+
def reload():
"Reload the server."
env.user = "docs"
run("kill -HUP `cat %s/gunicorn.pid`" % env.rundir, pty=True)
+
def restart():
"Restart (or just start) the server"
sudo('restart readthedocs-gunicorn', pty=True)
@@ -1,6 +1,6 @@
def setup(app):
app.add_crossref_type(
- directivename = "setting",
- rolename = "setting",
- indextemplate = "pair: %s; setting",
+ directivename="setting",
+ rolename="setting",
+ indextemplate="pair: %s; setting",
)
View
@@ -1,18 +1,21 @@
# -*- coding: utf-8 -*-
#
-import sys, os
+import os
+import sys
+
sys.path.insert(0, os.path.abspath('../readthedocs'))
import settings.sqlite
from django.core.management import setup_environ
setup_environ(settings.sqlite)
+
sys.path.append(os.path.abspath('_ext'))
extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.intersphinx',
- 'sphinx_http_domain',
- 'djangodocs',
- ]
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.intersphinx',
+ 'sphinx_http_domain',
+ 'djangodocs',
+]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
@@ -24,10 +27,10 @@
default_role = 'obj'
pygments_style = 'sphinx'
intersphinx_mapping = {
- 'python': ('http://python.readthedocs.org/en/latest/', None),
- 'django': ('http://django.readthedocs.org/en/latest/', None),
- 'sphinx': ('http://sphinx.readthedocs.org/en/latest/', None),
- }
+ 'python': ('http://python.readthedocs.org/en/latest/', None),
+ 'django': ('http://django.readthedocs.org/en/latest/', None),
+ 'sphinx': ('http://sphinx.readthedocs.org/en/latest/', None),
+}
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
html_theme = 'default'
@@ -36,8 +39,8 @@
html_static_path = ['_static']
htmlhelp_basename = 'ReadTheDocsdoc'
latex_documents = [
- ('index', 'ReadTheDocs.tex', u'Read The Docs Documentation',
- u'Eric Holscher, Charlie Leifer, Bobby Grace', 'manual'),
+ ('index', 'ReadTheDocs.tex', u'Read The Docs Documentation',
+ u'Eric Holscher, Charlie Leifer, Bobby Grace', 'manual'),
]
man_pages = [
('index', 'read-the-docs', u'Read The Docs Documentation',
@@ -1,4 +1,4 @@
-from fabric.api import *
+from fabric.api import cd, env, prefix, run, sudo, task
# Fill out USER and HOSTS configuration before running
env.user = ''
@@ -7,37 +7,45 @@
env.code_dir = '/home/%s/rtd/checkouts/readthedocs.org' % (env.user)
env.virtualenv = '/home/%s/rtd' % (env.user)
+
def install_prerequisites():
"""Install prerequisites."""
- sudo("apt-get -y install python-dev python-pip git redis-server texlive texlive-latex-extra")
+ sudo("apt-get -y install python-dev python-pip git redis-server texlive "
+ "texlive-latex-extra")
sudo("pip install virtualenv")
+
def create_virtualenv():
"""Create virtualenv."""
run("virtualenv --no-site-packages --distribute rtd")
+
def clone_repository():
"""Clone readthedocs repo"""
run("mkdir %s/checkouts" % (env.virtualenv))
with cd("%s/checkouts" % env.virtualenv):
run("git clone http://github.com/rtfd/readthedocs.org.git")
+
def pip_requirements():
"""Install pip requirements"""
with cd(env.code_dir):
with prefix("source %s/bin/activate" % (env.virtualenv)):
run("pip install -r pip_requirements.txt")
+
def build_db():
"""Build database"""
with prefix("source %s/bin/activate" % (env.virtualenv)):
run("%s/readthedocs/manage.py syncdb" % (env.code_dir))
+
def migrate_db():
"""Migrate database"""
with prefix("source %s/bin/activate" % (env.virtualenv)):
run("%s/readthedocs/manage.py migrate" % (env.code_dir))
+
def load_testprojects():
"""Load test data and update repos"""
with prefix("source %s/bin/activate" % (env.virtualenv)):
@@ -56,11 +64,12 @@ def install():
migrate_db()
load_testprojects()
+
@task
def clean():
"""Clean up everything to start over"""
sudo("rm -rf %s" % (env.virtualenv))
sudo("pip uninstall virtualenv")
- sudo("apt-get -y purge python-dev python-pip git redis-server texlive texlive-latex-extra")
+ sudo("apt-get -y purge python-dev python-pip git redis-server texlive "
+ "texlive-latex-extra")
sudo("apt-get -y autoremove --purge")
-
Oops, something went wrong. Retry.

0 comments on commit 1c0dfc5

Please sign in to comment.