setup: get back to correct directory if compilemessages fails

This commit is contained in:
Frédéric Péters 2019-11-12 18:54:10 +01:00
parent dd08e622e7
commit e14dcc0e72
1 changed files with 4 additions and 2 deletions

View File

@ -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):