[svn r37449] fix failures in case of docutils not being installed
(related to importing 'py.__.rest.directive') --HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									181f6cde23
								
							
						
					
					
						commit
						06f68d9fb7
					
				| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
from __future__ import generators
 | 
					from __future__ import generators
 | 
				
			||||||
import py
 | 
					import py
 | 
				
			||||||
from py.__.misc import rest 
 | 
					from py.__.misc import rest 
 | 
				
			||||||
from py.__.rest import directive
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Option = py.test.config.Option 
 | 
					Option = py.test.config.Option 
 | 
				
			||||||
option = py.test.config.addoptions("documentation check options", 
 | 
					option = py.test.config.addoptions("documentation check options", 
 | 
				
			||||||
| 
						 | 
					@ -15,11 +14,18 @@ option = py.test.config.addoptions("documentation check options",
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
) 
 | 
					) 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					_initialized = False
 | 
				
			||||||
def checkdocutils(): 
 | 
					def checkdocutils(): 
 | 
				
			||||||
 | 
					    global _initialized
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        import docutils
 | 
					        import docutils
 | 
				
			||||||
    except ImportError:
 | 
					    except ImportError:
 | 
				
			||||||
        py.test.skip("docutils not importable")
 | 
					        py.test.skip("docutils not importable")
 | 
				
			||||||
 | 
					    if not _initialized:
 | 
				
			||||||
 | 
					        from py.__.rest import directive
 | 
				
			||||||
 | 
					        directive.register_linkrole('api', resolve_linkrole)
 | 
				
			||||||
 | 
					        directive.register_linkrole('source', resolve_linkrole)
 | 
				
			||||||
 | 
					        _initialized = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def restcheck(path):
 | 
					def restcheck(path):
 | 
				
			||||||
    localpath = path
 | 
					    localpath = path
 | 
				
			||||||
| 
						 | 
					@ -251,6 +257,4 @@ def resolve_linkrole(name, text):
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            relpath += '.html'
 | 
					            relpath += '.html'
 | 
				
			||||||
        return text, '../../apigen/source/%s' % (relpath,)
 | 
					        return text, '../../apigen/source/%s' % (relpath,)
 | 
				
			||||||
directive.register_linkrole('api', resolve_linkrole)
 | 
					 | 
				
			||||||
directive.register_linkrole('source', resolve_linkrole)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue