示例#1
0
    def _klc_write_footer(self, layout, buf):
        language_name = layout.target("win").get("languageName", "Undefined")
        lcid = lcidlib.get(layout.locale) or 0x0C00
        layout_name = layout.native_display_name

        buf.write("\nDESCRIPTIONS\n\n")
        buf.write("%04x\t%s\n" % (lcid, layout_name))

        buf.write("\nLANGUAGENAMES\n\n")
        buf.write("%04x\t%s\n" % (lcid, language_name))

        buf.write("ENDKBD\n")
示例#2
0
文件: win.py 项目: bbqsrc/kbdgen
    def _klc_write_footer(self, layout, buf):
        language_name = layout.target("win").get("languageName", "Undefined")
        lcid = lcidlib.get(layout.locale) or 0x0C00
        layout_name = layout.native_display_name

        buf.write("\nDESCRIPTIONS\n\n")
        buf.write("%04x\t%s\n" % (lcid, layout_name))

        buf.write("\nLANGUAGENAMES\n\n")
        buf.write("%04x\t%s\n" % (lcid, language_name))

        buf.write("ENDKBD\n")
示例#3
0
    def sanity_check(self):
        if super().sanity_check() is False:
            return False
        pfx = self._project.target("win").get("codeSignPfx", None)
        codesign_pw = os.environ.get("CODESIGN_PW", None)

        if pfx is not None and codesign_pw is None:
            logger.error(
                "Environment variable CODESIGN_PW must be set for a release build."
            )
            return False
        elif pfx is None:
            logger.warn("No code signing PFX was provided; setup will not be signed.")

        if self._project.organisation == "":
            logger.warn("Property 'organisation' is undefined for this project.")
        if self._project.copyright == "":
            logger.warn("Property 'copyright' is undefined for this project.")

        if self._project.target("win").get("version", None) is None:
            logger.error(
                "Property 'targets.win.version' must be defined in the "
                + "project for this target."
            )
            return False

        guid = self._project.target("win").get("uuid", None)
        if guid is None:
            logger.error(
                "Property 'targets.win.uuid' must be defined in the project "
                + "for this target."
            )
            return False
        try:
            uuid.UUID(guid)
        except Exception:
            logger.error("Property 'targets.win.uuid' is not a valid UUID.")
            return False

        for layout in self.supported_layouts.values():
            lcid = lcidlib.get(layout.locale)
            if lcid is None and layout.target("win").get("locale", None) is None:
                logger.error(
                    dedent(
                        """\
                Layout '%s' specifies a locale not recognised by Windows.
                To solve this issue, insert the below into the relevant layout file with the ISO 639-3 code plus the written script of the language in BCP 47 format:

                targets:
                  win:
                    locale: xyz-Latn
                """  # noqa: E501
                    )
                    % layout.internal_name
                )
                return False

            if lcid is None and layout.target("win").get("languageName", None) is None:
                logger.error(
                    dedent(
                        """\
                Layout '%s' requires the display name for the language to be supplied.

                targets:
                  win:
                    languageName: Pig Latin
                """
                    )
                )

        fail = False
        ids = []
        for layout in self.supported_layouts.values():
            id_ = self._klc_get_name(layout)
            if id_ in ids:
                fail = True
                msg = (
                    "Duplicate id found for '%s': '%s'; "
                    + "set targets.win.id to override."
                )
                logger.error(msg, layout.internal_name, id_)
            else:
                ids.append(id_)

        if fail:
            return False

        if not self.is_release:
            return True

        if not is_windows:
            # Check for wine
            if not shutil.which("wine"):
                logger.error("`wine` must exist on your PATH to build keyboard DLLs.")
                return False

            # Check wine version
            out, err = subprocess.Popen(
                ["wine", "--version"], stdout=subprocess.PIPE
            ).communicate()
            v_chunks = [int(x) for x in out.decode().split("-").pop().split(".")]
            if v_chunks[0] < 2 or (v_chunks[0] == 2 and v_chunks[1] < 10):
                logger.warn(
                    "Builds are not known to succeed with Wine versions less than "
                    + "2.10; here be dragons."
                )

        # Check for INNO_PATH
        if self.get_inno_setup_dir() is None:
            logger.error(
                "Inno Setup 6 must be installed or INNO_PATH environment variable must "
                + "point to the Inno Setup 6 directory."
            )
            return False

        # Check for MSKLC_PATH
        if self.get_msklc_dir() is None:
            logger.error(
                "Microsoft Keyboard Layout Creator 1.4 must be installed or MSKLC_PATH "
                + "environment variable must point to the MSKLC directory."
            )
            return False

        return True
