Beispiel #1
0
    def do_deprecated_compile(self, subcmd, opts, udl_path):
        """${cmd_name}: compile a .udl file into lang resources
        
        Note: This has been deprecated in favour of `luddite just_compile'
        and the more generic functionality of the 'koext' tool.
        
        ${cmd_usage}
        ${cmd_option_list}
        If you specify '--skel' to build a skeleton Language Service
        then you must also specify one of the -G or -g|--guid options.
        The Language Service is a Python file that controls language
        support in Komodo. It requires a unique GUID (for the XPCOM
        component's class id).

        If you are just building the skeleton language service for every
        build (you can get away with this for minimal language support)
        the using a GUIDs text file to ensure the same GUID is used for
        your component from build to build is recommended. This file
        must be of the form (one entry per line):
            <lang> <guid>
        """
        log.warn("the 'skel' generation facilities of 'luddite compile' "
                 "have been deprecated in favour of (a) the simpler "
                 "'luddite just_compile' and (b) the more generic support "
                 "of the 'koext' tool")
        guid = guid_from_lang = None
        if not opts.skel:
            if opts.add_missing:
                raise Luddite("cannot specify --add-missing without --skel")
        elif opts.new_guid and opts.guid:
            raise LudditeError("cannot specify both -G and -g|--guid "
                               "options at the same time")
        elif opts.new_guid:
            guid = None
        elif opts.guid:
            if guid_pat.match(opts.guid):
                guid = norm_guid(opts.guid)
            else:
                if not exists(opts.guid):
                    raise LudditeError("`%s' is not a GUID and does not "
                                       "exist" % opts.guid)
                guid_from_lang = {}  #dict((lang, g) for lang, g in)
                for line in file(opts.guid):
                    if line.startswith("#"): continue
                    if not line.strip(): continue
                    lang, g = line.strip().split(None, 1)
                    guid_from_lang[lang] = norm_guid(g)
        else:
            raise LudditeError("must specify one of -G or -g|--guid")
        if opts.force and opts.add_missing:
            raise LudditeError("cannot specify both -f|--force and "
                               "--add-missing options at the same time")
        return commands.deprecated_compile(udl_path,
                                           skel=opts.skel,
                                           guid=guid,
                                           guid_from_lang=guid_from_lang,
                                           ext=opts.ext,
                                           force=opts.force,
                                           add_missing=opts.add_missing,
                                           log=log)
Beispiel #2
0
    def do_deprecated_compile(self, subcmd, opts, udl_path):
        """${cmd_name}: compile a .udl file into lang resources

        Note: This has been deprecated in favour of `luddite just_compile'
        and the more generic functionality of the 'koext' tool.

        ${cmd_usage}
        ${cmd_option_list}
        If you specify '--skel' to build a skeleton Language Service
        then you must also specify one of the -G or -g|--guid options.
        The Language Service is a Python file that controls language
        support in Komodo. It requires a unique GUID (for the XPCOM
        component's class id).

        If you are just building the skeleton language service for every
        build (you can get away with this for minimal language support)
        the using a GUIDs text file to ensure the same GUID is used for
        your component from build to build is recommended. This file
        must be of the form (one entry per line):
            <lang> <guid>
        """
        log.warn("the 'skel' generation facilities of 'luddite compile' "
                 "have been deprecated in favour of (a) the simpler "
                 "'luddite just_compile' and (b) the more generic support "
                 "of the 'koext' tool")
        guid = guid_from_lang = None
        if not opts.skel:
            if opts.add_missing:
                raise Luddite("cannot specify --add-missing without --skel")
        elif opts.new_guid and opts.guid:
            raise LudditeError("cannot specify both -G and -g|--guid "
                               "options at the same time")
        elif opts.new_guid:
            guid = None
        elif opts.guid:
            if guid_pat.match(opts.guid):
                guid = norm_guid(opts.guid)
            else:
                if not exists(opts.guid):
                    raise LudditeError("`%s' is not a GUID and does not "
                                       "exist" % opts.guid)
                guid_from_lang = {}  # dict((lang, g) for lang, g in)
                for line in file(opts.guid):
                    if line.startswith("#"):
                        continue
                    if not line.strip():
                        continue
                    lang, g = line.strip().split(None, 1)
                    guid_from_lang[lang] = norm_guid(g)
        else:
            raise LudditeError("must specify one of -G or -g|--guid")
        if opts.force and opts.add_missing:
            raise LudditeError("cannot specify both -f|--force and "
                               "--add-missing options at the same time")
        return commands.deprecated_compile(
            udl_path, skel=opts.skel, guid=guid,
            guid_from_lang=guid_from_lang, ext=opts.ext,
            force=opts.force, add_missing=opts.add_missing, log=log)
