setup.py: prevent errors in compile_translations to mess with the current working directory

This commit is contained in:
Benjamin Dauvergne 2015-09-25 22:10:04 +02:00
parent f18706c051
commit 45ca70f674
1 changed files with 4 additions and 4 deletions

View File

@ -15,8 +15,6 @@ from distutils.command.build import build as _build
from distutils.command.sdist import sdist
from setuptools import setup, find_packages
BASE_DIR = os.path.dirname(__file__)
class eo_sdist(sdist):
def run(self):
@ -63,17 +61,19 @@ class compile_translations(Command):
pass
def run(self):
curdir = os.getcwd()
try:
from django.core.management import call_command
for path, dirs, files in os.walk('gadjo'):
if 'locale' not in dirs:
continue
curdir = os.getcwd()
os.chdir(os.path.realpath(path))
call_command('compilemessages')
os.chdir(curdir)
except ImportError:
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
finally:
os.chdir(curdir)
class build_icons(Command):
@ -87,7 +87,7 @@ class build_icons(Command):
pass
def run(self):
destpath = os.path.join(BASE_DIR, 'gadjo/static/css/icons/')
destpath = 'gadjo/static/css/icons/'
if not os.path.exists(destpath):
os.mkdir(destpath)
variants = {