2013-08-07 08:07:31 +00:00
|
|
|
from os.path import join
|
2009-07-02 18:03:02 +00:00
|
|
|
from setuptools import setup, find_packages
|
2015-07-01 12:16:03 +00:00
|
|
|
from setuptools.command.install_lib import install_lib as _install_lib
|
|
|
|
|
from distutils.command.build import build as _build
|
|
|
|
|
from distutils.cmd import Command
|
2010-01-07 04:48:44 +00:00
|
|
|
|
2013-01-27 22:54:29 +00:00
|
|
|
|
|
|
|
|
long_description = (open('README.rst').read() +
|
2010-01-28 21:03:55 +00:00
|
|
|
open('CHANGES.rst').read() +
|
|
|
|
|
open('TODO.rst').read())
|
2010-01-07 04:48:44 +00:00
|
|
|
|
2013-01-27 22:54:29 +00:00
|
|
|
|
2013-08-07 08:07:31 +00:00
|
|
|
def get_version():
|
|
|
|
|
with open(join('model_utils', '__init__.py')) as f:
|
|
|
|
|
for line in f:
|
|
|
|
|
if line.startswith('__version__ ='):
|
|
|
|
|
return line.split('=')[1].strip().strip('"\'')
|
|
|
|
|
|
|
|
|
|
|
2015-07-01 12:16:03 +00:00
|
|
|
class compile_translations(Command):
|
|
|
|
|
"""command tries to compile messages via django compilemessages, does not
|
|
|
|
|
interrupt setup if gettext is not installed"""
|
|
|
|
|
|
|
|
|
|
description = 'compile message catalogs to MO files via django compilemessages'
|
|
|
|
|
user_options = []
|
|
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
from django.core.management import execute_from_command_line, CommandError
|
|
|
|
|
|
|
|
|
|
curdir = os.getcwd()
|
|
|
|
|
os.chdir(os.path.realpath('model_utils'))
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
execute_from_command_line(['django-admin', 'compilemessages'])
|
|
|
|
|
except CommandError:
|
|
|
|
|
# raised if gettext pkg is not installed
|
|
|
|
|
pass
|
|
|
|
|
finally:
|
|
|
|
|
os.chdir(curdir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class build(_build):
|
|
|
|
|
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class install_lib(_install_lib):
|
|
|
|
|
def run(self):
|
|
|
|
|
self.run_command('compile_translations')
|
|
|
|
|
_install_lib.run(self)
|
|
|
|
|
|
2009-07-02 18:03:02 +00:00
|
|
|
setup(
|
|
|
|
|
name='django-model-utils',
|
2013-08-07 08:07:31 +00:00
|
|
|
version=get_version(),
|
2009-07-02 18:03:02 +00:00
|
|
|
description='Django model mixins and utilities',
|
2010-01-07 04:48:44 +00:00
|
|
|
long_description=long_description,
|
2009-07-02 18:03:02 +00:00
|
|
|
author='Carl Meyer',
|
2013-03-28 02:59:19 +00:00
|
|
|
author_email='carl@oddbird.net',
|
|
|
|
|
url='https://github.com/carljm/django-model-utils/',
|
2009-07-02 18:03:02 +00:00
|
|
|
packages=find_packages(),
|
2014-02-10 21:30:49 +00:00
|
|
|
install_requires=['Django>=1.4.2'],
|
2009-07-02 18:03:02 +00:00
|
|
|
classifiers=[
|
2013-03-28 02:59:19 +00:00
|
|
|
'Development Status :: 5 - Production/Stable',
|
2009-07-02 18:03:02 +00:00
|
|
|
'Environment :: Web Environment',
|
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
|
'License :: OSI Approved :: BSD License',
|
|
|
|
|
'Operating System :: OS Independent',
|
|
|
|
|
'Programming Language :: Python',
|
2013-04-12 21:26:08 +00:00
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
|
'Programming Language :: Python :: 3.2',
|
|
|
|
|
'Programming Language :: Python :: 3.3',
|
2009-07-02 18:03:02 +00:00
|
|
|
'Framework :: Django',
|
|
|
|
|
],
|
|
|
|
|
zip_safe=False,
|
2013-04-26 06:42:27 +00:00
|
|
|
tests_require=["Django>=1.4.2"],
|
2015-07-01 12:16:03 +00:00
|
|
|
test_suite='runtests.runtests',
|
|
|
|
|
setup_requires=['Django>=1.4.2'],
|
|
|
|
|
package_data = {
|
|
|
|
|
'model_utils': ['locale/*/LC_MESSAGES/django.po','locale/*/LC_MESSAGES/django.mo'],
|
|
|
|
|
},
|
|
|
|
|
cmdclass={'build': build, 'install_lib': install_lib,
|
|
|
|
|
'compile_translations': compile_translations}
|
2009-07-02 18:03:02 +00:00
|
|
|
)
|