From da03c6769fcfa54b1bc894f95741681028ac717f Mon Sep 17 00:00:00 2001 From: Daniel Greenfeld Date: Fri, 17 May 2013 12:59:38 +0200 Subject: [PATCH] fix djangorestframework dependency --- admin2/__init__.py | 14 ++++------ setup.py | 64 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/admin2/__init__.py b/admin2/__init__.py index 3edb039..39f864f 100644 --- a/admin2/__init__.py +++ b/admin2/__init__.py @@ -1,12 +1,8 @@ +__version__ = '0.1.1' + __author__ = 'Daniel Greenfeld' -VERSION = (0, 1, 0) +VERSION = __version__ # synonym - -def get_version(): - version = '%s.%s' % (VERSION[0], VERSION[1]) - if VERSION[2]: - version = '%s.%s' % (version, VERSION[2]) - return version - -__version__ = get_version() +# Default datetime input and output formats +ISO_8601 = 'iso-8601' diff --git a/setup.py b/setup.py index dc1b19e..1876ccd 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,54 @@ -from setuptools import setup, find_packages +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from setuptools import setup +import re +import os +import sys + + +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('admin2') + + +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() import admin2 @@ -6,7 +56,7 @@ LONG_DESCRIPTION = open('README.rst').read() setup( name='django-admin2', - version=admin2.__version__, + version=version, description="An introspective interface for Django's ORM.", long_description=LONG_DESCRIPTION, classifiers=[ @@ -27,12 +77,18 @@ setup( author_email='pydanny@gmail.com', url='http://github.com/pydanny/django-admin2', license='MIT', - packages=find_packages(), + packages=get_packages('admin2'), include_package_data=True, install_requires=[ 'django>=1.5.0', 'django-braces==1.0.0', - 'django-rest-framework==2.3' + 'djangorestframework==2.3.3' ], zip_safe=False, ) + +# (*) Please direct queries to Github issue list, rather than to me directly +# Doing so helps ensure your question is helpful to other users. +# Queries directly to my email are likely to receive a canned response. +# +# Many thanks for your understanding.