From f0115298957c5d56eec6f8ccbb0b9a7aa88d5f4f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 13 Dec 2014 12:32:32 +0530 Subject: [PATCH] Dont fail when building translations if resources/localization does not exist, which happens for people building from a git checkout instead of the source tarball --- setup/translations.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup/translations.py b/setup/translations.py index 1f12913bfc..17a93457fb 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, tempfile, shutil, subprocess, glob, re, time, textwrap, cPickle, shlex, json +import os, tempfile, shutil, subprocess, glob, re, time, textwrap, cPickle, shlex, json, errno from locale import normalize as normalize_locale from functools import partial @@ -299,6 +299,12 @@ class Translations(POT): # {{{ locale = self.mo_file(f)[0] stats[locale] = min(1.0, float(trans)/total) + base = self.d(dest) + try: + os.mkdir(base) + except EnvironmentError as err: + if err.errno != errno.EEXIST: + raise cPickle.dump(stats, open(dest, 'wb'), -1) def compile_user_manual_translations(self):