本文整理汇总了Python中waflib.Utils.unversioned_sys_platform方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.unversioned_sys_platform方法的具体用法?Python Utils.unversioned_sys_platform怎么用?Python Utils.unversioned_sys_platform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.unversioned_sys_platform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getGeneralFlags
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
flags['CXXFLAGS'] += ['-std=c++14']
if Utils.unversioned_sys_platform() == 'linux':
flags['LINKFLAGS'] += ['-fuse-ld=gold']
elif Utils.unversioned_sys_platform() == 'freebsd':
flags['LINKFLAGS'] += ['-fuse-ld=lld']
return flags
示例2: configure_paths
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def configure_paths(ctx):
"""Setup blender paths"""
# Get the username
user = getuser()
_platform = Utils.unversioned_sys_platform()
config_path = {"user": "", "system": ""}
if _platform.startswith("linux"):
config_path["user"] = "/home/%s/.config/blender/" % user
config_path["system"] = "/usr/share/blender/"
elif _platform == "darwin":
# MAC OS X
config_path["user"] = "/Users/%s/Library/Application Support/Blender/" % user
config_path["system"] = "/Library/Application Support/Blender/"
elif Utils.is_win32:
# Windows
appdata_path = ctx.getenv("APPDATA").replace("\\", "/")
homedrive = ctx.getenv("HOMEDRIVE").replace("\\", "/")
config_path["user"] = "%s/Blender Foundation/Blender/" % appdata_path
config_path["system"] = "%sAll Users/AppData/Roaming/Blender Foundation/Blender/" % homedrive
else:
ctx.fatal("Unsupported platform. " "Available platforms: Linux, OSX, MS-Windows.")
blender_version = ctx.env["BLENDER_VERSION"]
config_path["user"] += blender_version + "/"
config_path["system"] += blender_version + "/"
ctx.env["BLENDER_CONFIG_DIR"] = os.path.abspath(config_path["user"])
if ctx.options.directory_system:
ctx.env["BLENDER_CONFIG_DIR"] = config_path["system"]
ctx.env["BLENDER_ADDONS_DIR"] = os.path.join(ctx.env["BLENDER_CONFIG_DIR"], "scripts/addons")
Utils.check_dir(ctx.env["BLENDER_ADDONS_DIR"])
示例3: getGeneralFlags
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
flags["CXXFLAGS"] += ["-std=c++11"]
if Utils.unversioned_sys_platform() == "darwin":
flags["CXXFLAGS"] += ["-stdlib=libc++"]
flags["LINKFLAGS"] += ["-stdlib=libc++"]
return flags
示例4: _defaultValue
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def _defaultValue( _values ):
PLATFORM = Utils.unversioned_sys_platform()
if PLATFORM in _values:
return _values[ PLATFORM ]
return None
示例5: init_dirs
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def init_dirs(self):
# Waf calls this function to set the output directory.
# Waf sets the output dir in the following order
# 1) Check whether the -o option has been specified
# 2) Check whether the wscript has an out variable defined
# 3) Fall-back and use the name of the lock-file
#
# In order to not surprise anybody we will disallow the out variable
# but allow our output dir to be overwritten by using the -o option
assert(getattr(Context.g_module, Context.OUT, None) is None)
if not Options.options.out:
if self.has_tool_option('cxx_mkspec'):
mkspec = self.get_tool_option('cxx_mkspec')
self.out_dir = os.path.join("build", mkspec)
else:
build_platform = Utils.unversioned_sys_platform()
self.out_dir = os.path.join("build", build_platform)
# Use the _debug postfix for debug builds
if self.has_tool_option('cxx_debug'):
self.out_dir += '_debug'
super(ToolchainConfigurationContext, self).init_dirs()
示例6: configure_env
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def configure_env(self, cfg, env):
super(sitl, self).configure_env(cfg, env)
env.DEFINES.update(
CONFIG_HAL_BOARD = 'HAL_BOARD_SITL',
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_NONE',
AP_SCRIPTING_CHECKS = 1, # SITL should always do runtime scripting checks
)
env.CXXFLAGS += [
'-Werror=float-equal'
]
if not cfg.env.DEBUG:
env.CXXFLAGS += [
'-O3',
]
env.LIB += [
'm',
]
cfg.check_librt(env)
env.LINKFLAGS += ['-pthread',]
env.AP_LIBRARIES += [
'AP_HAL_SITL',
'SITL',
]
if cfg.options.enable_sfml:
if not cfg.check_SFML(env):
cfg.fatal("Failed to find SFML libraries")
env.CXXFLAGS += ['-DWITH_SITL_OSD','-DOSD_ENABLED=ENABLED','-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
import fnmatch
for f in os.listdir('libraries/AP_OSD/fonts'):
if fnmatch.fnmatch(f, "font*bin"):
env.ROMFS_FILES += [(f,'libraries/AP_OSD/fonts/'+f)]
if cfg.options.enable_sfml_audio:
if not cfg.check_SFML_Audio(env):
cfg.fatal("Failed to find SFML Audio libraries")
env.CXXFLAGS += ['-DWITH_SITL_TONEALARM']
if cfg.options.sitl_flash_storage:
env.CXXFLAGS += ['-DSTORAGE_USE_FLASH=1']
if cfg.env.DEST_OS == 'cygwin':
env.LIB += [
'winmm',
]
if Utils.unversioned_sys_platform() == 'cygwin':
env.CXXFLAGS += ['-DCYGWIN_BUILD']
if 'clang++' in cfg.env.COMPILER_CXX:
print("Disabling SLP for clang++")
env.CXXFLAGS += [
'-fno-slp-vectorize' # compiler bug when trying to use SLP
]
示例7: _use_incredibuild
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def _use_incredibuild(ctx, section_name, option_name, value, verification_fn):
""" If Incredibuild should be used, check for required packages """
if not ctx.is_option_true('ask_for_user_input'):
(isValid, warning, error) = verification_fn(ctx, option_name, value)
if not isValid:
return 'False'
return value
# GUI
if not ctx.is_option_true('console_mode'):
return ctx.gui_get_attribute(section_name, option_name, value)
if not value or value != 'True':
return value
if not Utils.unversioned_sys_platform() == 'win32':
return value
_incredibuild_disclaimer(ctx)
ctx.start_msg('Incredibuild Licence Check')
(res, warning, error) = verification_fn(ctx, option_name, value)
if not res:
if warning:
Logs.warn(warning)
if error:
ctx.end_msg(error, color='YELLOW')
return 'False'
ctx.end_msg('ok')
return value
示例8: __init__
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def __init__(self, **kw):
super(OptionsContext, self).__init__(**kw)
self.parser = opt_parser(self)
"""Instance of :py:class:`waflib.Options.opt_parser`"""
self.option_groups = {}
jobs = self.jobs()
p = self.add_option
color = os.environ.get('NOCOLOR', '') and 'no' or 'auto'
if os.environ.get('CLICOLOR', '') == '0':
color = 'no'
elif os.environ.get('CLICOLOR_FORCE', '') == '1':
color = 'yes'
p('-c', '--color', dest='colors', default=color, action='store', help='whether to use colors (yes/no/auto) [default: auto]', choices=('yes', 'no', 'auto'))
p('-j', '--jobs', dest='jobs', default=jobs, type='int', help='amount of parallel jobs (%r)' % jobs)
p('-k', '--keep', dest='keep', default=0, action='count', help='continue despite errors (-kk to try harder)')
p('-v', '--verbose', dest='verbose', default=0, action='count', help='verbosity level -v -vv or -vvv [default: 0]')
p('--zones', dest='zones', default='', action='store', help='debugging zones (task_gen, deps, tasks, etc)')
p('--profile', dest='profile', default='', action='store_true', help=optparse.SUPPRESS_HELP)
gr = self.add_option_group('Configuration options')
self.option_groups['configure options'] = gr
gr.add_option('-o', '--out', action='store', default='', help='build dir for the project', dest='out')
gr.add_option('-t', '--top', action='store', default='', help='src dir for the project', dest='top')
gr.add_option('--no-lock-in-run', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_run')
gr.add_option('--no-lock-in-out', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_out')
gr.add_option('--no-lock-in-top', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_top')
default_prefix = getattr(Context.g_module, 'default_prefix', os.environ.get('PREFIX'))
if not default_prefix:
if Utils.unversioned_sys_platform() == 'win32':
d = tempfile.gettempdir()
default_prefix = d[0].upper() + d[1:]
# win32 preserves the case, but gettempdir does not
else:
default_prefix = '/usr/local/'
gr.add_option('--prefix', dest='prefix', default=default_prefix, help='installation prefix [default: %r]' % default_prefix)
gr.add_option('--bindir', dest='bindir', help='bindir')
gr.add_option('--libdir', dest='libdir', help='libdir')
gr = self.add_option_group('Build and installation options')
self.option_groups['build and install options'] = gr
gr.add_option('-p', '--progress', dest='progress_bar', default=0, action='count', help= '-p: progress bar; -pp: ide output')
gr.add_option('--targets', dest='targets', default='', action='store', help='task generators, e.g. "target1,target2"')
gr = self.add_option_group('Step options')
self.option_groups['step options'] = gr
gr.add_option('--files', dest='files', default='', action='store', help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"')
default_destdir = os.environ.get('DESTDIR', '')
gr = self.add_option_group('Installation and uninstallation options')
self.option_groups['install/uninstall options'] = gr
gr.add_option('--destdir', help='installation root [default: %r]' % default_destdir, default=default_destdir, dest='destdir')
gr.add_option('-f', '--force', dest='force', default=False, action='store_true', help='force file installation')
gr.add_option('--distcheck-args', metavar='ARGS', help='arguments to pass to distcheck', default=None, action='store')
示例9: configure
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def configure(self):
self.find_qt5_binaries()
self.set_qt5_libs_to_check()
self.set_qt5_defines()
self.find_qt5_libraries()
self.add_qt5_rpath()
self.simplify_qt5_libs()
if not has_xml:
Logs.error('No xml.sax support was found, rcc dependencies will be incomplete!')
frag='#include <QApplication>\nint main(int argc, char **argv) {return 0;}\n'
uses='QT5CORE QT5WIDGETS QT5GUI'
for flag in[[],'-fPIE','-fPIC','-std=c++11',['-std=c++11','-fPIE'],['-std=c++11','-fPIC']]:
msg='See if Qt files compile '
if flag:
msg+='with %s'%flag
try:
self.check(features='qt5 cxx',use=uses,uselib_store='qt5',cxxflags=flag,fragment=frag,msg=msg)
except self.errors.ConfigurationError:
pass
else:
break
else:
self.fatal('Could not build a simple Qt application')
from waflib import Utils
if Utils.unversioned_sys_platform()=='freebsd':
frag='#include <QApplication>\nint main(int argc, char **argv) { QApplication app(argc, argv); return NULL != (void*) (&app);}\n'
try:
self.check(features='qt5 cxx cxxprogram',use=uses,fragment=frag,msg='Can we link Qt programs on FreeBSD directly?')
except self.errors.ConfigurationError:
self.check(features='qt5 cxx cxxprogram',use=uses,uselib_store='qt5',libpath='/usr/local/lib',fragment=frag,msg='Is /usr/local/lib required?')
示例10: set_qt5_libs_to_check
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def set_qt5_libs_to_check(self):
self.qt5_vars = Utils.to_list(getattr(self, 'qt5_vars', []))
if not self.qt5_vars:
dirlst = Utils.listdir(self.env.QTLIBS)
pat = self.env.cxxshlib_PATTERN
if Utils.is_win32:
pat = pat.replace('.dll', '.lib')
if self.environ.get('QT5_FORCE_STATIC'):
pat = self.env.cxxstlib_PATTERN
if Utils.unversioned_sys_platform() == 'darwin':
pat = "%s\.framework"
re_qt = re.compile(pat%'Qt5?(?P<name>.*)'+'$')
for x in dirlst:
m = re_qt.match(x)
if m:
self.qt5_vars.append("Qt5%s" % m.group('name'))
if not self.qt5_vars:
self.fatal('cannot find any Qt5 library (%r)' % self.env.QTLIBS)
qtextralibs = getattr(Options.options, 'qtextralibs', None)
if qtextralibs:
self.qt5_vars.extend(qtextralibs.split(','))
if not hasattr(self, 'qt5_vars_debug'):
self.qt5_vars_debug = [a + '_DEBUG' for a in self.qt5_vars]
self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug)
示例11: cxx_load_tools
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def cxx_load_tools(conf):
"""
Loads the Waf c++ extensions
"""
if not conf.env.DEST_OS:
conf.env.DEST_OS = Utils.unversioned_sys_platform()
conf.load('cxx')
示例12: cc_load_tools
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def cc_load_tools(conf):
"""
Load the c tool
"""
if not conf.env.DEST_OS:
conf.env.DEST_OS = Utils.unversioned_sys_platform()
conf.load('c')
示例13: get_test_env
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def get_test_env(self):
"""
In general, tests may require any library built anywhere in the project.
Override this method if fewer paths are needed
"""
try:
fu = getattr(self.generator.bld, 'all_test_paths')
except AttributeError:
# this operation may be performed by at most #maxjobs
fu = os.environ.copy()
lst = []
for g in self.generator.bld.groups:
for tg in g:
if getattr(tg, 'link_task', None):
s = tg.link_task.outputs[0].parent.abspath()
if s not in lst:
lst.append(s)
if Utils.is_win32:
self.add_path(fu, lst, 'PATH')
elif Utils.unversioned_sys_platform() == 'darwin':
self.add_path(fu, lst, 'DYLD_LIBRARY_PATH')
self.add_path(fu, lst, 'LD_LIBRARY_PATH')
else:
self.add_path(fu, lst, 'LD_LIBRARY_PATH')
self.generator.bld.all_test_paths = fu
return fu
示例14: run
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def run(self):
"""Execute the test.
The execution is always successful, but the results are stored on
``self.generator.bld.utest_results`` for postprocessing.
"""
self.testdriver_node = self.inputs[0]
try:
fu = getattr(self.generator.bld, "all_test_paths")
except AttributeError:
# this operation may be performed by at most #maxjobs
fu = os.environ.copy()
lst = []
for g in self.generator.bld.groups:
for tg in g:
if getattr(tg, "link_task", None):
s = tg.link_task.outputs[0].parent.abspath()
if s not in lst:
lst.append(s)
def add_path(dct, path, var):
dct[var] = os.pathsep.join(Utils.to_list(path) + [os.environ.get(var, "")])
if Utils.is_win32:
add_path(fu, lst, "PATH")
elif Utils.unversioned_sys_platform() == "darwin":
add_path(fu, lst, "DYLD_LIBRARY_PATH")
add_path(fu, lst, "LD_LIBRARY_PATH")
else:
add_path(fu, lst, "LD_LIBRARY_PATH")
self.generator.bld.all_test_paths = fu
cwd = self.testdriver_node.parent.abspath()
testcmd = self.get_testcmd()
start_time = time.time()
proc = Utils.subprocess.Popen(
testcmd, cwd=cwd, env=fu, stderr=Utils.subprocess.STDOUT, stdout=Utils.subprocess.PIPE
)
stdout = proc.communicate()[0]
end_time = time.time()
if not isinstance(stdout, str):
stdout = stdout.decode(sys.stdout.encoding or "iso8859-1")
tup = (self.testdriver_node, proc.returncode, stdout, end_time - start_time, self.generator.source[0])
self.generator.utest_result = tup
testlock.acquire()
try:
bld = self.generator.bld
Logs.debug("ut: %r", tup)
try:
bld.utest_results.append(tup)
except AttributeError:
bld.utest_results = [tup]
finally:
testlock.release()
示例15: _defaultValue
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import unversioned_sys_platform [as 别名]
def _defaultValue( _VALUES ):
PLATFORM = Utils.unversioned_sys_platform()
if PLATFORM in _VALUES:
return _VALUES[ PLATFORM ]
return None