File: missingWebPages.py

package info (click to toggle)
python-feedvalidator 0~svn1022-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 652 kB
  • ctags: 2,452
  • sloc: python: 9,481; makefile: 27; sh: 8
file content (54 lines) | stat: -rwxr-xr-x 1,101 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python
"""
$Id: missingWebPages.py 75 2004-03-28 07:48:21Z josephw $
Show any logging events without explanatory web pages
"""


from sys import path, argv, exit
from os.path import isfile

import inspect
import os.path

curdir = os.path.abspath(os.path.dirname(argv[0]))
BASE = os.path.split(curdir)[0]

path.insert(0, os.path.join(BASE, 'src'))
import feedvalidator.logging

# Logic from text_html.py
def getRootClass(aClass):
  bl = aClass.__bases__
  if not(bl):
    return None

  aClass = bl[0]
  bl = bl[0].__bases__

  while bl:
    base = bl[0]
    if base == feedvalidator.logging.LoggedEvent:
      return aClass
    aClass = base
    bl = aClass.__bases__
  return None

show = argv[1:] or ['warning', 'error']

areMissing=False

for n, o in inspect.getmembers(feedvalidator.logging, inspect.isclass):
  rc = getRootClass(o)
  if not(rc):
    continue

  rcname = rc.__name__.split('.')[-1].lower()
  if rcname in show:
    fn = os.path.join('docs', rcname, n + '.html')
    if not(isfile(os.path.join(BASE, fn))):
      print fn
      areMissing=True

if areMissing:
  exit(5)