summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2020-01-22 09:38:11 +0200
committerAlex Grönholm <alex.gronholm@nextday.fi>2020-01-22 09:38:11 +0200
commit41fcf3439fa8d0aa2340e27fd754661df66a5d9a (patch)
tree3bdda37dc1bcc507fa7e99fa233842df941d814e /src
parent9aa8480b5d2d033dbd9b634fa736d8f25150c40d (diff)
downloadwheel-git-41fcf3439fa8d0aa2340e27fd754661df66a5d9a.tar.gz
Fixed bdist_wheel failing on a read-only source tree
Fixes #327.
Diffstat (limited to 'src')
-rw-r--r--src/wheel/bdist_wheel.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wheel/bdist_wheel.py b/src/wheel/bdist_wheel.py
index 014983c..ce82eb6 100644
--- a/src/wheel/bdist_wheel.py
+++ b/src/wheel/bdist_wheel.py
@@ -6,6 +6,7 @@ A wheel is a built archive format.
import os
import shutil
+import stat
import sys
import re
from email.generator import Generator
@@ -40,6 +41,12 @@ def safer_version(version):
return safe_version(version).replace('-', '_')
+def remove_readonly(func, path, excinfo):
+ print(str(excinfo[1]))
+ os.chmod(path, stat.S_IWRITE)
+ func(path)
+
+
class bdist_wheel(Command):
description = 'create a wheel distribution'
@@ -267,7 +274,7 @@ class bdist_wheel(Command):
if not self.keep_temp:
logger.info('removing %s', self.bdist_dir)
if not self.dry_run:
- rmtree(self.bdist_dir)
+ rmtree(self.bdist_dir, onerror=remove_readonly)
def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'):
from email.message import Message