Mercurial > mozilla > hg > licenser
changeset 19:73e815e13914
fix a few things
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 24 Nov 2011 14:55:29 -0800 |
parents | c04a53145f19 |
children | 272e10163900 |
files | licenser/licenses.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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