擅长:python、mysql、java
<p>根据其他一些SO答案得出答案-以下是工作原理:</p>
<pre><code>class my_install_lib(distutils.command.install_lib.install_lib):
def run(self):
distutils.command.install_lib.install_lib.run(self)
for fn in self.get_outputs():
if <this is one of the binaries I want to be executable>:
# copied from distutils source - make the binaries executable
mode = ((os.stat(fn).st_mode) | 0555) & 07777
distutils.log.info("changing mode of %s to %o", fn, mode)
os.chmod(fn, mode)
</code></pre>
<p>然后将<code>cmdclass={'install_lib':my_install_lib}</code>传递给<code>setup</code>。在</p>