mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-05-19 15:11:52 +00:00
Remove translations automation in setup.py. Fixes GH-178, GH-179.
This commit is contained in:
parent
ab4a2b4ce4
commit
b2149c8e73
2 changed files with 7 additions and 49 deletions
|
|
@ -4,6 +4,9 @@ CHANGES
|
||||||
master (unreleased)
|
master (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* Remove all translation-related automation in `setup.py`. Fixes GH-178 and
|
||||||
|
GH-179. Thanks Joe Weiss, Matt Molyneaux, and others for the reports.
|
||||||
|
|
||||||
|
|
||||||
2.3 (2015.07.17)
|
2.3 (2015.07.17)
|
||||||
----------------
|
----------------
|
||||||
|
|
|
||||||
53
setup.py
53
setup.py
|
|
@ -1,8 +1,5 @@
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from setuptools.command.install_lib import install_lib as _install_lib
|
|
||||||
from distutils.command.build import build as _build
|
|
||||||
from distutils.cmd import Command
|
|
||||||
|
|
||||||
|
|
||||||
long_description = (open('README.rst').read() +
|
long_description = (open('README.rst').read() +
|
||||||
|
|
@ -16,47 +13,6 @@ def get_version():
|
||||||
if line.startswith('__version__ ='):
|
if line.startswith('__version__ ='):
|
||||||
return line.split('=')[1].strip().strip('"\'')
|
return line.split('=')[1].strip().strip('"\'')
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-model-utils',
|
name='django-model-utils',
|
||||||
version=get_version(),
|
version=get_version(),
|
||||||
|
|
@ -84,10 +40,9 @@ setup(
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
tests_require=["Django>=1.4.2"],
|
tests_require=["Django>=1.4.2"],
|
||||||
test_suite='runtests.runtests',
|
test_suite='runtests.runtests',
|
||||||
setup_requires=['Django>=1.4.2'],
|
package_data={
|
||||||
package_data = {
|
'model_utils': [
|
||||||
'model_utils': ['locale/*/LC_MESSAGES/django.po','locale/*/LC_MESSAGES/django.mo'],
|
'locale/*/LC_MESSAGES/django.po','locale/*/LC_MESSAGES/django.mo'
|
||||||
|
],
|
||||||
},
|
},
|
||||||
cmdclass={'build': build, 'install_lib': install_lib,
|
|
||||||
'compile_translations': compile_translations}
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue