From 7b671648e18dac99f21dccb2232d89fc88069f6e Mon Sep 17 00:00:00 2001 From: arthur Date: Sat, 20 Feb 2016 15:40:44 +0100 Subject: [PATCH] Update against latest pinax-starter-app standards Latest standard taken directly from pinax-starter-app. Closes #8 --- .gitignore | 1 + .travis.yml | 6 ++- makemigrations.py | 48 +++++++++++++++++ pinax/comments/__init__.py | 1 + pinax/comments/apps.py | 11 ++++ pinax/comments/migrations/__init__.py | 0 setup.cfg | 2 + tox.ini | 76 +++++---------------------- 8 files changed, 80 insertions(+), 65 deletions(-) create mode 100644 makemigrations.py create mode 100644 pinax/comments/apps.py create mode 100644 pinax/comments/migrations/__init__.py create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 544df4f..b7baf4d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ build dist .coverage .tox +.idea MANIFEST *.pyc *.egg-info diff --git a/.travis.yml b/.travis.yml index 3e045a2..90ac1ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: python python: - "2.7" @@ -7,15 +8,16 @@ python: env: - DJANGO=1.7 - DJANGO=1.8 + - DJANGO=1.9 - DJANGO=master matrix: exclude: + - python: "3.3" + env: DJANGO=1.9 - python: "3.3" env: DJANGO=master - python: "3.5" env: DJANGO=1.7 - - python: "3.5" - env: DJANGO=1.8 install: - pip install tox coveralls script: diff --git a/makemigrations.py b/makemigrations.py new file mode 100644 index 0000000..4200c25 --- /dev/null +++ b/makemigrations.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +import os +import sys + +import django + +from django.conf import settings + + +DEFAULT_SETTINGS = dict( + INSTALLED_APPS=[ + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sites", + "pinax.comments", + "pinax.comments.tests" + ], + MIDDLEWARE_CLASSES=[], + DATABASES={ + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + } + }, + SITE_ID=1, + ROOT_URLCONF="pinax.comments.tests.urls", + SECRET_KEY="notasecret", +) + + +def run(*args): + if not settings.configured: + settings.configure(**DEFAULT_SETTINGS) + + django.setup() + + parent = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, parent) + + django.core.management.call_command( + "makemigrations", + "pinax_comments", + *args + ) + + +if __name__ == "__main__": + run(*sys.argv[1:]) diff --git a/pinax/comments/__init__.py b/pinax/comments/__init__.py index 086899d..a122c7c 100644 --- a/pinax/comments/__init__.py +++ b/pinax/comments/__init__.py @@ -1,4 +1,5 @@ import pkg_resources +default_app_config = "pinax.comments.apps.AppConfig" __version__ = pkg_resources.get_distribution("pinax-comments").version diff --git a/pinax/comments/apps.py b/pinax/comments/apps.py new file mode 100644 index 0000000..f85c294 --- /dev/null +++ b/pinax/comments/apps.py @@ -0,0 +1,11 @@ +import importlib + +from django.apps import AppConfig as BaseAppConfig +from django.utils.translation import ugettext_lazy as _ + + +class AppConfig(BaseAppConfig): + + name = "pinax.comments" + label = "pinax_comments" + verbose_name = _("Pinax Comments") diff --git a/pinax/comments/migrations/__init__.py b/pinax/comments/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/tox.ini b/tox.ini index ddb9081..bf58937 100644 --- a/tox.ini +++ b/tox.ini @@ -2,78 +2,28 @@ ignore = E265,E501 max-line-length = 100 max-complexity = 10 +exclude = migrations/*,docs/* [tox] envlist = - py27-1.7, py27-1.8, py27-master, - py33-1.7, py33-1.8, - py34-1.7, py34-1.8, py34-master, - py35-master, + py27-{1.7,1.8,1.9,master}, + py33-{1.7,1.8}, + py34-{1.7,1.8,1.9,master}, + py35-{1.8,1.9,master} [testenv] deps = - flake8 == 2.4.1 - coverage == 3.7.1 + coverage == 4.0.2 + flake8 == 2.5.0 + 1.7: Django>=1.7,<1.8 + 1.8: Django>=1.8,<1.9 + 1.9: Django>=1.9,<1.10 + master: https://github.com/django/django/tarball/master usedevelop = True setenv = LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 commands = - coverage run setup.py test - coverage report -m - flake8 pinax - -[testenv:py27-1.7] -basepython = python2.7 -deps = - {[testenv]deps} - Django<1.8 - -[testenv:py27-1.8] -basepython = python2.7 -deps = - {[testenv]deps} - Django<1.9 - -[testenv:py27-master] -basepython = python2.7 -deps = - {[testenv]deps} - https://github.com/django/django/tarball/master - -[testenv:py33-1.7] -basepython = python3.3 -deps = - {[testenv]deps} - Django<1.8 - -[testenv:py33-1.8] -basepython = python3.3 -deps = - {[testenv]deps} - Django<1.9 - -[testenv:py34-1.7] -basepython = python3.4 -deps = - {[testenv]deps} - Django<1.8 - -[testenv:py34-1.8] -basepython = python3.4 -deps = - {[testenv]deps} - Django<1.9 - -[testenv:py34-master] -basepython = python3.4 -deps = - {[testenv]deps} - https://github.com/django/django/tarball/master - -[testenv:py35-master] -basepython = python3.5 -deps = - {[testenv]deps} - https://github.com/django/django/tarball/master + flake8 pinax + coverage run setup.py test