在virtualenv中找不到全局贴纸命令

Ach*_*him 6 python setuptools paster

我创建了一个自定义paster命令,如http://pythonpaste.org/script/developer.html#what-do-commands-look-like中所述.在我的setup.py中,我已经定义了这样的入口点:

entry_points={
  'paste.global_paster_command' : [
    'xxx_new = xxxconf.main:NewXxx'
  ]
}
Run Code Online (Sandbox Code Playgroud)

我在激活的virtualenv里面,并通过安装我的包

python setup.py develop
Run Code Online (Sandbox Code Playgroud)

如果我paster在我的包文件夹中运行,我会看到我的自定义命令,我可以通过它运行它paster xxx ....但是,如果我离开我的包文件夹paster不再显示我的命令.我查了一下which paster,这是我的virtualenv的版本.我也启动了一个python解释器并导入xxxconf,它工作正常.

当我在我的包文件夹之外时,我不知道为什么我的全局命令无法识别!?

abb*_*bot 6

你做错了什么,应该有用.这是最小的工作示例,您可以使用virtualenv进行测试:

blah/setup.py:

from setuptools import setup, find_packages

setup(name='blah',
      version='0.1',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
      include_package_data=True,
      zip_safe=False,
      entry_points={'paste.global_paster_command': [ "xxx_new = blah.xxx:NewXxx", ] },
      )
Run Code Online (Sandbox Code Playgroud)

blah/blah/xxx.py:

from paste.script import command

class NewXxx(command.Command):
    usage = "PREFIX"
    summary = "some command"
    group_name = "my group"
Run Code Online (Sandbox Code Playgroud)

blah/blah/__init__.py:空的.

现在测试:

$ pwd
/tmp
$ virtualenv paster
New python executable in paster/bin/python
Installing setuptools............done.
Installing pip...............done.
$ . paster/bin/activate
(paster)$ pip install PasteScript
Downloading/unpacking PasteScript
[... skipping long pip output here ...]
(paster)$ paster
[...]
Commands:
  create       Create the file layout for a Python distribution
  help         Display help
  make-config  Install a package and create a fresh config file/directory
  points       Show information about entry points
  post         Run a request for the described application
  request      Run a request for the described application
  serve        Serve the described application
  setup-app    Setup an application, given a config file

(paster)$ cd blah/
(paster)$ python setup.py develop
running develop
[... skipping setup.py output...]
(paster)$ paster
[...]
Commands:
  create       Create the file layout for a Python distribution
  help         Display help
  make-config  Install a package and create a fresh config file/directory
  points       Show information about entry points
  post         Run a request for the described application
  request      Run a request for the described application
  serve        Serve the described application
  setup-app    Setup an application, given a config file

my group:
  xxx_new      some command
(paster)$ cd ~
(paster)$ paster
[...]
Commands:
[...]
  setup-app    Setup an application, given a config file

my group:
  xxx_new      some command
Run Code Online (Sandbox Code Playgroud)