This is an automated email from the ASF dual-hosted git repository.

gopidesu pushed a commit to branch update-metadata-gen-scripts
in repository https://gitbox.apache.org/repos/asf/airflow-site.git


The following commit(s) were added to refs/heads/update-metadata-gen-scripts by 
this push:
     new fc98e9c57f Update metadata gen and add RewriteRule
fc98e9c57f is described below

commit fc98e9c57f23eb2b11414550ad9a8fa237b4ed47
Author: Pavan Kumar <[email protected]>
AuthorDate: Thu May 1 18:55:18 2025 +0100

    Update metadata gen and add RewriteRule
---
 dump-docs-packages-metadata.py      | 44 +++++--------------------------------
 landing-pages/site/static/.htaccess |  5 +++++
 2 files changed, 10 insertions(+), 39 deletions(-)

diff --git a/dump-docs-packages-metadata.py b/dump-docs-packages-metadata.py
index aee2b9a3b5..6e1955907d 100755
--- a/dump-docs-packages-metadata.py
+++ b/dump-docs-packages-metadata.py
@@ -1,44 +1,10 @@
 #!/usr/bin/env python
-
-import json
 import sys
 
-import os
-from typing import List
-import semver
-
-
-ROOT_DIR = 
os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)), 
os.path.pardir))
-APACHE_AIRFLOW_ARCHIVE = os.path.join(ROOT_DIR, "docs-archive")
-
-
-def get_all_versions(directory: str) -> List[str]:
-    return sorted(
-        (f for f in os.listdir(directory) if 
os.path.isdir(os.path.join(directory, f))),
-        key=lambda d: semver.VersionInfo.parse(d),
-    )
-
-
-def get_stable_version(directory: str):
-    with open(os.path.join(directory, "stable.txt")) as f:
-        return f.read().strip()
-
-
-def dump_docs_package_metadata():
-    all_packages_infos = [
-        {
-            "package-name": package_name,
-            "stable-version": 
get_stable_version(os.path.join(APACHE_AIRFLOW_ARCHIVE, package_name)),
-            "all-versions": 
get_all_versions(os.path.join(APACHE_AIRFLOW_ARCHIVE, package_name)),
-        }
-        for package_name in os.listdir(APACHE_AIRFLOW_ARCHIVE)
-        if (
-            not package_name.startswith(".") and  # Exclude .DS_Store/
-            os.path.isfile(os.path.join(os.path.join(APACHE_AIRFLOW_ARCHIVE, 
package_name, 'stable.txt')))
-        )
-    ]
-
-    json.dump(all_packages_infos, sys.stdout, indent=2)
+import requests
 
+resp = 
requests.get("https://staging-docs-airflow-apache-org.s3.us-east-2.amazonaws.com/manifest/packages-metadata.json";)
+if resp.status_code != 200:
+    raise RuntimeError(f"Failed to fetch metadata: {resp.status_code} - 
{resp.text}")
 
-dump_docs_package_metadata()
+sys.stdout.write(resp.text)
diff --git a/landing-pages/site/static/.htaccess 
b/landing-pages/site/static/.htaccess
index a80ece10f9..f6e4ec00d5 100644
--- a/landing-pages/site/static/.htaccess
+++ b/landing-pages/site/static/.htaccess
@@ -1,3 +1,8 @@
+RewriteEngine On
+
+RewriteCond %{REQUEST_URI} ^/docs [NC]
+RewriteRule (.*) 
http://staging-docs-airflow-apache-org.s3-website.us-east-2.amazonaws.com/$1 [P]
+
 RedirectMatch Permanent ^/docs/(stable|1.10.10)/api(\.html)?$ 
"https://airflow.apache.org/docs/apache-airflow/$1/rest-api-ref";
 RedirectMatch Permanent ^/docs/(stable|1.10.10)/(cli|macros)(\.html)?$ 
"https://airflow.apache.org/docs/apache-airflow/$1/$2-ref";
 RedirectMatch Permanent ^/((_api|_images|_modules|_sources|_static|howto)/.*)$ 
"https://airflow.apache.org/docs/apache-airflow/stable/$1";

Reply via email to