4

私は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"])

で実行すると、パッケージが完全に正常にインストールされます./setup.py install。ただし、「sonLib」パッケージがインストールされているかどうかに関係なく、依存関係を無視してこれを行います。

これは予想される動作ですか?setup.py install依存関係がインストールされていない場合は、事前にインストールするためにpipなどに任せて、気軽に続行する必要がありますか? そうでない場合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'
>>> 
4

1 に答える 1

0

Distutilsデフォルトinstallsetupコマンドは、依存関係について何も知りません。それを実行している場合、依存関係がチェックされないことは正しいです。

で示したsetup.pyとおりですが、関数に Setuptools を使用していsetupます。Setuptoolsコマンドはruninstallと宣言されてeasy_installおり、これにより依存関係のチェックとダウンロードが行われます。

installを指定することで、 Distutils を明示的に呼び出すことができますinstall --single-version-externally-managed

于 2015-01-13T22:31:49.907 に答える