From 6352c2e9b2028473acdbd58175bbc5638258e29d Mon Sep 17 00:00:00 2001 From: LMKight Date: Sun, 2 Apr 2017 15:11:13 +0200 Subject: [PATCH 1/2] fixed command list --- scrapy/cmdline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scrapy/cmdline.py b/scrapy/cmdline.py index cb7bbd64d..05b0a12e0 100644 --- a/scrapy/cmdline.py +++ b/scrapy/cmdline.py @@ -27,8 +27,9 @@ def _get_commands_from_module(module, inproject): d = {} for cmd in _iter_command_classes(module): if inproject or not cmd.requires_project: - cmdname = cmd.__module__.split('.')[-1] - d[cmdname] = cmd() + if not cmd.__module__ == module: + cmdname = cmd.__module__.split('.')[-1] + d[cmdname] = cmd() return d def _get_commands_from_entry_points(inproject, group='scrapy.commands'): From 05ce1296c6a60f23e81af7ec38ac1855e78be79f Mon Sep 17 00:00:00 2001 From: LMKight Date: Mon, 3 Apr 2017 19:47:01 +0200 Subject: [PATCH 2/2] changed code according to request --- scrapy/cmdline.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scrapy/cmdline.py b/scrapy/cmdline.py index 05b0a12e0..8edc1ad2d 100644 --- a/scrapy/cmdline.py +++ b/scrapy/cmdline.py @@ -20,16 +20,16 @@ def _iter_command_classes(module_name): for obj in vars(module).values(): if inspect.isclass(obj) and \ issubclass(obj, ScrapyCommand) and \ - obj.__module__ == module.__name__: + obj.__module__ == module.__name__ and \ + not obj == ScrapyCommand: yield obj def _get_commands_from_module(module, inproject): d = {} for cmd in _iter_command_classes(module): if inproject or not cmd.requires_project: - if not cmd.__module__ == module: - cmdname = cmd.__module__.split('.')[-1] - d[cmdname] = cmd() + cmdname = cmd.__module__.split('.')[-1] + d[cmdname] = cmd() return d def _get_commands_from_entry_points(inproject, group='scrapy.commands'):