diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9da9df2e1..d80eb93f4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,7 @@ development - Easier to override. Won't conflict with customised admin styles (eg grappelli) * Drop implied 'pk' filter if last arg in urlconf is unnamed. - Too magical. Explict is better than implicit. +* Tider setup.py * Bugfixes: - Bug with PerUserThrottling when user contains unicode chars. diff --git a/MANIFEST.in b/MANIFEST.in index fc9ce9769..5c6a1c578 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ -recursive-include djangorestframework/static *.ico *.txt +recursive-include djangorestframework/static *.ico *.txt *.css recursive-include djangorestframework/templates *.txt *.html recursive-include examples .keep *.py *.txt recursive-include docs *.py *.rst *.html *.txt -include AUTHORS LICENSE requirements.txt tox.ini +include AUTHORS LICENSE CHANGELOG.rst requirements.txt tox.ini diff --git a/djangorestframework/static/css/djangorestframework.css b/djangorestframework/static/css/djangorestframework.css index 8fc4bace5..1e75b8e81 100644 --- a/djangorestframework/static/css/djangorestframework.css +++ b/djangorestframework/static/css/djangorestframework.css @@ -1129,6 +1129,58 @@ fieldset.monospace textarea { float: right; } +body.login { + background: #eee; +} + +.login #container { + background: white; + border: 1px solid #ccc; + width: 28em; + min-width: 300px; + margin-left: auto; + margin-right: auto; + margin-top: 100px; +} + +.login #content-main { + width: 100%; +} + +.login form { + margin-top: 1em; +} + +.login .form-row { + padding: 4px 0; + float: left; + width: 100%; +} + +.login .form-row label { + float: left; + width: 9em; + padding-right: 0.5em; + line-height: 2em; + text-align: right; + font-size: 1em; + color: #333; +} + +.login .form-row #id_username, .login .form-row #id_password { + width: 14em; +} + +.login span.help { + font-size: 10px; + display: block; +} + +.login .submit-row { + clear: both; + padding: 1em 0 0 9.4em; +} + /* Overrides specific to REST framework */ #site-name a { @@ -1147,6 +1199,11 @@ fieldset.monospace textarea { } /* Custom styles */ + .version { font-size: 8px; } + +.form-row { + border-bottom: 0.25em !important; +} diff --git a/djangorestframework/templates/api_login.html b/djangorestframework/templates/api_login.html index 750f898bb..016a4e109 100644 --- a/djangorestframework/templates/api_login.html +++ b/djangorestframework/templates/api_login.html @@ -1,54 +1,44 @@ +{% load static %} - - {% if ADMIN_MEDIA_PREFIX %} - - - - {% else %} - - - - {% endif %} - - - -
- - + diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 690a7e0fd..919806297 --- a/setup.py +++ b/setup.py @@ -1,33 +1,70 @@ -#!/usr/bin/env/python +#!/usr/bin/env python # -*- coding: utf-8 -*- -from setuptools import setup +from distutils.core import setup +import re +import os +import sys -import os, re -path = os.path.join(os.path.dirname(__file__), 'djangorestframework', '__init__.py') -init_py = open(path).read() -VERSION = re.match("__version__ = '([^']+)'", init_py).group(1) +def get_version(package): + """ + Return package version as listed in `__version__` in `init.py`. + """ + init_py = open(os.path.join(package, '__init__.py')).read() + return re.match("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) + + +def get_packages(package): + """ + Return root package and all sub-packages. + """ + return [dirpath + for dirpath, dirnames, filenames in os.walk(package) + if os.path.exists(os.path.join(dirpath, '__init__.py'))] + + +def get_package_data(package): + """ + Return all files under the root package, that are not in a + package themselves. + """ + walk = [(dirpath.replace(package + os.sep, '', 1), filenames) + for dirpath, dirnames, filenames in os.walk(package) + if not os.path.exists(os.path.join(dirpath, '__init__.py'))] + + filepaths = [] + for base, filenames in walk: + filepaths.extend([os.path.join(base, filename) + for filename in filenames]) + return {package: filepaths} + + +version = get_version('djangorestframework') + + +if sys.argv[-1] == 'publish': + os.system("python setup.py sdist upload") + print "You probably want to also tag the version now:" + print " git tag -a %s -m 'version %s'" % (version, version) + print " git push --tags" + sys.exit() + setup( - name = 'djangorestframework', - version = VERSION, - url = 'http://django-rest-framework.org', - download_url = 'http://pypi.python.org/pypi/djangorestframework/', - license = 'BSD', - description = 'A lightweight REST framework for Django.', - author = 'Tom Christie', - author_email = 'tom@tomchristie.com', - packages = ['djangorestframework', - 'djangorestframework.templatetags', - 'djangorestframework.tests', - 'djangorestframework.runtests', - 'djangorestframework.utils'], - package_dir={'djangorestframework': 'djangorestframework'}, - package_data = {'djangorestframework': ['templates/*', 'static/*']}, - test_suite = 'djangorestframework.runtests.runcoverage.main', + name='djangorestframework', + version=version, + url='http://django-rest-framework.org', + download_url='http://pypi.python.org/pypi/djangorestframework/', + license='BSD', + description='A lightweight REST framework for Django.', + author='Tom Christie', + author_email='tom@tomchristie.com', + packages=get_packages('djangorestframework'), + package_data=get_package_data('djangorestframework'), + test_suite='djangorestframework.runtests.runcoverage.main', install_requires=['URLObject>=0.6.0'], - classifiers = [ + classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django',