@@ -32,7 +32,19 @@ def download_file(url, dest_path):
3232
3333def extract_zip (zip_path , dest_dir ):
3434 with zipfile .ZipFile (zip_path , "r" ) as zip_ref :
35- zip_ref .extractall (dest_dir )
35+ members = zip_ref .namelist ()
36+ top_level = members [0 ].split ("/" )[0 ]
37+ for member in members :
38+ path_inside_zip = "/" .join (member .split ("/" )[1 :])
39+ if not path_inside_zip :
40+ continue
41+ target_path = os .path .join (dest_dir , path_inside_zip )
42+ if member .endswith ("/" ):
43+ os .makedirs (target_path , exist_ok = True )
44+ else :
45+ os .makedirs (os .path .dirname (target_path ), exist_ok = True )
46+ with open (target_path , "wb" ) as f :
47+ f .write (zip_ref .read (member ))
3648 print (f"Extracted { zip_path } to { dest_dir } " )
3749
3850def extract_tar (tar_path , dest_dir ):
@@ -97,15 +109,6 @@ def ensure_sdl():
97109 ], cwd = build_dir )
98110 print ("SDL2 built and installed successfully." )
99111
100- print (f"Listing all files in { BASE_DIR } :" )
101-
102- BASE_DIRt = os .path .abspath ("deps" )
103- for root , dirs , files in os .walk (BASE_DIRt ):
104- for name in files :
105- file_path = os .path .join (root , name )
106- rel_path = os .path .relpath (file_path , BASE_DIRt )
107- print (f"- { rel_path } " )
108-
109112 if not os .path .isfile (include_path ):
110113 print (f"ERROR: SDL2 headers not found at { include_path } " )
111114 sys .exit (1 )
0 commit comments