2016-07-12 48 views
11

我試圖讓一個項目依賴於git依賴。但是,我似乎無法讓它工作。我基本上要實現的是下面的,但它不工作:取決於setup.py中的git存儲庫

#!/usr/bin/env python3 
from setuptools import setup 


setup(
    name='spam', 
    version='0.0.0', 
    install_requires=[ 
     'git+https://github.com/remcohaszing/pywakeonlan.git' 
    ]) 

我嘗試上述幾種變化,如添加@master#egg=wakeonlan-0.2.2,但這並不有所作爲。

下工作,但使用過時pip標誌時,才--process-dependency-links

#!/usr/bin/env python3 
from setuptools import setup 


setup(
    name='spam', 
    version='0.0.0', 
    install_requires=[ 
     'wakeonlan' 
    ], 
    dependency_links=[ 
     'git+https://github.com/remcohaszing/pywakeonlan.git#egg=wakeonlan-0.2.2' 
    ]) 

此輸出:

$ pip install --no-index -e . --process-dependency-links 
Obtaining file:///home/remco/Downloads/spam 
    DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release. 
Collecting wakeonlan (from spam==0.0.0) 
    Cloning https://github.com/remcohaszing/pywakeonlan.git to /tmp/pip-build-mkhpjcjf/wakeonlan 
    DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release. 
Installing collected packages: wakeonlan, spam 
    Running setup.py install for wakeonlan ... done 
    Running setup.py develop for spam 
Successfully installed spam wakeonlan-0.2.2 

下不工作:

pip install 'git+https://github.com/remcohaszing/pywakeonlan.git' 

還加入需求文件中的git url正常工作。

是否有任何未棄用方法取決於使用setup.py文件的git url?

+1

不,該答案建議使用已棄用的dependency_links。 –

+1

一個相關的github問題:https://github.com/pypa/pip/issues/2023 - 但是我還沒有看到解決方案。 – cel

+2

目前,似乎沒有一種不被棄用的方式來做到這一點:\ –

回答

2

匹> = 9.1 (commit 6ec559)將具有用於如在PEP508描述的新@語法,它接受格式支持:[email protected]#sum - 例如:

pip install --no-index [email protected]://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4 

這也將是可用在setup.py在同一這樣,如:

install_requires=['[email protected]://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4'] 

你可以只用現在最新的承諾pip主嘗試了這一點(更新PIP「錯誤」的方式!):

$ pip install https://github.com/pypa/pip/archive/master.zip 
$ pip install --no-index [email protected]://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4 
Collecting [email protected] https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4 
from https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4 
Downloading https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl 
Installing collected packages: packaging 
Successfully installed packaging-15.3