Beispiel #1
0
def _match_uplid_ver(uplid, mask):
    if mask == '*' or uplid == '*':
        return True

    build_ver = uplid.split('.')
    mask_ver = mask.split('.')

    mask_ver.extend(['0'] * (len(build_ver) - len(mask_ver)))

    index = 0
    while index < len(build_ver):
        build_subv = build_ver[index]
        mask_subv = mask_ver[index]

        if (not sysutil.is_int_string(build_subv) or
                not sysutil.is_int_string(mask_subv)):
            if build_subv != mask_subv:
                return False
        else:
            if int(mask_subv) < int(build_subv):
                return True
            elif int(mask_subv) > int(build_subv):
                return False

        index += 1

    return len(mask_ver) <= len(build_ver)
Beispiel #2
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in ('win32', 'cygwin', 'linux', 'aix', 'sunos',
                            'darwin', 'freebsd'):
        print('Unsupported platform: %s' % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == 'win32' and not sysutil.is_mingw_environment():
        print('This tool is used to configure unix-style environment '
              'variables. On Windows platforms it must be run from a unix '
              'shell environment, either cygwin, or mingw/msys/msysgit')
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = 'set'
    else:
        command = args[0]

    if command not in ('set', 'unset', 'list'):
        print('Invalid command: %s' % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == 'unset':
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print('No valid compilers on this machine.', file=sys.stderr)
        sys.exit(1)

    if command == 'list':
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:

        for c in compiler_infos:
            if c.key() == options.compiler:
                info = c

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(
            info.type_, info.version)
    print_envs(options, info)
Beispiel #3
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in ('win32', 'cygwin', 'linux', 'aix', 'sunos',
                            'darwin'):
        print('Unsupported platform: %s' % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == 'win32' and not sysutil.is_mingw_environment():
        print('This tool is used to configure unix-style environment '
              'variables. On Windows platforms it must be run from a unix '
              'shell environment, either cygwin, or mingw/msys/msysgit')
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = 'set'
    else:
        command = args[0]

    if command not in ('set', 'unset', 'list'):
        print('Invalid command: %s' % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == 'unset':
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print('No valid compilers on this machine.', file=sys.stderr)
        sys.exit(1)

    if command == 'list':
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:

        for c in compiler_infos:
            if c.key() == options.compiler:
                info = c

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(info.type_, info.version)
    print_envs(options, info)
Beispiel #4
0
 def _is_valid(version):
     return (sysutil.is_int_string(version.major)
             and sysutil.is_int_string(version.minor)
             and sysutil.is_int_string(version.patch))
Beispiel #5
0
 def _is_valid(version):
     return (sysutil.is_int_string(version.major) and
             sysutil.is_int_string(version.minor) and
             sysutil.is_int_string(version.patch))
Beispiel #6
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in (
            "win32",
            "cygwin",
            "linux",
            "aix",
            "sunos",
            "darwin",
            "freebsd",
    ):
        print("Unsupported platform: %s" % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == "win32" and not sysutil.is_mingw_environment():
        print("This tool is used to configure unix-style environment "
              "variables. On Windows platforms it must be run from a unix "
              "shell environment, either cygwin, or mingw/msys/msysgit")
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = "set"
    else:
        command = args[0]

    if command not in ("set", "unset", "list"):
        print("Invalid command: %s" % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == "unset":
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print("No valid compilers on this machine.", file=sys.stderr)
        sys.exit(1)

    if command == "list":
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:
        for c in compiler_infos:
            if c.key().startswith(options.compiler):
                info = c
                break

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(
            info.type_, info.version)
    print_envs(options, info)