Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 9788 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/bin/lintool (-5 / +39 lines)
Lines 16-21 Link Here
16
VERSION="0.2.3"
16
VERSION="0.2.3"
17
17
18
import sys
18
import sys
19
import re
19
import getopt
20
import getopt
20
21
21
from lintool import ebuild, changelog, digest
22
from lintool import ebuild, changelog, digest
Lines 75-87 Link Here
75
def extractFilename(path):
76
def extractFilename(path):
76
  return path
77
  return path
77
78
78
def runTests(tests,results,ins):
79
def runTests(tests,results,ins,recurse=0,seen_base_classes=[]):
79
  for j in tests:
80
  inh_re = re.compile("^inherit (.*)")
80
    j.reset()
81
81
82
  for i in ins.readlines():
82
  # don't reset things if we're an included parent class
83
  if recurse == 0:
83
    for j in tests:
84
    for j in tests:
84
      j.checkLine(i)
85
      j.reset()
86
87
  for i in ins.readlines():
88
89
    # check to see if this is an inherit instruction
90
    # if it is, recurse into this function
91
    # this causes the "include" behavior
92
    inh = inh_re.match(i);
93
    if inh:
94
      base_classes = inh.group(1).split(" ")
95
      for base_class in base_classes:
96
	# make sure we haven't seen this guy before
97
	# i don't think we should include things twice
98
	# should this ever even happen?
99
	ok_to_include = 1
100
	for already_seen in seen_base_classes:
101
	  if base_class == already_seen:
102
            ok_to_include = 0
103
104
	if ok_to_include == 1:
105
          inh_file = open("/usr/portage/eclass/" + base_class + ".eclass","r")
106
	  seen_base_classes.append(base_class)
107
	  runTests(tests,results,inh_file,1,seen_base_classes)
108
	#else:
109
	#  print "NOT RE-INHERITING: " + base_class
110
111
    # or maybe this is a regular line. if so just parse it
112
    else:
113
      for j in tests:
114
        j.checkLine(i)
115
116
  # bug out if we're just an included parent class
117
  if recurse == 1:
118
    return
85
119
86
  hasWarning = 0
120
  hasWarning = 0
87
  hasError = 0
121
  hasError = 0

Return to bug 9788