commit:     1feee4c3627bcf33565bde1f1dc906c1326a76ba
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 17 05:54:13 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep 17 06:02:21 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1feee4c3

emaint: Assign all module __init__.py's __doc__ to a variable intsead

Due to distutils-r1 eclass optimization level, __doc__ strings are removed, 
breaking the
plugin system's use of __doc__ for it's module description(s).
This causes tracebacks when trying to run emaint.

brian@big_daddy $ emaint -h
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emaint", line 36, in <module>
    emaint_main(sys.argv[1:])
  File "/usr/lib64/python2.7/site-packages/portage/emaint/main.py", line 161, 
in emaint_main
    parser = ArgumentParser(usage=usage(module_controller))
  File "/usr/lib64/python2.7/site-packages/portage/emaint/main.py", line 78, in 
usage
    desc = textwrap.wrap(module_controller.get_description(mod), 65)
  File "/usr/lib64/python2.7/textwrap.py", line 354, in wrap
    return w.wrap(text)
  File "/usr/lib64/python2.7/textwrap.py", line 325, in wrap
    text = self._munge_whitespace(text)
  File "/usr/lib64/python2.7/textwrap.py", line 154, in _munge_whitespace
    text = text.expandtabs()
AttributeError: 'NoneType' object has no attribute 'expandtabs'
brian@big_daddy $

Problem found by: Zac Medico <zmedica <AT> gentoo.org>

---
 pym/portage/emaint/modules/binhost/__init__.py | 8 ++++----
 pym/portage/emaint/modules/config/__init__.py  | 8 ++++----
 pym/portage/emaint/modules/logs/__init__.py    | 8 ++++----
 pym/portage/emaint/modules/merges/__init__.py  | 7 ++++---
 pym/portage/emaint/modules/move/__init__.py    | 8 ++++----
 pym/portage/emaint/modules/resume/__init__.py  | 6 +++---
 pym/portage/emaint/modules/world/__init__.py   | 8 ++++----
 7 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/pym/portage/emaint/modules/binhost/__init__.py 
b/pym/portage/emaint/modules/binhost/__init__.py
index c60e8bc..f2220e9 100644
--- a/pym/portage/emaint/modules/binhost/__init__.py
+++ b/pym/portage/emaint/modules/binhost/__init__.py
@@ -1,18 +1,18 @@
 # Copyright 2005-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Scan and generate metadata indexes for binary packages.
-"""
+doc = """Scan and generate metadata indexes for binary packages."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'binhost',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1': {
                        'name': "binhost",
                        'class': "BinhostHandler",
-                       'description': __doc__,
+                       'description': doc,
                        'functions': ['check', 'fix'],
                        'func_desc': {}
                        }

diff --git a/pym/portage/emaint/modules/config/__init__.py 
b/pym/portage/emaint/modules/config/__init__.py
index f0585b3..0277d39 100644
--- a/pym/portage/emaint/modules/config/__init__.py
+++ b/pym/portage/emaint/modules/config/__init__.py
@@ -1,18 +1,18 @@
 # Copyright 2005-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Check and clean the config tracker list for uninstalled packages.
-"""
+doc = """Check and clean the config tracker list for uninstalled packages."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'config',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1': {
                        'name': "cleanconfmem",
                        'class': "CleanConfig",
-                       'description': __doc__,
+                       'description': doc,
                        'functions': ['check', 'fix'],
                        'func_desc': {}
                        }

diff --git a/pym/portage/emaint/modules/logs/__init__.py 
b/pym/portage/emaint/modules/logs/__init__.py
index 0407efe..a7891fd 100644
--- a/pym/portage/emaint/modules/logs/__init__.py
+++ b/pym/portage/emaint/modules/logs/__init__.py
@@ -1,18 +1,18 @@
 # Copyright 2005-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Check and clean old logs in the PORT_LOGDIR.
-"""
+doc = """Check and clean old logs in the PORT_LOGDIR."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'logs',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1': {
                        'name': "logs",
                        'class': "CleanLogs",
-                       'description': __doc__,
+                       'description': doc,
                        'functions': ['check','clean'],
                        'func_desc': {
                                'clean': {

diff --git a/pym/portage/emaint/modules/merges/__init__.py 
b/pym/portage/emaint/modules/merges/__init__.py
index 96ee71b..bcb2ac8 100644
--- a/pym/portage/emaint/modules/merges/__init__.py
+++ b/pym/portage/emaint/modules/merges/__init__.py
@@ -1,17 +1,18 @@
 # Copyright 2005-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Scan for failed merges and fix them."""
+doc = """Scan for failed merges and fix them."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'merges',
-       'description': __doc__,
+       'description': doc,
        'provides': {
                'merges': {
                        'name': "merges",
                        'class': "MergesHandler",
-                       'description': __doc__,
+                       'description': doc,
                        'functions': ['check', 'fix', 'purge'],
                        'func_desc': {
                                'purge': {

diff --git a/pym/portage/emaint/modules/move/__init__.py 
b/pym/portage/emaint/modules/move/__init__.py
index d31d7b3..5162430 100644
--- a/pym/portage/emaint/modules/move/__init__.py
+++ b/pym/portage/emaint/modules/move/__init__.py
@@ -1,18 +1,18 @@
 # Copyright 2005-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Perform package move updates for installed and binary packages.
-"""
+doc = """Perform package move updates for installed and binary packages."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'move',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1': {
                        'name': "moveinst",
                        'class': "MoveInstalled",
-                       'description': __doc__,
+                       'description': doc,
                        'options': ['check', 'fix'],
                        'functions': ['check', 'fix'],
                        'func_desc': {

diff --git a/pym/portage/emaint/modules/resume/__init__.py 
b/pym/portage/emaint/modules/resume/__init__.py
index 965e8f9..ebe4a37 100644
--- a/pym/portage/emaint/modules/resume/__init__.py
+++ b/pym/portage/emaint/modules/resume/__init__.py
@@ -1,13 +1,13 @@
 # Copyright 2005-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Check and fix problems in the resume and/or resume_backup files.
-"""
+doc = """Check and fix problems in the resume and/or resume_backup files."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'resume',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1': {
                        'name': "cleanresume",

diff --git a/pym/portage/emaint/modules/world/__init__.py 
b/pym/portage/emaint/modules/world/__init__.py
index 3f62270..0af73d4 100644
--- a/pym/portage/emaint/modules/world/__init__.py
+++ b/pym/portage/emaint/modules/world/__init__.py
@@ -1,18 +1,18 @@
 # Copyright 2005-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-"""Check and fix problems in the world file.
-"""
+doc = """Check and fix problems in the world file."""
+__doc__ = doc
 
 
 module_spec = {
        'name': 'world',
-       'description': __doc__,
+       'description': doc,
        'provides':{
                'module1':{
                        'name': "world",
                        'class': "WorldHandler",
-                       'description': __doc__,
+                       'description': doc,
                        'functions': ['check', 'fix'],
                        'func_desc': {}
                        }

Reply via email to