本文整理汇总了Python中waflib.Utils.is_win32方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.is_win32方法的具体用法?Python Utils.is_win32怎么用?Python Utils.is_win32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.is_win32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare_env
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def prepare_env(self,env):
if not env.PREFIX:
if Options.options.prefix or Utils.is_win32:
env.PREFIX=os.path.abspath(os.path.expanduser(Options.options.prefix))
else:
env.PREFIX=''
if not env.BINDIR:
if Options.options.bindir:
env.BINDIR=os.path.abspath(os.path.expanduser(Options.options.bindir))
else:
env.BINDIR=Utils.subst_vars('${PREFIX}/bin',env)
if not env.LIBDIR:
if Options.options.libdir:
env.LIBDIR=os.path.abspath(os.path.expanduser(Options.options.libdir))
else:
env.LIBDIR=Utils.subst_vars('${PREFIX}/lib%s'%Utils.lib64(),env)
示例2: get_test_env
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def get_test_env(self):
try:
fu=getattr(self.generator.bld,'all_test_paths')
except AttributeError:
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
示例3: get_bld
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def get_bld(self):
cur=self
x=id(self.ctx.srcnode)
y=id(self.ctx.bldnode)
lst=[]
while cur.parent:
if id(cur)==y:
return self
if id(cur)==x:
lst.reverse()
return self.ctx.bldnode.make_node(lst)
lst.append(cur.name)
cur=cur.parent
lst.reverse()
if lst and Utils.is_win32 and len(lst[0])==2 and lst[0].endswith(':'):
lst[0]=lst[0][0]
return self.ctx.bldnode.make_node(['__root__']+lst)
示例4: store
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def store(self):
data={}
for x in SAVED_ATTRS:
data[x]=getattr(self,x)
db=os.path.join(self.variant_dir,Context.DBFILE)
try:
waflib.Node.pickle_lock.acquire()
waflib.Node.Nod3=self.node_class
x=cPickle.dumps(data,-1)
finally:
waflib.Node.pickle_lock.release()
Utils.writef(db+'.tmp',x,m='wb')
try:
st=os.stat(db)
os.remove(db)
if not Utils.is_win32:
os.chown(db+'.tmp',st.st_uid,st.st_gid)
except(AttributeError,OSError):
pass
os.rename(db+'.tmp',db)
示例5: prepare_env
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def prepare_env(self,env):
if not env.PREFIX:
if Options.options.prefix or Utils.is_win32:
env.PREFIX=Utils.sane_path(Options.options.prefix)
else:
env.PREFIX=''
if not env.BINDIR:
if Options.options.bindir:
env.BINDIR=Utils.sane_path(Options.options.bindir)
else:
env.BINDIR=Utils.subst_vars('${PREFIX}/bin',env)
if not env.LIBDIR:
if Options.options.libdir:
env.LIBDIR=Utils.sane_path(Options.options.libdir)
else:
env.LIBDIR=Utils.subst_vars('${PREFIX}/lib%s'%Utils.lib64(),env)
示例6: configure
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def configure(conf):
if Utils.is_win32:
compiler,version,path,includes,libdirs,arch=conf.detect_ifort(True)
v=conf.env
v.DEST_CPU=arch
v.PATH=path
v.INCLUDES=includes
v.LIBPATH=libdirs
v.MSVC_COMPILER=compiler
try:
v.MSVC_VERSION=float(version)
except Exception:
raise
v.MSVC_VERSION=float(version[:-3])
conf.find_ifort_win32()
conf.ifort_modifier_win32()
else:
conf.find_ifort()
conf.find_program('xiar',var='AR')
conf.find_ar()
conf.fc_flags()
conf.fc_add_flags()
conf.ifort_modifier_platform()
示例7: store
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def store(self):
data={}
for x in SAVED_ATTRS:
data[x]=getattr(self,x)
db=os.path.join(self.variant_dir,Context.DBFILE)
try:
waflib.Node.pickle_lock.acquire()
waflib.Node.Nod3=self.node_class
x=cPickle.dumps(data,PROTOCOL)
finally:
waflib.Node.pickle_lock.release()
Utils.writef(db+'.tmp',x,m='wb')
try:
st=os.stat(db)
os.remove(db)
if not Utils.is_win32:
os.chown(db+'.tmp',st.st_uid,st.st_gid)
except(AttributeError,OSError):
pass
os.rename(db+'.tmp',db)
示例8: symlink_as
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def symlink_as(self,dest,src,env=None,cwd=None,add=True,postpone=True,relative_trick=False,task=None):
if Utils.is_win32:
return
assert(dest)
tsk=inst(env=env or self.env)
tsk.bld=self
tsk.dest=dest
tsk.path=cwd or self.path
tsk.source=[]
tsk.task=task
tsk.link=src
tsk.relative_trick=relative_trick
tsk.exec_task=tsk.exec_symlink_as
if add:self.add_to_group(tsk)
self.run_task_now(tsk,postpone)
return tsk
示例9: install_boost
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def install_boost(self):
if install_boost.done or not Utils.is_win32 or not self.bld.cmd.startswith('install'):
return
install_boost.done = True
inst_to = getattr(self, 'install_path', '${BINDIR}')
for lib in self.env.LIB_BOOST:
try:
file = self.bld.find_file(self.env.cxxshlib_PATTERN % lib, self.env.LIBPATH_BOOST)
self.bld.install_files(inst_to, self.bld.root.find_node(file))
except:
continue
示例10: enable_colors
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def enable_colors(use):
if use==1:
if not(sys.stderr.isatty()or sys.stdout.isatty()):
use=0
if Utils.is_win32 and os.name!='java':
term=os.environ.get('TERM','')
else:
term=os.environ.get('TERM','dumb')
if term in('dumb','emacs'):
use=0
if use>=1:
os.environ['TERM']='vt100'
colors_lst['USE']=use
示例11: get_ifort_version
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def get_ifort_version(conf,fc):
version_re=re.compile(r"Intel[\sa-zA-Z()0-9,-]*Version\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
if Utils.is_win32:
cmd=fc
else:
cmd=fc+['-logo']
out,err=fc_config.getoutput(conf,cmd,stdin=False)
match=version_re(out)or version_re(err)
if not match:
conf.fatal('cannot determine ifort version.')
k=match.groupdict()
conf.env['FC_VERSION']=(k['major'],k['minor'])
示例12: path_from
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def path_from(self,node):
c1=self
c2=node
c1h=c1.height()
c2h=c2.height()
lst=[]
up=0
while c1h>c2h:
lst.append(c1.name)
c1=c1.parent
c1h-=1
while c2h>c1h:
up+=1
c2=c2.parent
c2h-=1
while id(c1)!=id(c2):
lst.append(c1.name)
up+=1
c1=c1.parent
c2=c2.parent
if c1.parent:
for i in range(up):
lst.append('..')
else:
if lst and not Utils.is_win32:
lst.append('')
lst.reverse()
return os.sep.join(lst)or'.'
示例13: copy_fun
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def copy_fun(self,src,tgt,**kw):
if Utils.is_win32 and len(tgt)>259 and not tgt.startswith('\\\\?\\'):
tgt='\\\\?\\'+tgt
shutil.copy2(src,tgt)
os.chmod(tgt,kw.get('chmod',Utils.O644))
示例14: get_ifort_version
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def get_ifort_version(conf,fc):
version_re=re.compile(r"\bIntel\b.*\bVersion\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
if Utils.is_win32:
cmd=fc
else:
cmd=fc+['-logo']
out,err=fc_config.getoutput(conf,cmd,stdin=False)
match=version_re(out)or version_re(err)
if not match:
conf.fatal('cannot determine ifort version.')
k=match.groupdict()
conf.env['FC_VERSION']=(k['major'],k['minor'])
示例15: find_program
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import is_win32 [as 别名]
def find_program(self,filename,**kw):
exts=kw.get('exts',Utils.is_win32 and'.exe,.com,.bat,.cmd'or',.sh,.pl,.py')
environ=kw.get('environ',getattr(self,'environ',os.environ))
ret=''
filename=Utils.to_list(filename)
msg=kw.get('msg',', '.join(filename))
var=kw.get('var','')
if not var:
var=re.sub(r'[-.]','_',filename[0].upper())
path_list=kw.get('path_list','')
if path_list:
path_list=Utils.to_list(path_list)
else:
path_list=environ.get('PATH','').split(os.pathsep)
if var in environ:
filename=environ[var]
if os.path.isfile(filename):
ret=[filename]
else:
ret=self.cmd_to_list(filename)
elif self.env[var]:
ret=self.env[var]
ret=self.cmd_to_list(ret)
else:
if not ret:
ret=self.find_binary(filename,exts.split(','),path_list)
if not ret and Utils.winreg:
ret=Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER,filename)
if not ret and Utils.winreg:
ret=Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE,filename)
ret=self.cmd_to_list(ret)
if ret:
if len(ret)==1:
retmsg=ret[0]
else:
retmsg=ret
else:
retmsg=False
self.msg("Checking for program '%s'"%msg,retmsg,**kw)
if not kw.get('quiet',None):
self.to_log('find program=%r paths=%r var=%r -> %r'%(filename,path_list,var,ret))
if not ret:
self.fatal(kw.get('errmsg','')or'Could not find the program %r'%filename)
interpreter=kw.get('interpreter',None)
if interpreter is None:
if not Utils.check_exe(ret[0],env=environ):
self.fatal('Program %r is not executable'%ret)
self.env[var]=ret
else:
self.env[var]=self.env[interpreter]+ret
return ret