示例#4
0
文件: win.py 项目: bbqsrc/kbdgen
    def sanity_check(self):
        if super().sanity_check() is False:
            return False
        pfx = self._project.target("win").get("codeSignPfx", None)
        codesign_pw = os.environ.get("CODESIGN_PW", None)

        if pfx is not None and codesign_pw is None:
            logger.error(
                "Environment variable CODESIGN_PW must be set for a release build."
            )
            return False
        elif pfx is None:
            logger.warn("No code signing PFX was provided; setup will not be signed.")

        if self._project.organisation == "":
            logger.warn("Property 'organisation' is undefined for this project.")
        if self._project.copyright == "":
            logger.warn("Property 'copyright' is undefined for this project.")

        if self._project.target("win").get("version", None) is None:
            logger.error(
                "Property 'targets.win.version' must be defined in the "
                + "project for this target."
            )
            return False

        guid = self._project.target("win").get("uuid", None)
        if guid is None:
            logger.error(
                "Property 'targets.win.uuid' must be defined in the project "
                + "for this target."
            )
            return False
        try:
            uuid.UUID(guid)
        except Exception:
            logger.error("Property 'targets.win.uuid' is not a valid UUID.")
            return False

        for layout in self.supported_layouts.values():
            lcid = lcidlib.get(layout.locale)
            if lcid is None and layout.target("win").get("locale", None) is None:
                logger.error(
                    dedent(
                        """\
                Layout '%s' specifies a locale not recognised by Windows.
                To solve this issue, insert the below into the relevant layout file with the ISO 639-3 code plus the written script of the language in BCP 47 format:

                targets:
                  win:
                    locale: xyz-Latn
                """  # noqa: E501
                    )
                    % layout.internal_name
                )
                return False

            if lcid is None and layout.target("win").get("languageName", None) is None:
                logger.error(
                    dedent(
                        """\
                Layout '%s' requires the display name for the language to be supplied.

                targets:
                  win:
                    languageName: Pig Latin
                """
                    )
                )

        fail = False
        ids = []
        for layout in self.supported_layouts.values():
            id_ = self._klc_get_name(layout)
            if id_ in ids:
                fail = True
                msg = (
                    "Duplicate id found for '%s': '%s'; "
                    + "set targets.win.id to override."
                )
                logger.error(msg, layout.internal_name, id_)
            else:
                ids.append(id_)

        if fail:
            return False

        if not self.is_release:
            return True

        if not is_windows:
            # Check for wine
            if not shutil.which("wine"):
                logger.error("`wine` must exist on your PATH to build keyboard DLLs.")
                return False

            # Check wine version
            out, err = subprocess.Popen(
                ["wine", "--version"], stdout=subprocess.PIPE
            ).communicate()
            v_chunks = [int(x) for x in out.decode().split("-").pop().split(".")]
            if v_chunks[0] < 2 or (v_chunks[0] == 2 and v_chunks[1] < 10):
                logger.warn(
                    "Builds are not known to succeed with Wine versions less than "
                    + "2.10; here be dragons."
                )

        # Check for INNO_PATH
        if self.get_inno_setup_dir() is None:
            logger.error(
                "Inno Setup 5 must be installed or INNO_PATH environment variable must "
                + "point to the Inno Setup 5 directory."
            )
            return False

        # Check for MSKLC_PATH
        if self.get_msklc_dir() is None:
            logger.error(
                "Microsoft Keyboard Layout Creator 1.4 must be installed or MSKLC_PATH "
                + "environment variable must point to the MSKLC directory."
            )
            return False

        return True