Skip to content

Commit e4bae87

Browse files
committed
upd
1 parent 80a6f5e commit e4bae87

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ skip = [
4141
include-package-data = false
4242

4343
[tool.setuptools.dynamic]
44-
version = {attr = "flashinfer.__version__"}
44+
version = {attr = "flashinfer._build_meta.__version__"}
4545

4646
[tool.setuptools.packages.find]
4747
where = ["."]

scripts/update_whl_index.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,40 @@ def compute_sha256(file_path: pathlib.Path) -> str:
7070
return hashlib.sha256(f.read()).hexdigest()
7171

7272

73+
def generate_directory_index(directory: pathlib.Path):
74+
"""Generate index.html for a directory listing its subdirectories."""
75+
# Get all subdirectories
76+
subdirs = sorted([d for d in directory.iterdir() if d.is_dir()])
77+
78+
if not subdirs:
79+
return
80+
81+
index_file = directory / "index.html"
82+
83+
# Generate HTML for directory listing
84+
with index_file.open("w") as f:
85+
f.write("<!DOCTYPE html>\n")
86+
f.write("<html>\n")
87+
f.write(f"<head><title>Index of {directory.name or 'root'}</title></head>\n")
88+
f.write("<body>\n")
89+
f.write(f"<h1>Index of {directory.name or 'root'}</h1>\n")
90+
91+
for subdir in subdirs:
92+
f.write(f'<a href="{subdir.name}/">{subdir.name}/</a><br>\n')
93+
94+
f.write("</body>\n")
95+
f.write("</html>\n")
96+
97+
98+
def update_parent_indices(leaf_dir: pathlib.Path, root_dir: pathlib.Path):
99+
"""Recursively update index.html for all parent directories."""
100+
current = leaf_dir.parent
101+
102+
while current >= root_dir and current != current.parent:
103+
generate_directory_index(current)
104+
current = current.parent
105+
106+
73107
def update_index(
74108
dist_dir: str = "dist",
75109
output_dir: str = "whl",
@@ -85,7 +119,7 @@ def update_index(
85119
output_dir: Output directory for index files
86120
base_url: Base URL for wheel downloads
87121
release_tag: GitHub release tag (e.g., 'nightly' or 'v0.3.1')
88-
nightly: If True, update index to whl/nightly subdirectory
122+
nightly: If True, update index to whl/nightly subdirectory for nightly releases
89123
"""
90124
dist_path = pathlib.Path(dist_dir)
91125
if not dist_path.exists():
@@ -99,6 +133,9 @@ def update_index(
99133

100134
print(f"Found {len(wheels)} wheel file(s)")
101135

136+
# Track all directories that need parent index updates
137+
created_dirs = set()
138+
102139
for wheel_path in wheels:
103140
print(f"\nProcessing: {wheel_path.name}")
104141

@@ -128,6 +165,7 @@ def update_index(
128165
index_dir = base_output / package
129166

130167
index_dir.mkdir(parents=True, exist_ok=True)
168+
created_dirs.add(index_dir)
131169

132170
# Construct download URL
133171
tag = release_tag or f"v{info['version'].split('+')[0].split('.dev')[0]}"
@@ -171,6 +209,13 @@ def update_index(
171209
print(f" 🎮 CUDA: cu{cuda}")
172210
print(f" 📍 URL: {download_url}")
173211

212+
# Update parent directory indices
213+
print("\n📂 Updating parent directory indices...")
214+
root_output = pathlib.Path(output_dir)
215+
for leaf_dir in created_dirs:
216+
update_parent_indices(leaf_dir, root_output)
217+
print(" ✅ Parent indices updated")
218+
174219

175220
def main():
176221
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)