我正在尝试运行可完成安装的shell脚本,它将在安装软件包时而不是在准备软件包时运行
我尝试过
def _post_install(dir):
with open("/tmp/myfile", "w") as fh:
fh.writelines(["after install: {}".format(distro.linux_distribution())])
class install(_install):
def run(self):
self.execute(_post_install, (self.install_lib,),
msg="Running post install task")
_install.run(self)
setup (...
install_scripts={'install': install}
)
还有
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
_post_install()
install.run(self)
setup (...
cmdclass={'install': install}
)
无济于事。
运行pip install <pkgname>
后,我希望看到包含内容的文件/tmp/myfile
,但是该文件不存在