本文介绍了从scons文件运行epydoc和/或pylint构建器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我将如何创建运行 epydoc 或/和 scons 构建的.logilab.org/857/"rel =" nofollow> pylint ?

How would I create builders that runs epydoc or/and pylint from a scons built?

推荐答案

这里是另一种方法,可能更适合大型项目.

Here is another method, probably more portable to large projects.

首先,在site_scons/site_tools(或您拥有的地方)中将epydoc.py定义为:

First, define epydoc.py in site_scons/site_tools (or where ever you have those) to be:

# -*- coding: utf-8 -*-
import SCons.Builder
import SCons.Action

def complain_epydoc(target, source, env):
    print 'INFORMATION: epydoc binary was not found (see above). Documentation has not been built.'

def generate(env):
    env['EPYDOC'] = find_epydoc(env)
    if env['EPYDOC'] != None:
        opts = '--quiet --html --inheritance listed --graph all --css white --parse-only '
        env['EPYDOCCOM'] = '$EPYDOC ' + opts + '-o $TARGET  $SOURCES'
        env['BUILDERS']['epydoc'] = SCons.Builder.Builder(action=env['EPYDOCCOM'])
    else:
        env['BUILDERS']['epydoc'] = SCons.Builder.Builder(action=env.Action(complain_epydoc))

def find_epydoc(env):
    b=env.WhereIs('epydoc')
    if b == None:
        print 'Searching for epydoc: not found. Documentation will not be built'
    else:
        print 'Searching for epydoc: ', b
    return b

def exists(env):
    if find_epydoc(env) == None:
        return 0
    return 1

在主SConstruct文件中,添加:

import epdoc
env.Tool("epydoc")

然后,在您的SConstruct文件或SConscript文件中,您可以像这样构建文档:

Then, in your SConstruct file or SConscript files, you can build documentation like so:

Alias('epydoc', env.epydoc(source=python_code_files, target=Dir('docs')))

注意:您可以对ctags和pylint做同样的事情,仅举几例.

Note: you could do the same thing for ctags and pylint, just to name a few.

这篇关于从scons文件运行epydoc和/或pylint构建器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 16:49