• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mesonlib.is_windows函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mesonlib.is_windows函数的典型用法代码示例。如果您正苦于以下问题:Python is_windows函数的具体用法?Python is_windows怎么用?Python is_windows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_windows函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, name, fullpath=None, silent=False, search_dir=None):
     self.name = name
     if fullpath is not None:
         if not isinstance(fullpath, list):
             self.fullpath = [fullpath]
         else:
             self.fullpath = fullpath
     else:
         self.fullpath = [shutil.which(name)]
         if self.fullpath[0] is None and search_dir is not None:
             trial = os.path.join(search_dir, name)
             suffix = os.path.splitext(trial)[-1].lower()[1:]
             if mesonlib.is_windows() and (suffix == 'exe' or suffix == 'com'\
                                       or suffix == 'bat'):
                 self.fullpath = [trial]
             elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
                 self.fullpath = [trial]
             else:
                 # Now getting desperate. Maybe it is a script file that is a) not chmodded
                 # executable or b) we are on windows so they can't be directly executed.
                 try:
                     first_line = open(trial).readline().strip()
                     if first_line.startswith('#!'):
                         commands = first_line[2:].split('#')[0].strip().split()
                         if mesonlib.is_windows():
                             commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
                         self.fullpath = commands + [trial]
                 except Exception:
                     pass
     if not silent:
         if self.found():
             mlog.log('Program', mlog.bold(name), 'found:', mlog.green('YES'), '(%s)' % ' '.join(self.fullpath))
         else:
             mlog.log('Program', mlog.bold(name), 'found:', mlog.red('NO'))
开发者ID:itech001,项目名称:meson,代码行数:34,代码来源:dependencies.py


示例2: __init__

    def __init__(self, source_dir, build_dir, main_script_file, options):
        assert(os.path.isabs(main_script_file))
        assert(not os.path.islink(main_script_file))
        self.source_dir = source_dir
        self.build_dir = build_dir
        self.meson_script_file = main_script_file
        self.scratch_dir = os.path.join(build_dir, Environment.private_dir)
        self.log_dir = os.path.join(build_dir, Environment.log_dir)
        os.makedirs(self.scratch_dir, exist_ok=True)
        os.makedirs(self.log_dir, exist_ok=True)
        try:
            cdf = os.path.join(self.get_build_dir(), Environment.coredata_file)
            self.coredata = coredata.load(cdf)
            self.first_invocation = False
        except FileNotFoundError:
            self.coredata = coredata.CoreData(options)
            self.first_invocation = True
        if self.coredata.cross_file:
            self.cross_info = CrossBuildInfo(self.coredata.cross_file)
        else:
            self.cross_info = None
        self.cmd_line_options = options

        # List of potential compilers.
        if mesonlib.is_windows():
            self.default_c = ['cl', 'cc', 'gcc']
            self.default_cpp = ['cl', 'c++', 'g++']
        else:
            self.default_c = ['cc']
            self.default_cpp = ['c++']
        self.default_objc = ['cc']
        self.default_objcpp = ['c++']
        self.default_fortran = ['gfortran', 'g95', 'f95', 'f90', 'f77']
        self.default_static_linker = 'ar'
        self.vs_static_linker = 'lib'

        cross = self.is_cross_build()
        if (not cross and mesonlib.is_windows()) \
        or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'):
            self.exe_suffix = 'exe'
            self.import_lib_suffix = 'lib'
            self.shared_lib_suffix = 'dll'
            self.shared_lib_prefix = ''
            self.static_lib_suffix = 'lib'
            self.static_lib_prefix = ''
            self.object_suffix = 'obj'
        else:
            self.exe_suffix = ''
            if (not cross and mesonlib.is_osx()) or \
            (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'darwin'):
                self.shared_lib_suffix = 'dylib'
            else:
                self.shared_lib_suffix = 'so'
            self.shared_lib_prefix = 'lib'
            self.static_lib_suffix = 'a'
            self.static_lib_prefix = 'lib'
            self.object_suffix = 'o'
            self.import_lib_suffix = self.shared_lib_suffix
开发者ID:sayiho,项目名称:meson,代码行数:58,代码来源:environment.py