Beispiel #3
0
def deprecated_compile(udl_path, skel=False, guid=None, guid_from_lang=None,
                       ext=None, force=False, log=None):
    """Compile the given .udl file to Komodo language resources.
    
    DEPRECATED: The 'skel' generation in luddite has been deprecated in
    favour of the more generic support of the 'koext' tool.
    
    One of "guid" or "guid_from_lang" can be given to specify the XPCOM
    language service GUID. If neither is given then a new one will be
    generated.
    """
    # Dev Notes:
    # - Compiling builds into build/$languange/... and creates:
    #       ${language}.lexres                  lexer resource
    # - If skel is True then also build skeletons for:
    #       ko${language}_UDL_Language.py       language component
    #       ${language}.${ext}                  empty Komodo template
    # - Add support for other options that Eric had in the preceding
    #   luddite.py?
    log = log or _log
    log.debug("compile('%s', ...)", udl_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    turds = ["parser.out", "parsetab.py", "parsetab.pyc"]
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)

    # Parse and load the UDL definition.
    parse_tree = parse(udl_path)
    if parse_tree is None:
        raise LudditeError("parse failed");
    mainObj = gen.MainObj()
    analyzer = gen.Analyzer(mainObj)
    analyzer.processTree(parse_tree)
    mainObj.calcUniqueStates()

    #XXX Grr. Crappy error handling again. This should be changed to
    #    raise a LudditeError if the semanticCheck fails then just call:
    #       analyzer.semanticCheck()
    if analyzer.semanticCheck() is None:
        return 1

    def raise_force_error(path):
        raise LudditeError("`%s' already exists: use "
                           "-f|--force option to allow it to be "
                           "overwritten" % path)

    # Make sure don't trounce files before generating outputs and setup
    # output dir.
    lang_name = mainObj.languageName
    safe_lang_name = mainObj.safeLangName
    build_dir = _get_build_dir(safe_lang_name)
    if not exists(build_dir):
        log.debug("mkdir `%s'", build_dir)
        os.makedirs(build_dir)

    # Generate all outputs.
    lexres_path = join(build_dir, "lexers", safe_lang_name+".lexres")
    if exists(lexres_path):
        if not force: raise_force_error(lexres_path)
        log.debug("rm `%s'", lexres_path)
        os.remove(lexres_path)
    if not exists(dirname(lexres_path)):
        os.makedirs(dirname(lexres_path))
    log.info("create lexres `%s'", lexres_path)
    mainObj.dumpAsTable(constants.vals, lexres_path)

    if skel:
        lang_service_path \
            = join(build_dir, "components", "ko%s_UDL_Language.py" % safe_lang_name)
        if exists(lang_service_path):
            if not force: raise_force_error(lang_service_path)
            log.debug("rm `%s'", lang_service_path)
            os.remove(lang_service_path)
        if not exists(dirname(lang_service_path)):
            os.makedirs(dirname(lang_service_path))
        log.info("create lang service `%s'", lang_service_path)
        if guid is not None:
            assert guid_pat.match(guid)
            guid = norm_guid(guid)
        elif guid_from_lang:
            try:
                guid = guid_from_lang[mainObj.languageName]
            except KeyError:
                raise LudditeError("could not find `%s' in GUIDs text file"
                                   % mainObj.languageName)
        else:
            log.warn("generating new GUID for `%s' language service: it is "
                     "recommended that you use the -g|--guid option to ensure "
                     "a constant GUID from build to build",
                     mainObj.languageName)
            guid = generate_guid()
        mainObj.dumpLanguageService(lang_service_path, guid, ext=ext)

        if not ext:
            log.warn("no file extension was given: no skeleton "
                     "Komodo templates will be created")
        else:
            template_paths = [
                join(build_dir, "templates", "All Languages",
                     safe_lang_name+ext),
                join(build_dir, "templates", "Common", safe_lang_name+ext),
            ]
            for template_path in template_paths:
                if exists(template_path):
                    if not force: raise_force_error(template_path)
                    log.debug("rm `%s'", template_path)
                    os.remove(template_path)
                if not exists(dirname(template_path)):
                    os.makedirs(dirname(template_path))
                log.info("create template `%s'", template_path)
                mainObj.generateKomodoTemplateFile(template_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)
