Skip to content

Commit

Permalink
Folder instead of file, windows issue *
Browse files Browse the repository at this point in the history
  • Loading branch information
MaticTonin committed Jan 9, 2025
1 parent 79be121 commit cdb7658
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions repack_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import zipfile
import shutil
import argparse
import glob

def unpack_wheel(wheel_file, destination):
"""
Expand Down Expand Up @@ -52,27 +53,23 @@ def main():
parser.add_argument("wheel_file", type=str, help="Path to the .whl file to be repacked.")
args = parser.parse_args()

# Paths
wheel_file = args.wheel_file
# Locate .whl files
wheel_files = glob.glob(os.path.join(args.wheel_file, "*.whl"))
unpack_destination = "./unpacked_wheel"
source_packages_folder = "./compilers"
output_wheel_file = args.wheel_file

# Step 1: Unpack the wheel
unpack_wheel(wheel_file, unpack_destination)

# Step 2: Copy the packages folder into the wheel's _backend directory
backend_path = os.path.join(unpack_destination +"/depthai_viewer/_backend/compilers")
print(backend_path)

copy_packages_folder(source_packages_folder, backend_path)

# Step 3: Repack the wheel
repack_wheel(unpack_destination, output_wheel_file)

# Clean up (optional)
shutil.rmtree(unpack_destination)
print("Temporary unpacked files removed.")
if not wheel_files:
print("No .whl files found in the specified directory.")
return

for wheel_file in wheel_files:
print(f"Processing: {wheel_file}")
# Process each .whl file
unpack_wheel(wheel_file, unpack_destination)
backend_path = os.path.join(unpack_destination, "depthai_viewer", "_backend", "compilers")
copy_packages_folder(source_packages_folder, backend_path)
repack_wheel(unpack_destination, wheel_file)
shutil.rmtree(unpack_destination)
print("Temporary unpacked files removed.")


if __name__ == "__main__":
Expand Down

0 comments on commit cdb7658

Please sign in to comment.