Back to index

plone3  3.1.7
Classes | Functions | Variables
kupu.lint Namespace Reference

Classes

class  Pool

Functions

def lint
def scriptrelative
def filelist
def newfiles
def basetime
def loadstatus
def savestatus

Variables

string COMPILE_COMMAND = "java org.mozilla.javascript.tools.shell.Main %(lint)s --options %(options)s %(file)s"
tuple ERRORS = (IOError, )
tuple LINT = scriptrelative('jslint.js')
tuple OPTIONS = scriptrelative('jslint.opts')
tuple STATUSFILE = scriptrelative('lint.record')
tuple status = loadstatus(STATUSFILE)
 exitcode = None
tuple threads = Pool(4)
tuple work

Function Documentation

def kupu.lint.basetime (   marker)

Definition at line 55 of file lint.py.

00055 
00056 def basetime(marker):
00057     try:
00058         mtime = os.stat(marker).st_mtime
00059     except ERRORS:
00060         mtime = 0.0
00061     return mtime

def kupu.lint.filelist (   patterns,
  kw 
)

Definition at line 38 of file lint.py.

00038 
00039 def filelist(*patterns, **kw):
00040     for p in patterns:
00041         names = glob.glob(scriptrelative(p))
00042         exclude = kw.get('exclude', [])
00043         for n in names:
00044             if os.path.basename(n) in exclude:
00045                 continue
00046             yield os.path.normpath(n)

Here is the call graph for this function:

Here is the caller graph for this function:

def kupu.lint.lint (   name)

Definition at line 22 of file lint.py.

00022 
00023 def lint(name):
00024     cmd = COMPILE_COMMAND % dict(lint=LINT, file=name, options=OPTIONS)
00025     stream = os.popen(cmd)
00026     data = stream.read()
00027     rc = stream.close()
00028     return data, rc

Here is the call graph for this function:

Here is the caller graph for this function:

def kupu.lint.loadstatus (   name)

Definition at line 62 of file lint.py.

00062 
00063 def loadstatus(name):
00064     try:
00065         f = open(name, 'rb')
00066     except ERRORS:
00067         return {}
00068     try:
00069         try:
00070             data = cPickle.load(f)
00071         except EOFError:
00072             return {}
00073     finally:
00074         f.close()
00075     return data

def kupu.lint.newfiles (   status,
  patterns,
  kw 
)

Definition at line 47 of file lint.py.

00047 
00048 def newfiles(status, *patterns, **kw):
00049     for n in filelist(*patterns, **kw):
00050         mtime = os.stat(n).st_mtime
00051         if n in status and status[n] == mtime:
00052             continue
00053         status[n] = mtime
00054         yield n

Here is the call graph for this function:

def kupu.lint.savestatus (   name,
  status 
)

Definition at line 76 of file lint.py.

00076 
00077 def savestatus(name, status):
00078     f = open(name, 'wb')
00079     cPickle.dump(status, f)
00080     f.close()
00081 
# Thread pool code.
def kupu.lint.scriptrelative (   relative)
Find absolute path of file relative to this script

Definition at line 29 of file lint.py.

00029 
00030 def scriptrelative(relative):
00031     """Find absolute path of file relative to this script"""
00032     base = os.path.dirname(os.path.abspath(__file__))
00033     return os.path.join(base, relative)

Here is the caller graph for this function:


Variable Documentation

string kupu.lint.COMPILE_COMMAND = "java org.mozilla.javascript.tools.shell.Main %(lint)s --options %(options)s %(file)s"

Definition at line 16 of file lint.py.

tuple kupu.lint.ERRORS = (IOError, )

Definition at line 17 of file lint.py.

Definition at line 127 of file lint.py.

tuple kupu.lint.LINT = scriptrelative('jslint.js')

Definition at line 34 of file lint.py.

tuple kupu.lint.OPTIONS = scriptrelative('jslint.opts')

Definition at line 35 of file lint.py.

Definition at line 126 of file lint.py.

tuple kupu.lint.STATUSFILE = scriptrelative('lint.record')

Definition at line 36 of file lint.py.

tuple kupu.lint.threads = Pool(4)

Definition at line 128 of file lint.py.

Initial value:
00001 newfiles(status, 'common/*.js', 'plone/kupu_plone_layer/*.js',
00002         exclude=['diff_match_patch.js'])

Definition at line 129 of file lint.py.