示例3: write_test_file

 def write_test_file(self, datafile):
     arr = []
     for t in self.build.get_tests():
         exe = t.get_exe()
         if isinstance(exe, dependencies.ExternalProgram):
             fname = exe.fullpath
         else:
             fname = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))]
         is_cross = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler()
         if is_cross:
             exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None)
         else:
             exe_wrapper = None
         if mesonlib.is_windows():
             extra_paths = self.determine_windows_extra_paths(exe)
         else:
             extra_paths = []
         cmd_args = []
         for a in t.cmd_args:
             if isinstance(a, mesonlib.File):
                 a = os.path.join(self.environment.get_build_dir(), a.rel_to_builddir(self.build_to_src))
             cmd_args.append(a)
         ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper,
                                t.is_parallel, cmd_args, t.env, t.should_fail, t.valgrind_args,
                                t.timeout, extra_paths)
         arr.append(ts)
     pickle.dump(arr, datafile)
开发者ID:java66liu,项目名称:meson,代码行数:27,代码来源:backends.py


示例4: get_compile_args

 def get_compile_args(self):
     args = []
     if self.boost_root is not None:
         if mesonlib.is_windows():
             args.append('-I' + self.boost_root)
         else:
             args.append('-I' + os.path.join(self.boost_root, 'include'))
     return args
开发者ID:Maratyszcza,项目名称:meson,代码行数:8,代码来源:dependencies.py


示例5: platform_fix_filename

def platform_fix_filename(fname):
    if mesonlib.is_osx():
        if fname.endswith('.so'):
            return fname[:-2] + 'dylib'
        return fname.replace('.so.', '.dylib.')
    elif mesonlib.is_windows():
        if fname.endswith('.so'):
            (p, f) = os.path.split(fname)
            f = f[3:-2] + 'dll'
            return os.path.join(p, f)
        if fname.endswith('.a'):
            return fname[:-1] + 'lib'
    return fname
开发者ID:kylemanna,项目名称:meson,代码行数:13,代码来源:run_tests.py


示例6: generate_prebuilt_object

