Exemplo n.º 1
0
    def check_cew(cls):
        """
        Check whether Python C extension ``cew`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        For those OSes where ``cew`` is not available,
        print a warning and return ``False`` (success).

        :rtype: bool
        """
        if not gf.is_linux():
            gf.print_warning(u"aeneas.cew     NOT AVAILABLE")
            gf.print_info(
                u"  The Python C Extension cew is not available for your OS")
            gf.print_info(
                u"  You can still run aeneas but it will be a bit slower (than Linux)"
            )
            return False
        if gf.can_run_c_extension("cew"):
            gf.print_success(u"aeneas.cew     COMPILED")
            return False
        gf.print_warning(u"aeneas.cew     NOT COMPILED")
        gf.print_info(
            u"  You can still run aeneas but it will be a bit slower")
        gf.print_info(u"  To compile the cew module, run %s" % SETUP_COMMAND)
        return True
Exemplo n.º 2
0
    def check_cew(cls):
        """
        Check whether Python C extension ``cew`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        For those OSes where ``cew`` is not available,
        print a warning and return ``False`` (success).

        :rtype: bool
        """
        """
        if not gf.is_linux():
            gf.print_warning(u"aeneas.cew     NOT AVAILABLE")
            gf.print_info(u"  The Python C Extension cew is not available for your OS")
            gf.print_info(u"  You can still run aeneas but it will be a bit slower (than Linux)")
            return False
        """
        if gf.can_run_c_extension("cew"):
            gf.print_success(u"aeneas.cew     COMPILED")
            return False
        gf.print_warning(u"aeneas.cew     NOT COMPILED")
        gf.print_info(u"  You can still run aeneas but it will be a bit slower")
        gf.print_info(u"  To compile the cew module, run %s" % SETUP_COMMAND)
        return True
Exemplo n.º 3
0
def main():
    errors, warnings, c_ext_warnings = Diagnostics.check_all()
    if errors:
        sys.exit(1)
    if c_ext_warnings:
        gf.print_warning(u"All required dependencies are met but at least one available Python C extension is not compiled")
        sys.exit(2)
    else:
        gf.print_success(u"All required dependencies are met and all available Python C extensions are compiled")
        sys.exit(0)
Exemplo n.º 4
0
def main():
    errors, warnings, c_ext_warnings = Diagnostics.check_all()
    if errors:
        sys.exit(1)
    if c_ext_warnings:
        gf.print_warning(u"All required dependencies are met but at least one Python C extension is not available")
        sys.exit(2)
    else:
        gf.print_success(u"All required dependencies are met and all available Python C extensions are working")
        sys.exit(0)
Exemplo n.º 5
0
    def check_cmfcc(cls):
        """
        Check whether Python C extension ``cmfcc`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        if gf.can_run_c_extension("cmfcc"):
            gf.print_success(u"aeneas.cmfcc   COMPILED")
            return False
        gf.print_warning(u"aeneas.cmfcc   NOT COMPILED")
        gf.print_info(u"  You can still run aeneas but it will be significantly slower")
        gf.print_info(u"  To compile the cmfcc module, run %s" % SETUP_COMMAND)
        return True
Exemplo n.º 6
0
    def check_cew(cls):
        """
        Check whether Python C extension ``cew`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        if gf.can_run_c_extension("cew"):
            gf.print_success(u"aeneas.cew     AVAILABLE")
            return False
        gf.print_warning(u"aeneas.cew     NOT AVAILABLE")
        gf.print_info(u"  You can still run aeneas but it will be a bit slower")
        gf.print_info(u"  Please refer to the installation documentation for details")
        return True
Exemplo n.º 7
0
    def check_cew(cls):
        """
        Check whether Python C extension ``cew`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        if gf.can_run_c_extension("cew"):
            gf.print_success(u"aeneas.cew     AVAILABLE")
            return False
        gf.print_warning(u"aeneas.cew     NOT AVAILABLE")
        gf.print_info(u"  You can still run aeneas but it will be a bit slower")
        gf.print_info(u"  Please refer to the installation documentation for details")
        return True
Exemplo n.º 8
0
    def check_cmfcc(cls):
        """
        Check whether Python C extension ``cmfcc`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        if gf.can_run_c_extension("cmfcc"):
            gf.print_success(u"aeneas.cmfcc   COMPILED")
            return False
        gf.print_warning(u"aeneas.cmfcc   NOT COMPILED")
        gf.print_info(u"  You can still run aeneas but it will be significantly slower")
        gf.print_info(u"  Please refer to the installation documentation for details")
        return True
Exemplo n.º 9
0
    def check_cmfcc(cls):
        """
        Check whether Python C extension ``cmfcc`` can be imported.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        if gf.can_run_c_extension("cmfcc"):
            gf.print_success(u"aeneas.cmfcc   COMPILED")
            return False
        gf.print_warning(u"aeneas.cmfcc   NOT COMPILED")
        gf.print_info(
            u"  You can still run aeneas but it will be significantly slower")
        gf.print_info(u"  To compile the cmfcc module, run %s" % SETUP_COMMAND)
        return True
Exemplo n.º 10
0
    def check_shell_encoding(cls):
        """
        Check whether ``sys.stdin`` and ``sys.stdout`` are UTF-8 encoded.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        is_in_utf8 = True
        is_out_utf8 = True
        if sys.stdin.encoding not in ["UTF-8", "UTF8"]:
            is_in_utf8 = False
        if sys.stdout.encoding not in ["UTF-8", "UTF8"]:
            is_out_utf8 = False
        if (is_in_utf8) and (is_out_utf8):
            gf.print_success(u"shell encoding OK")
        else:
            gf.print_warning(u"shell encoding WARNING")
            if not is_in_utf8:
                gf.print_warning(u"  The default input encoding of your shell is not UTF-8")
            if not is_out_utf8:
                gf.print_warning(u"  The default output encoding of your shell is not UTF-8")
            gf.print_info(u"  If you plan to use aeneas on the command line,")
            if gf.is_posix():
                gf.print_info(u"  you might want to 'export PYTHONIOENCODING=UTF-8' in your shell")
            else:
                gf.print_info(u"  you might want to 'set PYTHONIOENCODING=UTF-8' in your shell")
            return True
        return False
Exemplo n.º 11
0
    def check_shell_encoding(cls):
        """
        Check whether ``sys.stdin`` and ``sys.stdout`` are UTF-8 encoded.

        Return ``True`` on failure and ``False`` on success.

        :rtype: bool
        """
        is_in_utf8 = True
        is_out_utf8 = True
        if sys.stdin.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
            is_in_utf8 = False
        if sys.stdout.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
            is_out_utf8 = False
        if (is_in_utf8) and (is_out_utf8):
            gf.print_success(u"shell encoding OK")
        else:
            gf.print_warning(u"shell encoding WARNING")
            if not is_in_utf8:
                gf.print_warning(u"  The default input encoding of your shell is not UTF-8")
            if not is_out_utf8:
                gf.print_warning(u"  The default output encoding of your shell is not UTF-8")
            gf.print_info(u"  If you plan to use aeneas on the command line,")
            if gf.is_posix():
                gf.print_info(u"  you might want to 'export PYTHONIOENCODING=UTF-8' in your shell")
            else:
                gf.print_info(u"  you might want to 'set PYTHONIOENCODING=UTF-8' in your shell")
            return True
        return False