From: Bradley Ayers Date: Mon, 21 Mar 2011 06:30:59 +0000 (+1000) Subject: simplified setup.py X-Git-Tag: v0.4.0.alpha4^2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3a3c8fe8cd783ac08d5e06b4b3021cf611beb7e3;p=django-tables2.git simplified setup.py --- diff --git a/.gitignore b/.gitignore index 53b958f..5ce8003 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.pyc /*.komodoproject +/*.egg-info/ /MANIFEST /dist/ /build/ /docs/_build/ -/django_tables.egg-info/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..de73873 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include README.rst +recursive-include django_tables/templates * diff --git a/django_tables/__init__.py b/django_tables/__init__.py index 38774d1..1b1fad5 100644 --- a/django_tables/__init__.py +++ b/django_tables/__init__.py @@ -1,43 +1,2 @@ -# -*- coding: utf8 -*- -# (major, minor, bugfix, "pre-alpha" | "alpha" | "beta" | "final", release | 0) -VERSION = (0, 4, 0, 'alpha', 1) - - -def get_version(): - version = '%s.%s' % (VERSION[0], VERSION[1]) - if VERSION[2]: - version = '%s.%s' % (version, VERSION[2]) - if VERSION[3:] == ('alpha', 0): - version = '%s pre-alpha' % version - else: - if VERSION[3] != 'final': - version = '%s %s %s' % (version, VERSION[3], VERSION[4]) - return version - - -# We want to make get_version() available to setup.py even if Django is not -# available or we are not inside a Django project. -try: - import django -except ImportError: - import warnings - warnings.warn('django-tables requires Django, however it is not installed.' - ' Version information will still be available.') -else: - try: - # http://docs.djangoproject.com/en/dev/topics/settings/ says:: - # - # If you don't set DJANGO_SETTINGS_MODULE and don't call configure(), - # Django will raise an ImportError exception the first time a setting is - # accessed. - # - from django.conf import settings - settings.DEBUG # will raise ImportError if Django isn't configured - except ImportError: - # allow get_version() to remain available - import warnings - warnings.warn('django-tables requires Django to be configured... but ' - "it isn't! A bunch of stuff won't work :(") - - from tables import * - from columns import * +from .tables import * +from .columns import * diff --git a/setup.py b/setup.py index ba5d8f7..f1cd288 100755 --- a/setup.py +++ b/setup.py @@ -1,82 +1,23 @@ -# -*- coding: utf8 -*- -try: - from setuptools import setup -except ImportError: - from distutils.core import setup -from distutils.command.install_data import install_data -from distutils.command.install import INSTALL_SCHEMES -import os -import sys +#!/usr/bin/env python +from setuptools import setup, find_packages -class osx_install_data(install_data): - # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ - # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix - # for this in distutils.command.install_data#306. It fixes install_lib but not - # install_data, which is why we roll our own install_data class. - def finalize_options(self): - # By the time finalize_options is called, install.install_lib is set to the - # fixed directory, so we set the installdir to install_lib. The - # install_data class uses ('install_data', 'install_dir') instead. - self.set_undefined_options('install', ('install_lib', 'install_dir')) - install_data.finalize_options(self) - -if sys.platform == "darwin": - cmdclasses = {'install_data': osx_install_data} -else: - cmdclasses = {'install_data': install_data} - -def fullsplit(path, result=None): - """ - Split a pathname into components (the opposite of os.path.join) in a - platform-neutral way. - """ - if result is None: - result = [] - head, tail = os.path.split(path) - if head == '': - return [tail] + result - if head == path: - return result - return fullsplit(head, [tail] + result) - -# Tell distutils to put the data_files in platform-specific installation -# locations. See here for an explanation: -# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb -for scheme in INSTALL_SCHEMES.values(): - scheme['data'] = scheme['purelib'] +setup( + name='django-tables', + version='0.4.0.alpha2.dev', + description='Table framework for Django', -# Compile the list of packages available, because distutils doesn't have -# an easy way to do this. -packages, data_files = [], [] -root_dir = os.path.dirname(__file__) -if root_dir != '': - os.chdir(root_dir) -package_dir = 'django_tables' + author='Bradley Ayers', + author_email='bradley.ayers@gmail.com', + license='Simplified BSD', + url='https://github.com/bradleyayers/django-tables/', -for dirpath, dirnames, filenames in os.walk(package_dir): - # Ignore dirnames that start with '.' - for i, dirname in enumerate(dirnames): - if dirname.startswith('.'): del dirnames[i] - if '__init__.py' in filenames: - packages.append('.'.join(fullsplit(dirpath))) - elif filenames: - data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) + packages=find_packages(), + include_package_data=True, # declarations in MANIFEST.in -# Small hack for working with bdist_wininst. -# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html -if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst': - for file_info in data_files: - file_info[0] = '\\PURELIB\\%s' % file_info[0] + install_requires=['Django >=1.1'], -setup( - name = 'django-tables', - version = __import__(package_dir).get_version().replace(' ', '-'), - description = 'Table framework for Django', - author = 'Bradley Ayers', - author_email = 'bradley.ayers@gmail.com', - url = '', - classifiers = [ + classifiers=[ 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', @@ -86,9 +27,4 @@ setup( 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Libraries', ], - packages = packages, - data_files = data_files, - cmdclass = cmdclasses, - requires = ['Django(>=1.1)'], - install_requires = ['Django>=1.1'] )