MrMino / wheelfile

🔪🧀 API for creating and inspecting Python .whl files (wheels)
MIT License
29 stars 5 forks source link

Add recursive argument to write() #5

Closed MrMino closed 3 years ago

MrMino commented 3 years ago
e2thenegpii commented 3 years ago

Seems like something like the following will do what you want here.

filename = Path(filename)
if recursive and filename.is_dir():
    with open(self._zip, arcname) as wf:
        for path in filename.rglob("*"):
            with wf.open(path, "wb") arcfile, path.open("rb") as rawfile:
                arcfile.write(rawfile.read())
MrMino commented 3 years ago

@e2thenegpii yea, I have that already, I just wanted it test-first for the sake of my conscience and didn't had the time to finish it. Will do tomorrow.

MrMino commented 3 years ago

Closes #1