def __init__(self, cw=None): CallbackType.__init__(self, cw) self.pattern = Pattern() self.cw = cw try: opts, args = getopt.getopt(cw.module_options, "hl", ["help", "license-on-top"]) except getopt.GetoptError: self.usage() raise ValueError("*** Parameter Error") self.licenseOnTop = False for option, value in opts: if option in ("-h", "--help"): self.usage() raise ValueError("*** Parameter Error") elif option in ("-l", "--license-on-top"): self.licenseOnTop = True continue else: self.usage() raise ValueError("*** Parameter Error")
def __init__(self, cw=None): CallbackType.__init__(self, cw) self.pattern = Pattern() self.cw = cw try: opts, args = getopt.getopt( cw.module_options, "ef:hnt:", ["existing-only", "file=", "help", "new-only", "type="] ) except getopt.GetoptError: self.usage() raise ValueError("*** Parameter Error") filename = None type = "text" self.existingOnly = False self.newOnly = False for option, value in opts: if option in ("-h", "--help"): self.usage() raise ValueError("*** Parameter Error") elif option in ("-e", "--existing-only"): self.existingOnly = True continue elif option in ("-f", "--file"): filename = value continue elif option in ("-n", "--new-only"): self.newOnly = True continue elif option in ("-t", "--type"): type = value continue if filename is None: self.usage() raise ValueError("*** You must supply a license file name") if not self.existingOnly and not self.newOnly: self.usage() raise ValueError("*** No Action has been selected!") if not os.path.isabs(filename): filename = os.path.join(self.cw.dirtree, filename) if self.cw.verbose: print "License file is at %s" % filename self.license = CommentPart(self.pattern.getDefinition(type), load(filename)) if len(self.license) == 0: raise ValueError("License file is empty or could not be read")
def __init__(self, cw=None): CallbackType.__init__(self, cw) self.pattern = Pattern() self.cw = cw try: opts, args = getopt.getopt(cw.module_options, "ef:hnt:", ["existing-only", "file=", "help", "new-only", "type="]) except getopt.GetoptError: self.usage() raise ValueError("*** Parameter Error") filename = None type = "text" self.existingOnly = False self.newOnly = False for option, value in opts: if option in ("-h", "--help"): self.usage() raise ValueError("*** Parameter Error") elif option in ("-e", "--existing-only"): self.existingOnly = True continue elif option in ("-f", "--file"): filename = value continue elif option in ("-n", "--new-only"): self.newOnly = True continue elif option in ("-t", "--type"): type = value continue if filename is None: self.usage() raise ValueError("*** You must supply a license file name") if not self.existingOnly and not self.newOnly: self.usage() raise ValueError("*** No Action has been selected!") if not os.path.isabs(filename): filename = os.path.join(self.cw.dirtree, filename) if self.cw.verbose: print "License file is at %s" % filename self.license = CommentPart(self.pattern.getDefinition(type), load(filename)) if len(self.license) == 0: raise ValueError("License file is empty or could not be read")
def __init__(self, cw=None): CallbackType.__init__(self, cw) self.cw = cw
def __init__(self, cw=None): CallbackType.__init__(self, cw) self.cw = cw self.pattern = Pattern()
def __init__(self, cw=None): CallbackType.__init__(self, cw)
def __init__(self, cw=None): CallbackType.__init__(self, cw) self.pattern = Pattern() self.cw = cw