Kar*_*ter 5 python git setuptools
我想在我的项目中setuptools安装Phoenix并因此添加
setup(
...
dependency_links = [
"git+https://github.com/wxWidgets/Phoenix.git#egg=Phoenix"
],
install_requires = ["Phoenix"],
...
)
Run Code Online (Sandbox Code Playgroud)
我的setup.py,但Phoenix' setuptools设置取决于递归git克隆。如何告诉setuptools我的项目做的设置git clone --recursive为Phoenix?
定义git别名git config --global alias.clone 'clone --recursive'不会改变任何内容。
我在Ubuntu 15.04上将2.7 setuptools与python2.7结合使用。
我终于找到了可以解决这个问题的答案!这篇博文对此进行了解释。在这种情况下,它假设您可以访问源代码Phoenix。本质上,您必须将以下添加应用到Phoenixs setup.py。把它应用到你的 悲伤上并没有帮助setup.py。简而言之:
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
def gitcmd_update_submodules():
''' Check if the package is being deployed as a git repository. If so, recursively
update all dependencies.
@returns True if the package is a git repository and the modules were updated.
False otherwise.
'''
if os.path.exists(os.path.join(HERE, '.git')):
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
return True
return False
class GitCmdDevelop(develop):
def run(self):
gitcmd_update_submodules()
develop.run(self)
class GitCmdInstall(install):
def run(self):
gitcmd_update_submodules()
install.run(self)
class GitCmdSDist(sdist):
def run(self):
gitcmd_update_submodules()
sdist.run(self)
setup(
cmdclass={
'develop': GitCmdDevelop,
'install': GitCmdInstall,
'sdist': GitCmdSDist,
},
...
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
260 次 |
| 最近记录: |