def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        cmd = ['cc', '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
开发者ID:objectx,项目名称:meson,代码行数:14,代码来源:run_tests.py


示例7: __init__

 def __init__(self, name, fullpath=None, silent=False, search_dir=None):
     self.name = name
     self.fullpath = None
     if fullpath is not None:
         if not isinstance(fullpath, list):
             self.fullpath = [fullpath]
         else:
             self.fullpath = fullpath
     else:
         self.fullpath = [shutil.which(name)]
         if self.fullpath[0] is None and search_dir is not None:
             trial = os.path.join(search_dir, name)
             suffix = os.path.splitext(trial)[-1].lower()[1:]
             if mesonlib.is_windows() and (suffix == "exe" or suffix == "com" or suffix == "bat"):
                 self.fullpath = [trial]
             elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
                 self.fullpath = [trial]
             else:
                 # Now getting desperate. Maybe it is a script file that is a) not chmodded
                 # executable or b) we are on windows so they can't be directly executed.
                 try:
                     first_line = open(trial).readline().strip()
                     if first_line.startswith("#!"):
                         commands = first_line[2:].split("#")[0].strip().split()
                         if mesonlib.is_windows():
                             # Windows does not have /usr/bin.
                             commands[0] = commands[0].split("/")[-1]
                             if commands[0] == "env":
                                 commands = commands[1:]
                         self.fullpath = commands + [trial]
                 except Exception:
                     pass
     if not silent:
         if self.found():
             mlog.log("Program", mlog.bold(name), "found:", mlog.green("YES"), "(%s)" % " ".join(self.fullpath))
         else:
             mlog.log("Program", mlog.bold(name), "found:", mlog.red("NO"))
开发者ID:eriknelson,项目名称:meson,代码行数:37,代码来源:dependencies.py


示例8: detect_tests_to_run

def detect_tests_to_run():
    all_tests = []
    all_tests.append(('common', gather_tests('test cases/common'), False))
    all_tests.append(('failing', gather_tests('test cases/failing'), False))
    all_tests.append(('prebuilt object', gather_tests('test cases/prebuilt object'), False))

    all_tests.append(('platform-osx', gather_tests('test cases/osx'), False if mesonlib.is_osx() else True))
    all_tests.append(('platform-windows', gather_tests('test cases/windows'), False if mesonlib.is_windows() else True))
    all_tests.append(('platform-linux', gather_tests('test cases/linuxlike'), False if not (mesonlib.is_osx() or mesonlib.is_windows()) else True))
    all_tests.append(('framework', gather_tests('test cases/frameworks'), False if not mesonlib.is_osx() and not mesonlib.is_windows() else True))
    all_tests.append(('java', gather_tests('test cases/java'), False if not mesonlib.is_osx() and shutil.which('javac') else True))
    all_tests.append(('C#', gather_tests('test cases/csharp'), False if shutil.which('mcs') else True))
    all_tests.append(('vala', gather_tests('test cases/vala'), False if shutil.which('valac') else True))
    all_tests.append(('rust', gather_tests('test cases/rust'), False if shutil.which('rustc') else True))
    all_tests.append(('objective c', gather_tests('test cases/objc'), False if not mesonlib.is_windows() else True))
    all_tests.append(('fortran', gather_tests('test cases/fortran'), False if shutil.which('gfortran') else True))
    return all_tests
开发者ID:kylemanna,项目名称:meson,代码行数:17,代码来源:run_tests.py


示例9: generate_prebuilt_object

def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        if shutil.which('cc'):
            cmd = 'cc'
        elif shutil.which('gcc'):
            cmd = 'gcc'
        else:
            raise RuntimeError("Could not find C compiler.")
        cmd = [cmd, '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
开发者ID:kylemanna,项目名称:meson,代码行数:20,代码来源:run_tests.py


示例10: __init__

 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.is_found = False
     self.cargs = []
     self.linkargs = []
     try:
         pcdep = PkgConfigDependency('gl', environment, kwargs)
         if pcdep.found():
             self.is_found = True
             self.cargs = pcdep.get_compile_args()
             self.linkargs = pcdep.get_link_args()
             return
     except Exception:
         pass
     if mesonlib.is_osx():
         self.is_found = True
         self.linkargs = ['-framework', 'OpenGL']
         return
     if mesonlib.is_windows():
         self.is_found = True
         self.linkargs = ['-lopengl32']
         return
开发者ID:kylemanna,项目名称:meson,代码行数:22,代码来源:dependencies.py


示例11: get_link_args

 def get_link_args(self):
     if mesonlib.is_windows():
         return self.get_win_link_args()
     args = []
     if self.boost_root:
         args.append('-L' + os.path.join(self.boost_root, 'lib'))
     for module in self.requested_modules:
         module = BoostDependency.name2lib.get(module, module)
         if module in self.lib_modules or module in self.lib_modules_mt:
             linkcmd = '-lboost_' + module
             args.append(linkcmd)
             # FIXME a hack, but Boost's testing framework has a lot of
             # different options and it's hard to determine what to do
             # without feedback from actual users. Update this
             # as we get more bug reports.
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor')
         elif module + '-mt' in self.lib_modules_mt:
             linkcmd = '-lboost_' + module + '-mt'
             args.append(linkcmd)
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor-mt')
     return args
开发者ID:kylemanna,项目名称:meson,代码行数:23,代码来源:dependencies.py


示例12: validate_install

def validate_install(srcdir, installdir):
    if mesonlib.is_windows():
        # Don't really know how Windows installs should work
        # so skip.
        return ''
    info_file = os.path.join(srcdir, 'installed_files.txt')
    expected = {}
    found = {}
    if os.path.exists(info_file):
        for line in open(info_file):
            expected[platform_fix_filename(line.strip())] = True
    for root, _, files in os.walk(installdir):
        for fname in files:
            found_name = os.path.join(root, fname)[len(installdir)+1:]
            found[found_name] = True
    expected = set(expected)
    found = set(found)
    missing = expected - found
    for fname in missing:
        return 'Expected file %s missing.' % fname
    extra = found - expected
    for fname in extra:
        return 'Found extra file %s.' % fname
    return ''
开发者ID:kylemanna,项目名称:meson,代码行数:24,代码来源:run_tests.py


示例13: run_tests

def run_tests():
    logfile = open('meson-test-run.txt', 'w')
    commontests = gather_tests('test cases/common')
    failtests = gather_tests('test cases/failing')
    objtests = gather_tests('test cases/prebuilt object')
    if mesonlib.is_linux():
        cpuid = platform.machine()
        if cpuid != 'x86_64' and cpuid != 'i386' and cpuid != 'i686':
            # Don't have a prebuilt object file for those so skip.
            objtests = []
    if mesonlib.is_osx():
        platformtests = gather_tests('test cases/osx')
    elif mesonlib.is_windows():
        platformtests = gather_tests('test cases/windows')
    else:
        platformtests = gather_tests('test cases/linuxlike')
    if not mesonlib.is_osx() and not mesonlib.is_windows():
        frameworktests = gather_tests('test cases/frameworks')
    else:
        frameworktests = []
    if not mesonlib.is_osx() and shutil.which('javac'):
        javatests = gather_tests('test cases/java')
    else:
        javatests = []
    if shutil.which('mcs'):
        cstests = gather_tests('test cases/csharp')
    else:
        cstests = []
    if shutil.which('valac'):
        valatests = gather_tests('test cases/vala')
    else:
        valatests = []
    if shutil.which('rustc'):
        rusttests = gather_tests('test cases/rust')
    else:
        rusttests = []
    if not mesonlib.is_windows():
        objctests = gather_tests('test cases/objc')
    else:
        objctests = []
    if shutil.which('gfortran'):
        fortrantests = gather_tests('test cases/fortran')
    else:
        fortrantests = []
    try:
        os.mkdir(test_build_dir)
    except OSError:
        pass
    try:
        os.mkdir(install_dir)
    except OSError:
        pass
    print('\nRunning common tests.\n')
    [run_and_log(logfile, t) for t in commontests]
    print('\nRunning failing tests.\n')
    [run_and_log(logfile, t, False) for t in failtests]
    if len(objtests) > 0:
        print('\nRunning object inclusion tests.\n')
        [run_and_log(logfile, t) for t in objtests]
    else:
        print('\nNo object inclusion tests.\n')
    if len(platformtests) > 0:
        print('\nRunning platform dependent tests.\n')
        [run_and_log(logfile, t) for t in platformtests]
    else:
        print('\nNo platform specific tests.\n')
    if len(frameworktests) > 0:
        print('\nRunning framework tests.\n')
        [run_and_log(logfile, t) for t in frameworktests]
    else:
        print('\nNo framework tests on this platform.\n')
    if len(javatests) > 0:
        print('\nRunning java tests.\n')
        [run_and_log(logfile, t) for t in javatests]
    else:
        print('\nNot running Java tests.\n')
    if len(cstests) > 0:
        print('\nRunning C# tests.\n')
        [run_and_log(logfile, t) for t in cstests]
    else:
        print('\nNot running C# tests.\n')
    if len(valatests) > 0:
        print('\nRunning Vala tests.\n')
        [run_and_log(logfile, t) for t in valatests]
    else:
        print('\nNot running Vala tests.\n')
    if len(rusttests) > 0:
        print('\nRunning Rust tests.\n')
        [run_and_log(logfile, t) for t in rusttests]
    else:
        print('\nNot running Rust tests.\n')
    if len(objctests) > 0:
        print('\nRunning Objective C tests.\n')
        [run_and_log(logfile, t) for t in objctests]
    else:
        print('\nNo Objective C tests on this platform.\n')
    if len(fortrantests) > 0:
        print('\nRunning Fortran tests.\n')
        [run_and_log(logfile, t) for t in fortrantests]
    else:
#.........这里部分代码省略.........
开发者ID:objectx,项目名称:meson,代码行数:101,代码来源:run_tests.py


示例14: detect_lib_modules

 def detect_lib_modules(self):
     if mesonlib.is_windows():
         return self.detect_lib_modules_win()
     return self.detect_lib_modules_nix()
开发者ID:kylemanna,项目名称:meson,代码行数:4,代码来源:dependencies.py


示例15: run_with_mono

def run_with_mono(fname):
    if fname.endswith('.exe') and not mesonlib.is_windows():
        return True
    return False
开发者ID:vijaysm,项目名称:meson,代码行数:4,代码来源:meson_test.py


示例16: prefix

parser = argparse.ArgumentParser()

backendlist = ['ninja', 'vs2010', 'xcode']
build_types = ['plain', 'debug', 'debugoptimized', 'release']
layouts = ['mirror', 'flat']
warning_levels = ['1', '2', '3']

default_warning = '1'
try:
    warn_candidate = os.environ['MESON_WARN_LEVEL']
    if warn_candidate in warning_levels:
        default_warning = warn_candidate
except KeyError:
    pass

if mesonlib.is_windows():
    def_prefix = 'c:/'
else:
    def_prefix = '/usr/local'

parser.add_argument('--prefix', default=def_prefix, dest='prefix',
                    help='the installation prefix (default: %(default)s)')
parser.add_argument('--libdir', default=mesonlib.default_libdir(), dest='libdir',
                    help='the installation subdir of libraries (default: %(default)s)')
parser.add_argument('--bindir', default='bin', dest='bindir',
                    help='the installation subdir of executables (default: %(default)s)')
parser.add_argument('--includedir', default='include', dest='includedir',
                    help='relative path of installed headers (default: %(default)s)')
parser.add_argument('--datadir', default='share', dest='datadir',
                    help='relative path to the top of data file subdirectory (default: %(default)s)')
parser.add_argument('--mandir', default='share/man', dest='mandir',
开发者ID:kylemanna,项目名称:meson,代码行数:31,代码来源:meson.py



注:本文中的mesonlib.is_windows函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python message.little_endian函数代码示例发布时间:2022-05-27
下一篇:
Python mesonlib.is_osx函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap