From d7617085e645385d46b446ca89fef50f5273a53e Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Fri, 14 Jul 2017 21:42:27 +0000 Subject: [PATCH] build_emoji: Update `get_success_stamp()` function. Updates `get_success_stamp()` function to use the `emoji-datasource` package's version while calculating success stamp so that an emoji cache rebuild gets triggered automatically if the version is changed. --- tools/setup/emoji/build_emoji | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index 4aa12db5f1..6e16a99fdb 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -196,6 +196,14 @@ def get_success_stamp(): with open(filename, 'rb') as reader: sha.update(reader.read()) + # Take into account the version of `emoji-datasource` package while generating success stamp. + PACKAGE_FILE_PATH = os.path.join(ZULIP_PATH, 'package.json') + with open(PACKAGE_FILE_PATH, 'r') as fp: + parsed_package_file = ujson.load(fp) + dependency_data = parsed_package_file['dependencies'] + emoji_datasource_version = dependency_data['emoji-datasource'].encode('utf-8') + sha.update(emoji_datasource_version) + return os.path.join(EMOJI_CACHE_PATH, sha.hexdigest(), 'emoji', '.success-stamp') def dump_emojis(cache_path):