Beispiel #4
0
def deprecated_compile(udl_path, skel=False, guid=None, guid_from_lang=None,
                       ext=None, force=False, add_missing=False, log=None,
                       version=None, creator=None, ext_id=None,
                       description=None):
    """Compile the given .udl file to Komodo language resources.
    
    DEPRECATED: The 'skel' generation in luddite has been deprecated in
    favour of the more generic support of the 'koext' tool.
    
    One of "guid" or "guid_from_lang" can be given to specify the XPCOM
    language service GUID. If neither is given then a new one will be
    generated.
    """
    # Dev Notes:
    # - Compiling builds into build/$languange/... and creates:
    #       ${language}.lexres                  lexer resource
    # - If skel is True then also build skeletons for:
    #       ko${language}_UDL_Language.py       language component
    #       ${language}.${ext}                  empty Komodo template
    # - Add support for other options that Eric had in the preceding
    #   luddite.py?
    log = log or _log
    log.debug("compile('%s', ...)", udl_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    turds = ["parser.out", "parsetab.py", "parsetab.pyc"]
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)

    # Parse and load the UDL definition.
    parse_tree = parse(udl_path)
    if parse_tree is None:
        raise LudditeError("parse failed");
    mainObj = gen.MainObj()
    analyzer = gen.Analyzer(mainObj)
    analyzer.processTree(parse_tree)
    mainObj.calcUniqueStates()

    #XXX Grr. Crappy error handling again. This should be changed to
    #    raise a LudditeError if the semanticCheck fails then just call:
    #       analyzer.semanticCheck()
    if analyzer.semanticCheck() is None:
        return 1

    def raise_force_error(path):
        raise LudditeError("`%s' already exists: use "
                           "-f|--force option to allow it to be "
                           "overwritten" % path)

    # Make sure don't trounce files before generating outputs and setup
    # output dir.
    lang_name = mainObj.languageName
    safe_lang_name = mainObj.safeLangName
    build_dir = _get_build_dir(safe_lang_name)
    if not exists(build_dir):
        log.debug("mkdir `%s'", build_dir)
        os.makedirs(build_dir)

    # Generate all outputs.
    lexres_path = join(build_dir, "lexers", safe_lang_name+".lexres")
    lexres_exists = exists(lexres_path)
    if lexres_exists and not force:
        if not add_missing:
            raise_force_error(lexres_path)
    else:
        if lexres_exists:
            log.debug("rm `%s'", lexres_path)
            os.remove(lexres_path)
        elif not exists(dirname(lexres_path)):
            os.makedirs(dirname(lexres_path))
        log.info("create lexres `%s'", lexres_path)
        mainObj.dumpAsTable(constants.vals, lexres_path)

    if skel:
        lang_service_path \
            = join(build_dir, "components", "ko%s_UDL_Language.py" % safe_lang_name)
        lang_service_exists = exists(lang_service_path)
        if lang_service_exists and not force:
            if not add_missing:
                raise_force_error(lang_service_path)
        else:
            if lang_service_exists:
                log.debug("rm `%s'", lang_service_path)
                os.remove(lang_service_path)
            elif not exists(dirname(lang_service_path)):
                os.makedirs(dirname(lang_service_path))
            log.info("create lang service `%s'", lang_service_path)
            if guid is not None:
                assert guid_pat.match(guid)
                guid = norm_guid(guid)
            elif guid_from_lang:
                try:
                    guid = guid_from_lang[mainObj.languageName]
                except KeyError:
                    if not add_missing:
                        raise LudditeError("could not find `%s' in GUIDs text file"
                                           % mainObj.languageName)
            else:
                log.warn("generating new GUID for `%s' language service: it is "
                         "recommended that you use the -g|--guid option to ensure "
                         "a constant GUID from build to build",
                         mainObj.languageName)
                guid = generate_guid()
            if guid is not None:
                mainObj.dumpLanguageService(lang_service_path, guid, ext=ext,
                                            add_missing=add_missing)

        if not ext:
            log.warn("no file extension was given: no skeleton "
                     "Komodo templates will be created")
        else:
            template_paths = [
                join(build_dir, "templates", "All Languages",
                     safe_lang_name+ext),
                join(build_dir, "templates", "Common", safe_lang_name+ext),
            ]
            for template_path in template_paths:
                template_exists = exists(template_path)
                if template_exists and not force:
                    if not add_missing:
                        raise_force_error(template_path)
                else:
                    if template_exists:
                        log.debug("rm `%s'", template_path)
                        os.remove(template_path)
                    elif not exists(dirname(template_path)):
                        os.makedirs(dirname(template_path))
                    log.info("create template `%s'", template_path)
                    mainObj.generateKomodoTemplateFile(template_path)

    # Create the extension's install.rdf if necessary.
    install_rdf_path = join(build_dir, "install.rdf")
    if not exists(install_rdf_path):
        name = lang_name + " Language"
        codename = _codename_from_name(name)
        if ext_id is None:
            ext_id = "*****@*****.**" % codename
        if version is None:
            version = "1.0.0"
            log.warn("defaulting 'version' to '%s' (use version option)",
                     version)
        #else:
        #    XXX validate version
        if description is None:
            description = "%s language support for Komodo (UDL-based)" % lang_name
        if creator is None:
            creator = "Anonymous Coward"
            log.warn("defaulting 'creator' to '%s' (use creator option)", creator)
    
        install_rdf_in = join(dirname(constants.__file__), "install.rdf.in")
        log.debug("reading 'install.rdf' template from '%s'", install_rdf_in)
        install_rdf_template = string.Template(open(install_rdf_in, 'r').read())
        install_rdf = install_rdf_template.substitute(
            id=ext_id, name=name, codename=codename, version=version,
            description=description, creator=creator)
        log.info("create `%s'", install_rdf_path)
        fout = open(install_rdf_path, 'w')
        fout.write(install_rdf)
        fout.close()

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)
Beispiel #5
0
def deprecated_compile(udl_path,
                       skel=False,
                       guid=None,
                       guid_from_lang=None,
                       ext=None,
                       force=False,
                       add_missing=False,
                       log=None,
                       version=None,
                       creator=None,
                       ext_id=None,
                       description=None):
    """Compile the given .udl file to Komodo language resources.
    
    DEPRECATED: The 'skel' generation in luddite has been deprecated in
    favour of the more generic support of the 'koext' tool.
    
    One of "guid" or "guid_from_lang" can be given to specify the XPCOM
    language service GUID. If neither is given then a new one will be
    generated.
    """
    # Dev Notes:
    # - Compiling builds into build/$languange/... and creates:
    #       ${language}.lexres                  lexer resource
    # - If skel is True then also build skeletons for:
    #       ko${language}_UDL_Language.py       language component
    #       ${language}.${ext}                  empty Komodo template
    # - Add support for other options that Eric had in the preceding
    #   luddite.py?
    log = log or _log
    log.debug("compile('%s', ...)", udl_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    turds = ["parser.out", "parsetab.py", "parsetab.pyc"]
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)

    # Parse and load the UDL definition.
    parse_tree = parse(udl_path)
    if parse_tree is None:
        raise LudditeError("parse failed")
    mainObj = gen.MainObj()
    analyzer = gen.Analyzer(mainObj)
    analyzer.processTree(parse_tree)
    mainObj.calcUniqueStates()

    #XXX Grr. Crappy error handling again. This should be changed to
    #    raise a LudditeError if the semanticCheck fails then just call:
    #       analyzer.semanticCheck()
    if analyzer.semanticCheck() is None:
        return 1

    def raise_force_error(path):
        raise LudditeError("`%s' already exists: use "
                           "-f|--force option to allow it to be "
                           "overwritten" % path)

    # Make sure don't trounce files before generating outputs and setup
    # output dir.
    lang_name = mainObj.languageName
    safe_lang_name = mainObj.safeLangName
    build_dir = _get_build_dir(safe_lang_name)
    if not exists(build_dir):
        log.debug("mkdir `%s'", build_dir)
        os.makedirs(build_dir)

    # Generate all outputs.
    lexres_path = join(build_dir, "lexers", safe_lang_name + ".lexres")
    lexres_exists = exists(lexres_path)
    if lexres_exists and not force:
        if not add_missing:
            raise_force_error(lexres_path)
    else:
        if lexres_exists:
            log.debug("rm `%s'", lexres_path)
            os.remove(lexres_path)
        elif not exists(dirname(lexres_path)):
            os.makedirs(dirname(lexres_path))
        log.info("create lexres `%s'", lexres_path)
        mainObj.dumpAsTable(constants.vals, lexres_path)

    if skel:
        lang_service_path \
            = join(build_dir, "components", "ko%s_UDL_Language.py" % safe_lang_name)
        lang_service_exists = exists(lang_service_path)
        if lang_service_exists and not force:
            if not add_missing:
                raise_force_error(lang_service_path)
        else:
            if lang_service_exists:
                log.debug("rm `%s'", lang_service_path)
                os.remove(lang_service_path)
            elif not exists(dirname(lang_service_path)):
                os.makedirs(dirname(lang_service_path))
            log.info("create lang service `%s'", lang_service_path)
            if guid is not None:
                assert guid_pat.match(guid)
                guid = norm_guid(guid)
            elif guid_from_lang:
                try:
                    guid = guid_from_lang[mainObj.languageName]
                except KeyError:
                    if not add_missing:
                        raise LudditeError(
                            "could not find `%s' in GUIDs text file" %
                            mainObj.languageName)
            else:
                log.warn(
                    "generating new GUID for `%s' language service: it is "
                    "recommended that you use the -g|--guid option to ensure "
                    "a constant GUID from build to build",
                    mainObj.languageName)
                guid = generate_guid()
            if guid is not None:
                mainObj.dumpLanguageService(lang_service_path,
                                            guid,
                                            ext=ext,
                                            add_missing=add_missing)

        if not ext:
            log.warn("no file extension was given: no skeleton "
                     "Komodo templates will be created")
        else:
            template_paths = [
                join(build_dir, "templates", "All Languages",
                     safe_lang_name + ext),
                join(build_dir, "templates", "Common", safe_lang_name + ext),
            ]
            for template_path in template_paths:
                template_exists = exists(template_path)
                if template_exists and not force:
                    if not add_missing:
                        raise_force_error(template_path)
                else:
                    if template_exists:
                        log.debug("rm `%s'", template_path)
                        os.remove(template_path)
                    elif not exists(dirname(template_path)):
                        os.makedirs(dirname(template_path))
                    log.info("create template `%s'", template_path)
                    mainObj.generateKomodoTemplateFile(template_path)

    # Create the extension's install.rdf if necessary.
    install_rdf_path = join(build_dir, "install.rdf")
    if not exists(install_rdf_path):
        name = lang_name + " Language"
        codename = _codename_from_name(name)
        if ext_id is None:
            ext_id = "*****@*****.**" % codename
        if version is None:
            version = "1.0.0"
            log.warn("defaulting 'version' to '%s' (use version option)",
                     version)
        #else:
        #    XXX validate version
        if description is None:
            description = "%s language support for Komodo (UDL-based)" % lang_name
        if creator is None:
            creator = "Anonymous Coward"
            log.warn("defaulting 'creator' to '%s' (use creator option)",
                     creator)

        install_rdf_in = join(dirname(constants.__file__), "install.rdf.in")
        log.debug("reading 'install.rdf' template from '%s'", install_rdf_in)
        install_rdf_template = string.Template(
            open(install_rdf_in, 'r').read())
        install_rdf = install_rdf_template.substitute(id=ext_id,
                                                      name=name,
                                                      codename=codename,
                                                      version=version,
                                                      description=description,
                                                      creator=creator)
        log.info("create `%s'", install_rdf_path)
        fout = open(install_rdf_path, 'w')
        fout.write(install_rdf)
        fout.close()

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)
Beispiel #6
0
def deprecated_compile(udl_path,
                       skel=False,
                       guid=None,
                       guid_from_lang=None,
                       ext=None,
                       force=False,
                       log=None):
    """Compile the given .udl file to Komodo language resources.
    
    DEPRECATED: The 'skel' generation in luddite has been deprecated in
    favour of the more generic support of the 'koext' tool.
    
    One of "guid" or "guid_from_lang" can be given to specify the XPCOM
    language service GUID. If neither is given then a new one will be
    generated.
    """
    # Dev Notes:
    # - Compiling builds into build/$languange/... and creates:
    #       ${language}.lexres                  lexer resource
    # - If skel is True then also build skeletons for:
    #       ko${language}_UDL_Language.py       language component
    #       ${language}.${ext}                  empty Komodo template
    # - Add support for other options that Eric had in the preceding
    #   luddite.py?
    log = log or _log
    log.debug("compile('%s', ...)", udl_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    turds = ["parser.out", "parsetab.py", "parsetab.pyc"]
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)

    # Parse and load the UDL definition.
    parse_tree = parse(udl_path)
    if parse_tree is None:
        raise LudditeError("parse failed")
    mainObj = gen.MainObj()
    analyzer = gen.Analyzer(mainObj)
    analyzer.processTree(parse_tree)
    mainObj.calcUniqueStates()

    #XXX Grr. Crappy error handling again. This should be changed to
    #    raise a LudditeError if the semanticCheck fails then just call:
    #       analyzer.semanticCheck()
    if analyzer.semanticCheck() is None:
        return 1

    def raise_force_error(path):
        raise LudditeError("`%s' already exists: use "
                           "-f|--force option to allow it to be "
                           "overwritten" % path)

    # Make sure don't trounce files before generating outputs and setup
    # output dir.
    lang_name = mainObj.languageName
    safe_lang_name = mainObj.safeLangName
    build_dir = _get_build_dir(safe_lang_name)
    if not exists(build_dir):
        log.debug("mkdir `%s'", build_dir)
        os.makedirs(build_dir)

    # Generate all outputs.
    lexres_path = join(build_dir, "lexers", safe_lang_name + ".lexres")
    if exists(lexres_path):
        if not force: raise_force_error(lexres_path)
        log.debug("rm `%s'", lexres_path)
        os.remove(lexres_path)
    if not exists(dirname(lexres_path)):
        os.makedirs(dirname(lexres_path))
    log.info("create lexres `%s'", lexres_path)
    mainObj.dumpAsTable(constants.vals, lexres_path)

    if skel:
        lang_service_path \
            = join(build_dir, "components", "ko%s_UDL_Language.py" % safe_lang_name)
        if exists(lang_service_path):
            if not force: raise_force_error(lang_service_path)
            log.debug("rm `%s'", lang_service_path)
            os.remove(lang_service_path)
        if not exists(dirname(lang_service_path)):
            os.makedirs(dirname(lang_service_path))
        log.info("create lang service `%s'", lang_service_path)
        if guid is not None:
            assert guid_pat.match(guid)
            guid = norm_guid(guid)
        elif guid_from_lang:
            try:
                guid = guid_from_lang[mainObj.languageName]
            except KeyError:
                raise LudditeError("could not find `%s' in GUIDs text file" %
                                   mainObj.languageName)
        else:
            log.warn(
                "generating new GUID for `%s' language service: it is "
                "recommended that you use the -g|--guid option to ensure "
                "a constant GUID from build to build", mainObj.languageName)
            guid = generate_guid()
        mainObj.dumpLanguageService(lang_service_path, guid, ext=ext)

        if not ext:
            log.warn("no file extension was given: no skeleton "
                     "Komodo templates will be created")
        else:
            template_paths = [
                join(build_dir, "templates", "All Languages",
                     safe_lang_name + ext),
                join(build_dir, "templates", "Common", safe_lang_name + ext),
            ]
            for template_path in template_paths:
                if exists(template_path):
                    if not force: raise_force_error(template_path)
                    log.debug("rm `%s'", template_path)
                    os.remove(template_path)
                if not exists(dirname(template_path)):
                    os.makedirs(dirname(template_path))
                log.info("create template `%s'", template_path)
                mainObj.generateKomodoTemplateFile(template_path)

    # Clean up after PLY. It leaves some turds that can break subsequent
    # parsing if the parser source is changed.
    for turd in turds:
        if exists(turd):
            log.debug("remove `%s'", turd)
            os.remove(turd)