From 45ca70f674f28c6861a0b7651c73e22499937799 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 25 Sep 2015 22:10:04 +0200 Subject: [PATCH] setup.py: prevent errors in compile_translations to mess with the current working directory --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 2ead823..568bc5f 100644 --- a/setup.py +++ b/setup.py @@ -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 = {