You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by js...@apache.org on 2024/12/18 20:25:16 UTC
(airflow) branch revert-44744-vincbeck/compile_assets created (now a46fa3c8279)
This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a change to branch revert-44744-vincbeck/compile_assets
in repository https://gitbox.apache.org/repos/asf/airflow.git
at a46fa3c8279 Revert "AIP-79 Generate assets for Flask application in FAB provider (#44744)"
This branch includes the following new commits:
new a46fa3c8279 Revert "AIP-79 Generate assets for Flask application in FAB provider (#44744)"
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(airflow) 01/01: Revert "AIP-79 Generate assets for Flask application in FAB provider (#44744)"
Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch revert-44744-vincbeck/compile_assets
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit a46fa3c8279ca525b54dd996c5cd82bdc276305d
Author: Jens Scheffler <95...@users.noreply.github.com>
AuthorDate: Wed Dec 18 21:25:09 2024 +0100
Revert "AIP-79 Generate assets for Flask application in FAB provider (#44744)"
This reverts commit ba49469a7ec397f45e40aaa1872fe6aefa53ecb7.
---
scripts/ci/pre_commit/compile_www_assets.py | 31 +++++++----------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/scripts/ci/pre_commit/compile_www_assets.py b/scripts/ci/pre_commit/compile_www_assets.py
index 66931bc8e7b..bf2664685ed 100755
--- a/scripts/ci/pre_commit/compile_www_assets.py
+++ b/scripts/ci/pre_commit/compile_www_assets.py
@@ -18,11 +18,11 @@
from __future__ import annotations
import hashlib
-import importlib.util
import os
import re
import shutil
import subprocess
+import sys
from pathlib import Path
# NOTE!. This script is executed from node environment created by pre-commit and this environment
@@ -52,18 +52,17 @@ if __name__ not in ("__main__", "__mp_main__"):
f"To run this script, run the ./{__file__} command"
)
-
-def compile_assets(www_directory: Path, www_hash_file_name: str):
+if __name__ == "__main__":
+ www_directory = AIRFLOW_SOURCES_PATH / "airflow" / "www"
node_modules_directory = www_directory / "node_modules"
dist_directory = www_directory / "static" / "dist"
- www_hash_file = AIRFLOW_SOURCES_PATH / ".build" / "www" / www_hash_file_name
- www_hash_file.parent.mkdir(exist_ok=True, parents=True)
+ WWW_HASH_FILE.parent.mkdir(exist_ok=True, parents=True)
if node_modules_directory.exists() and dist_directory.exists():
- old_hash = www_hash_file.read_text() if www_hash_file.exists() else ""
+ old_hash = WWW_HASH_FILE.read_text() if WWW_HASH_FILE.exists() else ""
new_hash = get_directory_hash(www_directory, skip_path_regexp=r".*node_modules.*")
if new_hash == old_hash:
print("The WWW directory has not changed! Skip regeneration.")
- return
+ sys.exit(0)
else:
shutil.rmtree(node_modules_directory, ignore_errors=True)
shutil.rmtree(dist_directory, ignore_errors=True)
@@ -72,20 +71,4 @@ def compile_assets(www_directory: Path, www_hash_file_name: str):
subprocess.check_call(["yarn", "install", "--frozen-lockfile"], cwd=os.fspath(www_directory))
subprocess.check_call(["yarn", "run", "build"], cwd=os.fspath(www_directory), env=env)
new_hash = get_directory_hash(www_directory, skip_path_regexp=r".*node_modules.*")
- www_hash_file.write_text(new_hash)
-
-
-def is_fab_provider_installed() -> bool:
- return importlib.util.find_spec("airflow.providers.fab") is not None
-
-
-if __name__ == "__main__":
- # Compile assets for main
- main_www_directory = AIRFLOW_SOURCES_PATH / "airflow" / "www"
- compile_assets(main_www_directory, "hash.txt")
- if is_fab_provider_installed():
- # Compile assets for fab provider
- fab_provider_www_directory = (
- AIRFLOW_SOURCES_PATH / "providers" / "src" / "airflow" / "providers" / "fab" / "www"
- )
- compile_assets(fab_provider_www_directory, "hash_fab.txt")
+ WWW_HASH_FILE.write_text(new_hash)