aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-11-09 19:34:54 -0500
committerJason R. Coombs <jaraco@jaraco.com>2017-11-09 19:34:54 -0500
commit2676c5a277c5e571cdaeed64e5494315d5ec4c1f (patch)
treeab349e1f72e6c3408d933c2aa59476a196db9d70 /setuptools/command
parent9a79433af7e66ee5c1f721a1803dad4873666e62 (diff)
downloadexternal_python_setuptools-2676c5a277c5e571cdaeed64e5494315d5ec4c1f.tar.gz
external_python_setuptools-2676c5a277c5e571cdaeed64e5494315d5ec4c1f.tar.bz2
external_python_setuptools-2676c5a277c5e571cdaeed64e5494315d5ec4c1f.zip
Avoid check/act race condition
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/bdist_egg.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 14dd97d3..4e36c635 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -253,8 +253,10 @@ class bdist_egg(Command):
m = re.match(pattern, name)
path_new = os.path.join(base, os.pardir, m.group('name') + '.pyc')
log.info("Renaming file from [%s] to [%s]" % (path_old, path_new))
- if os.path.exists(path_new):
- os.unlink(path_new)
+ try:
+ os.remove(path_new)
+ except OSError:
+ pass
os.rename(path_old, path_new)