From e14dcc0e72c5f34f6008f724a7e2ebcf599e6ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 12 Nov 2019 18:54:10 +0100 Subject: [PATCH] setup: get back to correct directory if compilemessages fails --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e54ab2b8..0edaf1f1 100644 --- a/setup.py +++ b/setup.py @@ -40,8 +40,8 @@ def get_version(): stdout=subprocess.PIPE, stderr=subprocess.PIPE) result = p.communicate()[0] if p.returncode == 0: - result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v - if '-' in result: # not a tagged version + result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v + if '-' in result: # not a tagged version real_number, commit_count, commit_hash = result.split('-', 2) version = '%s.post%s+%s' % (real_number, commit_count, commit_hash) else: @@ -72,6 +72,7 @@ class compile_translations(Command): pass def run(self): + orig_dir = os.getcwd() try: from django.core.management import call_command for path, dirs, files in os.walk('combo'): @@ -83,6 +84,7 @@ class compile_translations(Command): os.chdir(curdir) except ImportError: sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n') + os.chdir(orig_dir) class compile_scss(Command):