summaryrefslogtreecommitdiff
path: root/wheel/wheelfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'wheel/wheelfile.py')
-rw-r--r--wheel/wheelfile.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/wheel/wheelfile.py b/wheel/wheelfile.py
index 486e17e..37754b4 100644
--- a/wheel/wheelfile.py
+++ b/wheel/wheelfile.py
@@ -109,15 +109,17 @@ class WheelFile(ZipFile):
logger.info("creating '%s' and adding '%s' to it", self.filename, base_dir)
deferred = []
for root, dirnames, filenames in os.walk(base_dir):
+ if not dirnames and not filenames:
+ # For an empty directory, just add the directory entry
+ path = os.path.normpath(root)
+ arcname = os.path.relpath(path, base_dir)
+ self.mkdir(path, arcname)
+ continue
+
# Sort the directory names so that `os.walk` will walk them in a
# defined order on the next iteration.
dirnames.sort()
- for name in dirnames:
- path = os.path.normpath(os.path.join(root, name))
- arcname = os.path.relpath(path, base_dir)
- self.mkdir(path, arcname)
-
for name in sorted(filenames):
path = os.path.normpath(os.path.join(root, name))
if os.path.isfile(path):