在pip install <package>

时间:2019-07-29 07:54:45

标签: python setuptools setup.py software-distribution

我正在尝试运行可完成安装的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,但是该文件不存在

0 个答案:

没有答案