本文整理汇总了Python中properties.Properties.assign方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.assign方法的具体用法?Python Properties.assign怎么用?Python Properties.assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类properties.Properties
的用法示例。
在下文中一共展示了Properties.assign方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addLibrariesToProject
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import assign [as 别名]
def addLibrariesToProject(self, libs):
if self.main:
path = self.mainPath()
mkPath = os.path.join(path, "mk.cfg")
props = Properties(mkPath)
lst = props.get("LINK_LIBS").split(",")
lst = [x for x in lst if len(x) > 0]
for l in libs:
lst.append(l)
props.assign("LINK_LIBS", ",".join(lst))
props.save(mkPath)
self.depsChanged.emit(path)
示例2: editDependencies
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import assign [as 别名]
def editDependencies(self):
item = self.currentItem()
path = item.data(0, DirectoryRole).toString()
mkPath = os.path.join(path, "mk.cfg")
props = Properties(mkPath)
libs = re.split("\W+", props.get("LINK_LIBS"))
d = DependenciesDialog(libs)
if d.exec_():
props.assign("LINK_LIBS", ",".join(d.libs))
props.save(mkPath)
self.depsChanged.emit(path)
return True
return False
示例3: editDebugSettings
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import assign [as 别名]
def editDebugSettings(self):
item = self.currentItem()
path = item.data(0, DirectoryRole).toString()
mkPath = os.path.join(path, "mk.cfg")
props = Properties(mkPath)
d = uis.loadDialog("debug_settings")
d.cwdEdit.setText(props.get("DEBUG_CWD"))
d.paramsEdit.setText(props.get("DEBUG_PARAMS"))
d.browseDirButton.clicked.connect(lambda: utils.browseDirectory(d.cwdEdit))
if d.exec_():
props.assign("DEBUG_CWD", d.cwdEdit.text())
props.assign("DEBUG_PARAMS", d.paramsEdit.text())
self.debug = (d.cwdEdit.text(), d.paramsEdit.text())
props.save(mkPath)
示例4: generateConfig
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import assign [as 别名]
def generateConfig(self,dir,files,cfg,o,props):
'''
Generate rules for a configuration (Debug/Release)
'''
name=os.path.basename(dir)
absdir=os.path.abspath(dir)
pb=Properties(os.path.join(dir,"mk.cfg"))
type=pb.get("TYPE")
if len(type)==0:
if findMain(absdir):
type="APP"
else:
type="LIB"
o.write('TYPE={}\n'.format(type))
libs=re.split(',| ',pb.get("LINK_LIBS"))
libs=filter(bool,libs) # remove empty strings
if len(type)==0:
return False
srcs=filterSources(files)
subdirs=self.findAllSubdirs(srcs)
intr=os.path.join(dir.replace(self.srcDir,self.intrDir),cfg)
verifyDir(intr)
for sd in subdirs:
verifyDir(os.path.join(intr,sd))
outdir=os.path.join(dir.replace(self.srcDir,self.outDir),cfg)
verifyDir(outdir)
#reloutdir=os.path.relpath(outdir,dir)
reloutdir=outdir
#globalInclude=os.path.relpath(self.globalInc,dir)
cfgInclude=''
#o = open(output,'w')
mkProps=Properties()
o.write('CPP_{}=g++\n'.format(cfg))
mkProps.assign('CPP_{}'.format(cfg),'g++')
o.write('INC_{}=-I{} {}\n'.format(cfg,self.globalInc,cfgInclude))
mkProps.assign('INC_{}'.format(cfg),'-I{} {}'.format(self.globalInc,cfgInclude))
cflags='-c $(OPT_{}) $(INC_{}) '.format(cfg,cfg)
cflags=self.addCompileSettings(cflags,props,cfg)
lflags='$(OPT_{}) $(OBJS_{}) '.format(cfg,cfg)
lflags=self.addLinkSettings(lflags,props,cfg)
libdeps={}
for stage in ['local','package']:
for lib in libs:
if lib in packages:
if stage=='package':
cflags=cflags+' `pkg-config --cflags {}` '.format(lib)
lflags=lflags+' `pkg-config --libs {}` '.format(lib)
else:
if lib in self.wsLibs:
if stage=='local':
rel=self.wsLibs.get(lib)
libdir=os.path.join(self.root,'out',rel,cfg)
libDir=os.path.join(self.root,'src',rel)
libProps=Properties(os.path.join(libDir,"mk.cfg"))
wPrefix=''
wSuffix=''
if libProps.get('BUILD_WHOLE_ARCHIVE','False')=='True':
wPrefix=' -Wl,--whole-archive'
wSuffix='-Wl,--no-whole-archive '
lflags=lflags+'{} -L{} -l{} {}'.format(wPrefix,libdir,lib,wSuffix)
libdeps[lib]=libDir
else:
if stage=='package':
lflags=lflags+' -l{} '.format(lib)
o.write('CFLAGS_{}={}\n'.format(cfg,cflags))
o.write('LFLAGS_{}={}\n'.format(cfg,lflags))
objs = arreplace(srcs,'.cpp','.o')
for i in xrange(0,len(objs)):
objs[i]=os.path.join(intr,objs[i])
o.write("OBJS_{}=".format(cfg))
for obj in objs:
o.write("\\\n"+obj)
o.write("\n\n")
liblist=[]
for lib in libdeps:
libname="{}_{}".format(lib,cfg)
liblist.append(libname)
libpath=libdeps.get(lib)
o.write("{}:\n".format(libname))
o.write("\[email protected] --no-print-directory -C {} {}\n\n".format(libpath,cfg))
o.write("clean_{}:\n".format(libname))
o.write("\[email protected] --no-print-directory -C {} clean_{}\n\n".format(libpath,cfg))
cleanlibs=''
if type=='LIB':
outfile='{}/lib{}.a'.format(reloutdir,name)
o.write('{}: $(OBJS_{})\n'.format(outfile,cfg))
o.write('\tar cr {} $(OBJS_{})\n\n'.format(outfile,cfg))
else:
outfile="{}/{}".format(reloutdir,name)
o.write('OUTPUT_PATH_{}={}\n\n'.format(cfg,outfile))
if len(liblist)>0:
cleanlibs='clean_'+' clean_'.join(liblist)
liblist=' '.join(liblist)
#.........这里部分代码省略.........