# HG changeset patch # User Jeff Hammel # Date 1322175329 28800 # Node ID 73e815e13914aab15cfb49e6a585fc0713ebf0d1 # Parent c04a53145f195ef37342dbcb2f9d446dc7ea841e fix a few things diff -r c04a53145f19 -r 73e815e13914 licenser/licenses.py --- a/licenser/licenses.py Thu Nov 24 14:50:24 2011 -0800 +++ b/licenser/licenses.py Thu Nov 24 14:55:29 2011 -0800 @@ -49,7 +49,7 @@ @classmethod def match(cls, filename): basename, extension = os.path.splitext(os.path.basename(filename)) - if extension in extensions: + if extension in cls.extensions: return cls(filename) def __init__(self, filename): @@ -73,7 +73,7 @@ # open the file for writing raise NotImplementedError -class HashCommentsFile(object): +class HashCommentsFile(CommentedFile): extensions = set(['py', 'sh']) @@ -137,7 +137,7 @@ def token(self): """a token indicative of the license, by default the first line""" - return self.license.splitlines()[0].strip() + return self.license().splitlines()[0].strip() def has_license(self, filename): """does the file already have a license?""" @@ -172,7 +172,7 @@ def interpolate_file(self, _file, variables): # if the file is licensed, no need to proceed - if self.has_license(filename): + if self.has_license(_file): return # you're done # get the filetype @@ -193,10 +193,10 @@ self.interpolate_file(_file, variables) def files(self, directory): - files = set() + files = [] for dirpath, _, filenames in os.walk(directory): for f in filenames: - path = os.path.join(dirpath, f) + files.append(os.path.join(dirpath, f)) return files