2013-07-19 39 views
4

我有一個setup.py,看起來有點(好吧,精確地)是這樣的:的setuptools setup.py安裝時,依賴不滿意

#!/usr/bin/env python 

from setuptools import setup 
import subprocess 
import distutils.command.build_py 

class BuildWithMake(distutils.command.build_py.build_py): 
    """ 
    Build using make. 
    Then do the default build logic. 

    """ 
    def run(self): 
     # Call make. 
     subprocess.check_call(["make"]) 

     # Keep installing the Python stuff 
     distutils.command.build_py.build_py.run(self) 


setup(name="jobTree", 
    version="1.0", 
    description="Pipeline management software for clusters.", 
    author="Benedict Paten", 
    author_email="[email protected]", 
    url="http://hgwdev.cse.ucsc.edu/~benedict/code/jobTree.html", 
    packages=["jobTree", "jobTree.src", "jobTree.test", "jobTree.batchSystems", 
    "jobTree.scriptTree"], 
    package_dir= {"": ".."}, 
    install_requires=["sonLib"], 
    # Hook the build command to also build with make 
    cmdclass={"build_py": BuildWithMake}, 
    # Install all the executable scripts somewhere on the PATH 
    scripts=["bin/jobTreeKill", "bin/jobTreeStatus", 
    "bin/scriptTreeTest_Sort.py", "bin/jobTreeRun", 
    "bin/jobTreeTest_Dependencies.py", "bin/scriptTreeTest_Wrapper.py", 
    "bin/jobTreeStats", "bin/multijob", "bin/scriptTreeTest_Wrapper2.py"]) 

它安裝包時./setup.py install運行完美的罰款。但是,無論是否安裝「sonLib」軟件包,都會執行此操作,而忽略依賴關係。

這是預期的行爲?如果沒有安裝依賴關係,setup.py install應該愉快地繼續進行下去,把它留給點或什麼來預先安裝它們?如果沒有,並且setup.py install在缺失依賴時應該失敗,我在做什麼錯了?

編輯:一些版本信息:

Python 2.7.2 (default, Jan 19 2012, 21:40:50) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import setuptools 
>>> setuptools.__version__ 
'0.6c12' 
>>> 
+0

我很確定'setuptools'實際上並不檢查依賴關係。你可能想用[distribute](http://pythonhosted.org/distribute/)來代替。 – murgatroid99

+1

@ murgatroid99d - 發行版和setuptools已合併在一起。而setuptools通常會_does_安裝依賴關係。 – mata

+0

運行'pip install setuptools -U'來獲得0.9版本,我認爲這個接受'install_requires'選項,就像分發一樣。 –

回答

0

default install command for Distutils setup不知道什麼依賴性。如果你正在運行它,那麼你是正確的,依賴不會被檢查。

儘管您在setup.py中顯示的內容正在使用Setuptools作爲setup函數。 Setuptools install command被聲明爲運行easy_install,後者進而檢查並下載依賴關係。

您可能通過指定install --single-version-externally-managed明確調用Distutils install

相關問題