本文整理汇总了Python中mesonlib.is_osx函数的典型用法代码示例。如果您正苦于以下问题:Python is_osx函数的具体用法?Python is_osx怎么用?Python is_osx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_osx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qmake_detect
def qmake_detect(self, mods, kwargs):
pc = subprocess.Popen(["qmake", "-v"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
return
stdo = stdo.decode()
if not "version 5" in stdo:
mlog.log("QMake is not for Qt5.")
return
self.version = re.search("5(\.\d+)+", stdo).match(0)
(stdo, _) = subprocess.Popen(["qmake", "-query"], stdout=subprocess.PIPE).communicate()
qvars = {}
for line in stdo.decode().split("\n"):
line = line.strip()
if line == "":
continue
(k, v) = tuple(line.split(":", 1))
qvars[k] = v
if mesonlib.is_osx():
return self.framework_detect(qvars, mods, kwargs)
incdir = qvars["QT_INSTALL_HEADERS"]
self.cargs.append("-I" + incdir)
libdir = qvars["QT_INSTALL_LIBS"]
bindir = qvars["QT_INSTALL_BINS"]
# self.largs.append('-L' + libdir)
for module in mods:
mincdir = os.path.join(incdir, "Qt" + module)
self.cargs.append("-I" + mincdir)
libfile = os.path.join(libdir, "Qt5" + module + ".lib")
if not os.path.isfile(libfile):
# MinGW links directly to .dll, not to .lib.
libfile = os.path.join(bindir, "Qt5" + module + ".dll")
self.largs.append(libfile)
self.is_found = True
示例2: __init__
def __init__(self, kwargs):
Dependency.__init__(self)
self.is_found = False
self.cargs = []
self.linkargs = []
sdlconf = shutil.which('sdl2-config')
if sdlconf:
pc = subprocess.Popen(['sdl2-config', '--cflags'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.cargs = stdo.decode().strip().split()
pc = subprocess.Popen(['sdl2-config', '--libs'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.linkargs = stdo.decode().strip().split()
self.is_found = True
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.green('YES'), '(%s)' % sdlconf)
return
try:
pcdep = PkgConfigDependency('sdl2', 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():
fwdep = ExtraFrameworkDependency('sdl2', kwargs.get('required', True))
if fwdep.found():
self.is_found = True
self.cargs = fwdep.get_compile_args()
self.linkargs = fwdep.get_link_args()
return
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.red('NO'))
示例3: find_external_dependency
def find_external_dependency(name, environment, kwargs):
required = kwargs.get("required", True)
if not isinstance(required, bool):
raise DependencyException('Keyword "required" must be a boolean.')
lname = name.lower()
if lname in packages:
dep = packages[lname](environment, kwargs)
if required and not dep.found():
raise DependencyException('Dependency "%s" not found' % name)
return dep
pkg_exc = None
pkgdep = None
try:
pkgdep = PkgConfigDependency(name, environment, kwargs)
if pkgdep.found():
return pkgdep
except Exception as e:
pkg_exc = e
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency(name, required)
if required and not fwdep.found():
raise DependencyException('Dependency "%s" not found' % name)
return fwdep
if pkg_exc is not None:
raise pkg_exc
mlog.log("Dependency", mlog.bold(name), "found:", mlog.red("NO"))
return pkgdep
示例4: __init__
def __init__(self, environment, kwargs):
Dependency.__init__(self)
self.is_found = False
self.cargs = []
self.linkargs = []
sdlconf = shutil.which("sdl2-config")
if sdlconf:
pc = subprocess.Popen(["sdl2-config", "--cflags"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.cargs = stdo.decode().strip().split()
pc = subprocess.Popen(["sdl2-config", "--libs"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.linkargs = stdo.decode().strip().split()
self.is_found = True
mlog.log("Dependency", mlog.bold("sdl2"), "found:", mlog.green("YES"), "(%s)" % sdlconf)
return
try:
pcdep = PkgConfigDependency("sdl2", 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():
fwdep = ExtraFrameworkDependency("sdl2", kwargs.get("required", True))
if fwdep.found():
self.is_found = True
self.cargs = fwdep.get_compile_args()
self.linkargs = fwdep.get_link_args()
return
mlog.log("Dependency", mlog.bold("sdl2"), "found:", mlog.red("NO"))
示例5: qmake_detect
def qmake_detect(self, mods, kwargs):
pc = subprocess.Popen(['qmake', '-v'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
return
stdo = stdo.decode()
if not 'version 5' in stdo:
mlog.log('QMake is not for Qt5.')
return
self.version = re.search('5(\.\d+)+', stdo).group(0)
(stdo, _) = subprocess.Popen(['qmake', '-query'], stdout=subprocess.PIPE).communicate()
qvars = {}
for line in stdo.decode().split('\n'):
line = line.strip()
if line == '':
continue
(k, v) = tuple(line.split(':', 1))
qvars[k] = v
if mesonlib.is_osx():
return self.framework_detect(qvars, mods, kwargs)
incdir = qvars['QT_INSTALL_HEADERS']
self.cargs.append('-I' + incdir)
libdir = qvars['QT_INSTALL_LIBS']
bindir = qvars['QT_INSTALL_BINS']
#self.largs.append('-L' + libdir)
for module in mods:
mincdir = os.path.join(incdir, 'Qt' + module)
self.cargs.append('-I' + mincdir)
libfile = os.path.join(libdir, 'Qt5' + module + '.lib')
if not os.path.isfile(libfile):
# MinGW links directly to .dll, not to .lib.
libfile = os.path.join(bindir, 'Qt5' + module + '.dll')
self.largs.append(libfile)
self.is_found = True
示例6: 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
示例7: __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
示例8: 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
示例9: gen_symbols
def gen_symbols(libfilename, outfilename, cross_host):
if cross_host is not None:
# In case of cross builds just always relink.
# In theory we could determine the correct
# toolset but there are more important things
# to do.
dummy_syms(outfilename)
elif mesonlib.is_linux():
linux_syms(libfilename, outfilename)
elif mesonlib.is_osx():
osx_syms(libfilename, outfilename)
else:
dummy_syms(outfilename)
示例10: extract_libtool_shlib
def extract_libtool_shlib(self, la_file):
"""
Returns the path to the shared library
corresponding to this .la file
"""
dlname = self.extract_dlname_field(la_file)
if dlname is None:
return None
# Darwin uses absolute paths where possible; since the libtool files never
# contain absolute paths, use the libdir field
if mesonlib.is_osx():
dlbasename = os.path.basename(dlname)
libdir = self.extract_libdir_field(la_file)
if libdir is None:
return dlbasename
return os.path.join(libdir, dlbasename)
# From the comments in extract_libtool(), older libtools had
# a path rather than the raw dlname
return os.path.basename(dlname)
示例11: find_external_dependency
def find_external_dependency(name, kwargs):
required = kwargs.get('required', True)
if not isinstance(required, bool):
raise DependencyException('Keyword "required" must be a boolean.')
if name in packages:
dep = packages[name](kwargs)
if required and not dep.found():
raise DependencyException('Dependency "%s" not found' % name)
return dep
pkg_exc = None
pkgdep = None
try:
pkgdep = PkgConfigDependency(name, required)
if pkgdep.found():
return pkgdep
except Exception as e:
pkg_exc = e
if mesonlib.is_osx():
return ExtraFrameworkDependency(name, required)
if pkg_exc is not None:
raise pkg_exc
return pkgdep
示例12: __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
示例13: detect_lib_modules_nix
def detect_lib_modules_nix(self):
libsuffix = None
if mesonlib.is_osx():
libsuffix = 'dylib'
else:
libsuffix = 'so'
globber = 'libboost_*.{}'.format(libsuffix)
if self.boost_root is None:
libdirs = mesonlib.get_library_dirs()
else:
libdirs = [os.path.join(self.boost_root, 'lib')]
for libdir in libdirs:
for entry in glob.glob(os.path.join(libdir, globber)):
lib = os.path.basename(entry)
name = lib.split('.')[0].split('_', 1)[-1]
# I'm not 100% sure what to do here. Some distros
# have modules such as thread only as -mt versions.
if entry.endswith('-mt.so'):
self.lib_modules_mt[name] = True
else:
self.lib_modules[name] = True
示例14: setup_commands
def setup_commands(backend):
global backend_flags, compile_commands, test_commands, install_commands
msbuild_exe = shutil.which('msbuild')
if backend == 'vs2010' or (backend is None and msbuild_exe is not None):
backend_flags = ['--backend=vs2010']
compile_commands = ['msbuild']
test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
install_commands = []
elif backend == 'xcode' or (backend is None and mesonlib.is_osx()):
backend_flags = ['--backend=xcode']
compile_commands = ['xcodebuild']
test_commands = ['xcodebuild', '-target', 'RUN_TESTS']
install_commands = []
else:
backend_flags = []
ninja_command = environment.detect_ninja()
if ninja_command is None:
raise RuntimeError('Could not find Ninja executable.')
if print_debug:
compile_commands = [ninja_command, '-v']
else:
compile_commands = [ninja_command]
test_commands = [ninja_command, 'test']
install_commands = [ninja_command, 'install']
示例15: 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:
#.........这里部分代码省略.........