Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Fix tarball creation, for real :) #12

Merged
merged 4 commits into from
Apr 8, 2014

Conversation

dzuelke
Copy link
Contributor

@dzuelke dzuelke commented Apr 7, 2014

The recent change caused empty folders to be discarded.

I looked into the issue again. The old os.path.basename call returned an empty string only if dir had a trailing slash. Otherwise, it would return the dir name. So this was a bit brittle, because depending on whether or not someone had a trailing slash in the "Build Dir" comment at the top of their file, they'd get different results.

Passing an empty string as arcname always causes the empty entry in the tarball. This seems to be related to how arcname is passed through a realpath call.

The fix, then, is to simply iterate over the top level of the given directory, and add those entries individually (can be files or dirs). Much simpler code, too :)

dzuelke added 3 commits April 7, 2014 19:59
This reverts commit 88e18ff.
this also preserves empty directories in tar files
@dzuelke
Copy link
Contributor Author

dzuelke commented Apr 7, 2014

(ping @kennethreitz)

@kennethreitz
Copy link
Contributor

🍰

kennethreitz added a commit that referenced this pull request Apr 8, 2014
Fix tarball creation, for real :)
@kennethreitz kennethreitz merged commit 1c2079d into heroku-python:master Apr 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants