setup.py: failed call_command import fix

This commit is contained in:
Serghei Mihai 2015-04-07 16:01:59 +02:00
parent f35dbb9e83
commit daf11883ed
1 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,8 @@
''' Setup script for cmsplugin-blurp
'''
import sys
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
@ -22,12 +24,17 @@ class compile_translations(Command):
def run(self):
import os
import sys
from django.core.management import call_command
for path in ['src/cmsplugin_blurp/']:
curdir = os.getcwd()
os.chdir(os.path.realpath(path))
call_command('compilemessages')
os.chdir(curdir)
try:
from django.core.management import call_command
for path in ['src/cmsplugin_blurp/']:
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.7 to build translations')
print
class build(_build):
sub_commands = [('compile_translations', None)] + _build.sub_commands