provision: Always build pygments_data.json if missing.

While it's a bit of extra complexity to do this check, which I'm not
excited about, we've had multiple folks spend significant time being
confused rebasing past d7d8632525 into
deleting `pygments_data.json`, with provision not rebuilding it, so
this seems worth merging as a transitional fix even if we decide to
remove it in 2 months.
This commit is contained in:
Tim Abbott
2020-02-20 10:18:58 -08:00
parent c78d0712f7
commit aaee506fb2

View File

@@ -127,8 +127,9 @@ def main(options: argparse.Namespace) -> int:
build_pygments_data_paths = ["tools/setup/build_pygments_data", "tools/setup/lang.json"]
from pygments import __version__ as pygments_version
if file_or_package_hash_updated(build_pygments_data_paths, "build_pygments_data_hash", options.is_force,
[pygments_version]):
if not os.path.exists("static/generated/pygments_data.json") or file_or_package_hash_updated(
build_pygments_data_paths, "build_pygments_data_hash", options.is_force,
[pygments_version]):
run(["tools/setup/build_pygments_data"])
else:
print("No need to run `tools/setup/build_pygments_data`.")