[英]Setuptools setup.py installing when dependencies not satisfied
I have a setup.py
that looks a bit (okay, exactly) like this: 我有一个看起来有点(好吧,确切)的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="benedict@soe.ucsc.edu",
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"])
It installs the package perfectly fine when run with ./setup.py install
. 使用./setup.py install
运行时,它可以完美地安装包。 However, it does this whether or not the "sonLib" package is installed, ignoring the dependency. 但是,无论是否安装了“sonLib”软件包,都会执行此操作,忽略依赖项。
Is this expected behavior? 这是预期的行为吗? Should a setup.py install
blithely proceed if the dependencies are not installed, leaving it up to pip or whatever to install them beforehand? 如果没有安装依赖项,是否应该快速setup.py install
,将其留给pip或事先安装它们的任何东西? If not, and setup.py install
ought to fail when dependencies are absent, what am I doing wrong? 如果没有,并且当依赖关系不存在时, setup.py install
应该失败,我做错了什么?
EDIT : Some version information: 编辑 :一些版本信息:
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'
>>>
The default install
command for Distutils setup
doesn't know anything about dependencies. Distutils setup
的默认install
命令对依赖项没有任何了解。 If you are running that, you're right that dependencies will not be checked. 如果您正在运行它,那么您将无法检查依赖项。
Just going by what you've show in the setup.py
, though, you are using Setuptools for the setup
function. 只是按照你在setup.py
显示的内容,你正在使用Setuptools来setup
功能。 The Setuptools install
command is declared to run easy_install
, which in turn does check and download dependencies. 声明Setuptools install
命令运行easy_install
,而easy_install
又检查并下载依赖项。
It is possible you are explicitly invoking the Distutils install
, by specifying install --single-version-externally-managed
. 您可以通过指定install --single-version-externally-managed
显式调用Distutils install
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.