本文整理汇总了Python中builder.Builder类的典型用法代码示例。如果您正苦于以下问题:Python Builder类的具体用法?Python Builder怎么用?Python Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Builder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_module
def add_module(self, ast, parent):
"""
Adds parsed AST to the model, without doing any optimizations. May be
called more than once, with different parsed files.
:param ast: AST of the input file, as returned by
:func:`bkl.parser.parse_file`.
"""
logger.info("processing %s", ast.filename)
submodules = []
b = Builder(on_submodule=lambda fn, pos: submodules.append((fn,pos)))
module = b.create_model(ast, parent)
while submodules:
sub_filename, sub_pos = submodules[0]
submodules.pop(0)
try:
sub_ast = parse_file(sub_filename)
except IOError as e:
if e.filename:
msg = "%s: %s" % (e.strerror, e.filename)
else:
msg = e.strerror
raise Error(msg, pos=sub_pos)
self.add_module(sub_ast, module)
示例2: __init__
def __init__(self, pkgname=None):
Builder.__init__(self,
pkgname=pkgname,
archivename=None,
buildsubdir=None,
buildcommand='slice2html',
buildtargets=[])
'''
The constructor sets up a package build 'environment'
:param pkgname: The (optional) name of the package directory.
By default the current directory name is used.
:param archivename: The (optional) archive name minus suffix.
The default is None.
:param buildsubdir: The (optional) directory in which to start the
build.
:param buildtargets: The (optional) additional build targets.
:param buildcommand: The (optional) build command.
The default is 'slice2html'.
'''
self._docdir = 'doc'
self.add_extra_clean_targets(self._docdir)
self.parallel = False
self.header = None
self.footer = None
# get the environment to pick up ice
pth = os.path.pathsep.join([os.environ.get('PATH'),
self.dep.get_path()])
self.add_ld_library_paths(self.dep.get_ld_library_path())
self.append_env('PATH', pth)
示例3: __init__
def __init__(self, name, path, config, changed_files, module_info, is_art=False,
is_other_modules_has_src_changed=False):
self._name = name
self._module_path = path
self._config = config
self._changed_files = changed_files
self._module_info = module_info
self._is_art = is_art
self._is_other_modules_has_src_changed = is_other_modules_has_src_changed
self._aapt = Builder.get_aapt()
self._javac = Builder.get_javac(config=config)
if self._javac is None:
raise FreelineException('Please declares your JAVA_HOME to system env!', 'JAVA_HOME not found in env.')
self._dx = Builder.get_dx(self._config)
self._cache_dir = self._config['build_cache_dir']
self._finder = None
self._res_dependencies = []
self._is_ids_changed = False
self._public_xml_path = None
self._ids_xml_path = None
self._new_res_list = []
self._merged_xml_cache = {}
self._origin_res_list = list(self._changed_files['res'])
self._classpaths = []
self._is_r_file_changed = False
self._is_need_javac = True
self._extra_javac_args = []
self.before_execute()
示例4: _clean
def _clean(self):
# Cleaning in Tools is done explicitly in rbuild script
# and do not want it run a second time and complaining.
if not 'Tools' in os.getcwd(): # i.e. in 3rdParty and Code
if os.path.exists("setup.py"):
utils.run("%s setup.py clean" % self._pycmd)
Builder._clean(self)
示例5: _install
def _install(self):
# Install iocboot directories from table
Builder._install(self)
for ioctemplatedir, appname in self._iocbootdirsdict.iteritems():
self._install_iocboot(appname, ioctemplatedir)
self._create_ioc_config()
self._create_monica_config()
示例6: __init__
def __init__(self, pkgname=None, archivename=None, extractdir=None,
buildsubdir=None, buildtargets=[], buildcommand="ant",
installcommand="ant", installsubdir=""):
'''
The constructor sets up a package build "environment".
:param pkgname: The (optional) name of the package directory.
By default the directory name is used.
:param archivename: The (optional) archive name minus suffix.
The default is based on package name.
:param extractdir: The (optional) directory into which the archive
is extracted. It is created if it does not exist.
:param buildsubdir: The (optional) directory in which to start the
build.
:param buildtargets: The (optional) additional build targets.
:param buildcommand: The (optional) build command (default is 'ant').
:param installcommand: The (optional) install command (default is 'ant').
'''
Builder.__init__(self, pkgname=pkgname,
archivename=archivename,
extractdir=extractdir,
buildsubdir=buildsubdir,
buildcommand=buildcommand,
buildtargets=[""] + buildtargets,
installcommand=installcommand)
self.parallel = False
if installsubdir:
self.installdir = os.path.join(self._prefix, installsubdir)
else:
self.installdir = self._prefix
self._run_script = []
示例7: run_desugar_task
def run_desugar_task(self):
self.debug('========= desugar task ========')
javaargs = [Builder.get_java(self._config)]
arguments = ['-jar', Builder.get_desugar()]
patch_classes_cache_dir = self._finder.get_patch_classes_cache_dir()
arguments.append('--input')
arguments.append(patch_classes_cache_dir)
arguments.append('--output')
arguments.append(patch_classes_cache_dir)
# bootclasspath
arguments.append('--bootclasspath_entry')
arguments.append(os.path.join(self._config['compile_sdk_directory'], 'android.jar'))
# classpath
for path in self._classpaths:
arguments.append('--classpath_entry')
arguments.append(path)
javaargs.extend(arguments)
self.debug('java exec: ' + ' '.join(javaargs))
output, err, code = cexec(javaargs, callback=None)
if code != 0:
raise FreelineException('desugar failed.', '{}\n{}'.format(output, err))
示例8: _functest
def _functest(self):
if os.path.exists("functests"):
self._testtgt("functest")
Builder._functest(self)
else:
print "error: missing functests subdirectory in %s" % \
os.path.relpath(self._bdir, self._askaproot)
示例9: __init__
def __init__(self,player,conf):
Builder.__init__(self,player)
#set the main tiles to pass by
first=self.find_first_target_tile(conf['x'],conf['y'])
self.add_to_path(first)
last=self.find_last_target_tile(conf['x'],conf['y'])
self.add_to_path(last)
示例10: __init__
def __init__(self, pkgname=None, archivename=None, buildsubdir=None,
buildtargets=[], buildcommand=MAKE, confcommand="cmake",
installcommand=" ".join([MAKE, "install"])):
'''
The constructor sets up a package build "environment"
:param pkgname: The (optional) name of the package directory.
By default the current directory name is used.
:param archivename: The (optional) archive name minus suffix.
The default is based on package name.
:param extractdir: The (optional) directory into which the archive
is extracted. It is created if it does not exist.
:param buildsubdir: The (optional) directory in which to start the
build.
:param buildtargets: The (optional) additional build targets.
:param confcommand: The (optional) command to configure the package.
The default is 'cmake'.
:param buildcommand: The (optional) build command.
The default is 'make'.
:param installcommand: The (optional) install command.
The default is 'make install'.
'''
Builder.__init__(self,
pkgname=pkgname,
archivename=archivename,
buildsubdir=buildsubdir,
buildcommand=buildcommand,
buildtargets=['']+buildtargets,
confcommand=confcommand,
installcommand=installcommand)
self._cmakedir = 'build'
示例11: BRTest
class BRTest(unittest.TestCase):
def showMsg(self, msg):
print "[%s/%s/%s] %s" % (self.testname, self.testinstance,
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
msg)
def setUp(self):
if os.getenv("REUSE_BUILD"):
self.builddir = os.getenv("REUSE_BUILD").rstrip("/")
skip_build = True
else:
skip_build = False
b = subprocess.check_output(["mktemp", "-d", "buildroot.XXXXX"],
cwd=configtest.builddir)
b = b.strip()
self.builddir = os.path.join(configtest.builddir, b)
self.testname = self.__class__.__name__
self.testinstance = os.path.basename(self.builddir)
self.buildlog = self.builddir + "-build.log"
self.runlog = self.builddir + "-run.log"
self.s = None
self.showMsg("Starting")
self.b = Builder(self.__class__.config, self.builddir, self.buildlog)
if not skip_build:
self.showMsg("Building")
self.b.build()
self.showMsg("Building done")
self.s = System(self.runlog)
def tearDown(self):
self.showMsg("Cleaning up")
if self.s:
self.s.stop()
if self.b and os.getenv("KEEP_BUILD"):
self.b.delete()
示例12: __init__
def __init__(self, pkgname=None, archivename=None, extractdir=None,
epicsbase=None, releasefile=None, srcdir=None,
fileprefix=None, dbprefix=None, *args, **kwargs):
Builder.__init__(self, pkgname=pkgname,
archivename=archivename,
extractdir=extractdir,
buildcommand="",
buildtargets=[""])
self.parallel = False
self._appname = os.getcwd().split(os.sep)[-2]
if epicsbase is None:
self._epicsBuild = False
self._srcdir = srcdir
srcOutDir = srcdir
dbOutDir = None
xmlOutDir = None
else:
self._epicsBuild = True
self._epicsbase = self.dep.get_install_path(epicsbase)
self._epicsbase = self._epicsbase.rstrip(os.sep)
self._srcdir = os.path.join(srcdir, 'src')
comm = os.path.join(os.path.dirname(self._epicsbase), "EpicsHostArch")
#self._epicsarch = utils.runcmd(comm)[0].strip() + '-debug'
self._epicsarch = utils.runcmd(comm)[0].strip()
srcOutDir = os.path.join(srcdir, 'src', 'O.' + self._epicsarch)
dbOutDir = os.path.join(srcdir, 'Db', 'O.Common')
xmlOutDir = os.path.join('install', 'epicsxml')
self._adePoints = []
self._adeParser = AdbeParser(self._appname, dbprefix, fileprefix, srcOutDir, dbOutDir, xmlOutDir, *args, **kwargs)
示例13: __init__
def __init__(self, pkgname, pkgversion=None, exename=None):
Builder.__init__(self, pkgname=pkgname)
# Needed for os.chdir in _build
self._pkgversion = pkgversion
self._exename = exename
self._builddir = "."
self.parallel = False
示例14: makeGrantlist
def makeGrantlist():
grantobj = Builder('researchgrants.csv', 0, 'Awardee')
grantlist = grantobj.build()
for item in grantlist:
grantobj.skiplist.insert(item)
return grantobj.skiplist
示例15: makePresidentialOrderlist
def makePresidentialOrderlist():
ordersobj = Builder('presidentialdocuments.csv', 1, 'title')
orderslist = ordersobj.build()
for item in orderslist:
ordersobj.skiplist.insert(item)
return ordersobj.skiplist