From aa8430ad391d93391988451f43ecedd76ca4dd77 Mon Sep 17 00:00:00 2001 From: Robin Dunn <> Date: Sun, 12 Apr 2020 19:25:10 -0700 Subject: [PATCH] Fix error with symlinks when building the wheel on Linux --- demo/version.py | 2 +- setup.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/demo/version.py b/demo/version.py index 9a0b3fe0..94f38a29 100644 --- a/demo/version.py +++ b/demo/version.py @@ -1,3 +1,3 @@ # This file was generated by wxPython's wscript. -VERSION_STRING = '4.1.0a1' +VERSION_STRING = '4.1.0' diff --git a/setup.py b/setup.py index 6b78355a..955c1a1a 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ import sys, os import glob +import stat from setuptools import setup, find_packages from distutils.command.build import build as orig_build @@ -308,6 +309,16 @@ orig_copy_tree = distutils.dir_util.copy_tree distutils.dir_util.copy_tree = wx_copy_tree +# Monkey-patch make_writeable too. Sometimes the link is copied before the +# target, and the original make_writable will fail on a link to a missing +# target. +def wx_make_writable(target): + if not os.path.islink(target): + os.chmod(target, os.stat(target).st_mode | stat.S_IWRITE) + +import setuptools.command.build_py +setuptools.command.build_py.make_writable = wx_make_writable + #----------------------------------------------------------------------