简体   繁体   English

./setup.py install的--install-base参数究竟意味着什么?

[英]What exactly does the --install-base parameter to ./setup.py install mean?

I try to install a python module with a custom installation layout. 我尝试安装具有自定义安装布局的python模块。

From the documentation I gathered that I could do 从我收集的文档中我可以做到

python ./setup.py install -f --install-base="/home/hstock/tmp/python" \
                        --install-purelib=modules \
                        --install-scripts=bin \
                        --install-data=data \
                        --install-platlib=modules \
                        --install-headers=include

and this should install modules to /home/hstock/tmp/python/modules - however it seems that install-base is ignored and modules are installed to ./modules . 并且应该将模块安装到/home/hstock/tmp/python/modules但是似乎install-base被忽略,模块已安装到./modules

Is this a bug or did I get the documentation wrong? 这是一个错误还是我弄错了文档?

(This is python 2.6.5 on Ubuntu Lucid) (这是Ubuntu Lucid上的python 2.6.5)

Update: 更新:

The module I want to install is self made, the setup.py is very simple: 我要安装的模块是自制的, setup.py非常简单:

#!/usr/bin/env python

from distutils.core import setup

setup(
    name='ilogtoolbox',
    provides=['ilogtoolbox'],
    version='0.6.3.1',
    packages=['ilogtoolbox'],
    requires=['daemon'],
    scripts=['prunedirs', 'logstoexternal']
    )

Actually all those --install-* arguments accept simple string templates. 实际上,所有这些--install- *参数都接受简单的字符串模板。 Have a look at python's stdlib distutils.command.install code . 看一下python的stdlib distutils.command.install代码 You will see that defaults are like '$base/Lib' or '$base/Scripts'. 您会看到默认值类似于“ $ base / Lib”或“ $ base / Scripts”。

So for your use case it will look like this: 因此,对于您的用例,它将如下所示:

python ./setup.py install -f --install-base="/home/hstock/tmp/python" \
                        --install-purelib='$base/modules' \
                        --install-scripts='$base/bin' \
                        --install-data='$base/data' \
                        --install-platlib='$base/modules' \
                        --install-headers='$base/include'

And since --install-lib actually sets both purelib and platlib it can be shortened a little: 由于--install-lib实际上同时设置了purelib和platlib,因此可以将其缩短一点:

python ./setup.py install -f --install-base="/home/hstock/tmp/python" \
                        --install-lib='$base/modules' \
                        --install-scripts='$base/bin' \
                        --install-data='$base/data' \
                        --install-headers='$base/include'

From looking at the documentation it looks like you have used this correctly - what is the module? 通过查看文档,您似乎已经正确使用了该模块-什么是模块? Is it possible that the module author did not correctly utilise distutils? 模块作者可能没有正确利用distutils吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM