From e2edb57a99031222840d8e77336e28e3acbbbcc6 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Tue, 5 Jan 2016 14:19:29 +0100 Subject: [PATCH] setup.py: fix locales compilation --- setup.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 7802efe..01d3c3b 100644 --- a/setup.py +++ b/setup.py @@ -25,15 +25,20 @@ class compile_translations(Command): pass def run(self): - from django.core.management.commands.compilemessages import \ - compile_messages - for path in ['src']: - if not os.path.exists(os.path.join(path, 'locale')): - continue - curdir = os.getcwd() - os.chdir(os.path.realpath(path)) - compile_messages(sys.stderr) - os.chdir(curdir) + try: + from django.core.management import call_command + for path in ['src']: + if not os.path.exists(os.path.join(path, 'locale')): + continue + curdir = os.getcwd() + os.chdir(os.path.realpath(path)) + call_command('compilemessages') + os.chdir(curdir) + except ImportError: + print + sys.stderr.write('!!! Please install Django >= 1.4 to build translations') + print + print class build(_build):