Skip to content

Commit 7318db8

Browse files
committed
fix dumbpypi compatibility
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
1 parent a98d10f commit 7318db8

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

.github/scripts/organize_wheels.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@
8080
stat = shutil.disk_usage(".")
8181
free_gb = stat.free / (1024**3)
8282

83-
# With move+symlink approach, we only need ~1.1x the wheel size
84-
# (not 1.5x or 2x, since we're moving not copying)
85-
needed_gb = total_wheel_size / (1024**3) * 1.1 # 1.1x for filesystem overhead
83+
# With copy approach, we need 2x the wheel size for small wheels
84+
# (packages/ + packages-small/ both contain actual files)
85+
needed_gb = total_wheel_size / (1024**3) * 2.0 # 2x for dual storage
8686

8787
print(f"\nDisk Space Check:")
8888
print(f" Total wheel size: {total_wheel_size/(1024**3):.2f} GB")
8989
print(f" Available space: {free_gb:.2f} GB")
90-
print(f" Estimated needed: {needed_gb:.2f} GB (using move+symlink)")
90+
print(f" Estimated needed: {needed_gb:.2f} GB (using copy for dumb-pypi compatibility)")
9191

9292
if free_gb < needed_gb:
9393
print(f"\nERROR: Insufficient disk space!", file=sys.stderr)
@@ -122,22 +122,21 @@
122122
large_total_size += size
123123
operation = "moved -> packages-large/"
124124
else:
125-
# Small wheels: MOVE to packages/, SYMLINK in packages-small/
126-
# This uses only 1× space instead of 2×
125+
# Small wheels: MOVE to packages/, COPY to packages-small/
126+
# Using actual files (not symlinks) for dumb-pypi compatibility
127127
primary_dest = packages_dir / wheel.name
128-
symlink_dest = small_dir / wheel.name
128+
small_dest = small_dir / wheel.name
129129

130130
# Move to primary location (packages/)
131131
shutil.move(str(wheel), str(primary_dest))
132132

133-
# Create relative symlink in packages-small/
134-
# Use relative path so symlink works regardless of absolute paths
135-
relative_path = os.path.relpath(primary_dest, small_dir)
136-
os.symlink(relative_path, symlink_dest)
133+
# Copy to packages-small/ for dumb-pypi indexing
134+
# dumb-pypi cannot process symlinks, needs actual files
135+
shutil.copy2(str(primary_dest), str(small_dest))
137136

138137
small_count += 1
139138
small_total_size += size
140-
operation = "moved -> packages/ + symlinked -> packages-small/"
139+
operation = "moved -> packages/ + copied -> packages-small/"
141140

142141
# Enhanced progress indicator
143142
current_time = time.time()
@@ -187,9 +186,9 @@
187186
print(f" Small wheels (<100MB): {small_count} -> GitHub Pages ({small_total_size/(1024**2):.1f} MB)")
188187
print(f"Total processing time: {total_time:.1f} seconds")
189188
print(f"Average rate: {total/total_time:.2f} wheels/second")
190-
print(f"\nDisk space optimization: Using move+symlink approach")
191-
print(f" Actual space used: ~{total_wheel_size/(1024**3):.2f} GB (not {total_wheel_size*2/(1024**3):.2f} GB)")
192-
print(f" Space saved: ~{total_wheel_size/(1024**3):.2f} GB")
189+
print(f"\nDisk space usage: Using copy approach for dumb-pypi compatibility")
190+
print(f" Actual space used: ~{total_wheel_size*2/(1024**3):.2f} GB")
191+
print(f" Small wheels are in both packages/ and packages-small/ (actual files, not symlinks)")
193192
print(f"{'='*70}\n")
194193

195194
# List examples
@@ -204,14 +203,8 @@
204203
if small_sample:
205204
print(f"\nSmall wheels sample (showing 5 of {small_count}):")
206205
for w in small_sample:
207-
# Check if symlink
208-
if w.is_symlink():
209-
target = os.readlink(w)
210-
size_mb = w.stat().st_size / (1024*1024)
211-
print(f" - {w.name} ({size_mb:.1f} MB) [symlink -> {target}]")
212-
else:
213-
size_mb = w.stat().st_size / (1024*1024)
214-
print(f" - {w.name} ({size_mb:.1f} MB)")
206+
size_mb = w.stat().st_size / (1024*1024)
207+
print(f" - {w.name} ({size_mb:.1f} MB)")
215208

216209
# Set output for next steps
217210
release_tag = f"wheels-{datetime.now().strftime('%Y%m%d-%H%M%S')}"

0 commit comments

Comments
 (0)