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.
This commit is contained in:
Harshit Bansal 2017-07-14 21:42:27 +00:00 committed by Tim Abbott
parent 215e3389e2
commit d7617085e6
1 changed files with 8 additions and 0 deletions

View File

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