Changeset 84

Show
Ignore:
Timestamp:
07/11/06 09:52:27 (2 years ago)
Author:
grig
Message:

Applied pylint-related patch from Will Guaraldi (chdir to top of the package and run pylint from there, so that import issues are avoided).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/cheesecake_index.py

    r83 r84  
    843843        pylint_value = 0 
    844844        cnt = 0 
     845 
     846        # wbg: switching cwd so that pylint works correctly regarding 
     847        # running it on individual modules 
     848        original_cwd = os.getcwd() 
     849        os.chdir(package_dir) 
     850 
    845851        for pyfile in get_files_of_type(files_list, 'module'): 
    846             fullpath = os.path.join(package_dir, pyfile) 
     852            # wbg: because we change the working dir, we can use relative 
     853            # paths which pylint is happier about. 
     854            # fullpath = os.path.join(package_dir, pyfile) 
     855            fullpath = pyfile 
    847856            path, filename = os.path.split(fullpath) 
    848857            module, ext = os.path.splitext(filename) 
     
    856865            score_line = output.split("\n")[-3] 
    857866            s = re.search(r" (\d+\.\d+)/10", score_line) 
     867 
    858868            # We only take positive scores into account 
    859869            if s: 
     
    866876                pylint_value += float(score) 
    867877                cnt += 1 
     878 
     879        # wbg: switching back to the original cwd in case that's important 
     880        os.chdir(original_cwd) 
    868881 
    869882        avg_score = 0