def test_build_run_creates_python_executable(self): """ Test build run successfully creates runnable """ run(self.args) assert path.exists(self.zip_path) is False assert (subprocess.check_output( self.output_path, shell=True, cwd=self.app_path)) == b"Good News, Bad News\n"
def test_run_does_not_install_requirements_before_building(self, mocker): """ Test run build does not install requirements and builds exec """ mock_build_req = mocker.patch('build.build_requirements') if path.exists(self.output_path): remove(self.output_path) self.args.install = False run(self.args) mock_build_req.assert_not_called() assert path.exists(self.zip_path) is False assert path.exists(self.output_path) is True remove(self.output_path)
def start_build(): id = request.get_json()['project'] branch = request.get_json()['branch'] mention = request.get_json()['mention'] note = request.get_json()['note'] print(id, branch, mention, note) project = get_protject_by_id(id) build.run( project=project, note=note, branch=branch, mention=mention ) return success_data(json.dumps({}))
def run(args): #first build a project then flash it build.run(args) # time to flash if args.file: # known project from records workspace = Workspace(args.file, os.getcwd()) if args.project: workspace.flash_project(args.project, args.tool) else: workspace.flash_projects(args.tool) else: # not project known by pgen project_settings = ProjectSettings() project_files = [os.path.join(args.directory, args.project)] flasher = ToolsSupported().get_value(args.tool, 'flasher') build(flasher, args.project, project_files, args.tool, project_settings)
# # RTEMS Tools Project (http://www.rtems.org/) # Copyright 2010-2012 Chris Johns ([email protected]) # All rights reserved. # # This file is part of the RTEMS Tools package in 'rtems-tools'. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import print_function import sys, os try: import build build.run(sys.argv) except ImportError: print("Incorrect Source Builder installation", file = sys.stderr) sys.exit(1)
#!/usr/bin/env python import sys sys.dont_write_bytecode = True import build build.run(False, True, False, False)
# Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('.')) import build build.run() # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.mathjax', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates']
#!/usr/bin/env python import sys sys.dont_write_bytecode = True import build build.run(True, True, True, True)
#!/usr/bin/env python import sys sys.dont_write_bytecode = True import build build.run(True, False, False)
from distutils.command.install import install +from distutils.command.build import build DEBUG = 0 perl = 'perl' @@ -142,6 +143,23 @@ ext_modules.append(Extension(name = ext_ )) ext_modules.extend(extra_ext) +class build_perl(build): + def run(self): + os.chdir('Python-Object') + build.spawn(self, ['perl','Makefile.PL', 'INSTALLDIRS=vendor'], 'Python-Object') + build.spawn(self, ['make']) + os.chdir('..') + build.run(self) + +class test(build): + def run(self): + cwd=os.getcwd() + ldpath = '%s/Python-Object/blib/arch/auto/Python/Object' % cwd + perllib = '%s/Python-Object/blib/lib' % cwd + pypath = '%s/%s' % (cwd, self.build_lib) + os.system('LD_LIBRARY_PATH="%s" PERL5LIB="%s" PYTHONPATH="%s" python test.py' % (ldpath, perllib, pypath)) + build.run(self) + class my_install(install): def run(self): @@ -150,17 +168,15 @@ class my_install(install): if os.access(multi_perl, os.F_OK):
import sys sys.dont_write_bytecode = True import build build.run(True, False, False)
def main(): parser = optparse.OptionParser(version="%prog version: $Id$", usage=USAGE) parser.add_option("-t", "--tracker", dest="tracker", type="string", help="tracker to use [default=%default]") parser.add_option("-p", "--page", dest="page", type="string", help="render an rst page [default=%default]") parser.add_option("-a", "--tracks", dest="tracks", type="string", help="tracks to use [default=%default]") parser.add_option( "-m", "--transformer", dest="transformers", type="string", action="append", help="add transformation [default=%default]", ) parser.add_option("-s", "--slices", dest="slices", type="string", help="slices to use [default=%default]") parser.add_option("-r", "--renderer", dest="renderer", type="string", help="renderer to use [default=%default]") parser.add_option("-w", "--path", dest="dir_trackers", type="string", help="path to trackers [default=%default]") parser.add_option( "-f", "--force", dest="force", action="store_true", help="force recomputation of data by deleting cached results [default=%default]", ) parser.add_option( "-o", "--option", dest="options", type="string", action="append", help="renderer options - supply as key=value pairs (without spaces). [default=%default]", ) parser.add_option( "--no-print", dest="do_print", action="store_false", help="do not print an rst text element to create the displayed plots [default=%default].", ) parser.add_option("--no-show", dest="do_show", action="store_false", help="do not show a plot [default=%default].") parser.set_defaults( tracker=None, transformers=[], tracks=None, slices=None, options=[], renderer=None, do_show=True, do_print=True, force=False, dir_trackers=TRACKERDIR, label="GenericLabel", caption="add caption here", ) (options, args) = parser.parse_args() if len(args) == 2: options.tracker, options.renderer = args # configure options options.dir_trackers = os.path.abspath(os.path.expanduser(options.dir_trackers)) if not os.path.exists(options.dir_trackers): raise IOError("directory %s does not exist" % options.dir_trackers) sys.path.append(options.dir_trackers) # test plugins kwargs = {} for x in options.options: if "=" in x: data = x.split("=") key, val = [y.strip() for y in (data[0], "=".join(data[1:]))] else: key, val = x.strip(), None kwargs[key] = val if options.tracks: kwargs["tracks"] = options.tracks if options.slices: kwargs["slices"] = options.slices if options.renderer == None: options.renderer = "table" kwargs = Utils.updateOptions(kwargs) renderer = Utils.getRenderer(options.renderer, **kwargs) transformers = Utils.getTransformers(options.transformers, **kwargs) exclude = set( ( "Tracker", "TrackerSQL", "returnLabeledData", "returnMultipleColumnData", "returnMultipleColumns", "returnSingleColumn", "returnSingleColumnData", "SQLError", "MultipleColumns", "MultipleColumnData", "LabeledData", "DataSimple", "Data", ) ) if options.tracker: trackers = [] for filename in glob.glob(os.path.join(options.dir_trackers, "*.py")): modulename = os.path.basename(filename) trackers.extend([x for x in getTrackers(modulename) if x[0] not in exclude]) for name, tracker, modulename, is_derived in trackers: if name == options.tracker: break else: available_trackers = set([x[0] for x in trackers if x[3]]) print "unknown tracker '%s': possible trackers are\n %s" % ( options.tracker, "\n ".join(sorted(available_trackers)), ) print "(the list above does not contain functions)." sys.exit(1) ## remove everything related to that tracker for a clean slate if options.force: removed = SphinxReport.clean.removeTracker(name) print "removed all data for tracker %s: %i files" % (name, len(removed)) # instantiate functors if is_derived: t = tracker() # but not functions else: t = tracker dispatcher = Dispatcher(t, renderer, transformers) ## needs to be resolved between renderer and dispatcher options result = dispatcher(**kwargs) if options.do_print: options_rst = [] for key, val in kwargs.items(): if val == None: options_rst.append(":%s:" % key) else: options_rst.append(":%s: %s" % (key, val)) print "..Template start" print params = { "tracker": "%s.%s" % (modulename, name), "renderer": options.renderer, "label": options.label, "options": ("\n ").join(options_rst), "caption": options.caption, } if options.transformers: params["options"] = ":transform: %s\n %s" % (",".join(options.transformers), params["options"]) print RST_TEMPLATE % params print print "..Template ends" if result: for r in result: print "title:", r.title for s in r: print str(s) if options.do_show: if options.renderer.startswith("r-"): print "press Ctrl-c to stop" while 1: pass elif _pylab_helpers.Gcf.get_all_fig_managers() > 0: plt.show() elif options.page: import build SphinxReport.report_directive.DEBUG = True SphinxReport.report_directive.FORCE = True blocks = build.rst_reader(open(options.page, "r")) for block in blocks: build.run(((options.page, block),))
def _build(release, builddirs, args = []): '''build builddirs: directories of the build (instance of BuildDirs) ''' import packages packageInfoTable = getattr(packages, 'packageInfoTable', None) if packageInfoTable: # old "packages" config_dir = packageInfoTable['config']['path'] else: # new oo "packages" from packages import config config_dir = config.name config_dir = os.path.join( builddirs.src, config_dir) import build succeeded = False while not succeeded: try: build.run( release.name, builddirs.src, builddirs.export, builddirs.build, config_dir, arguments = args) succeeded = True except build.DependencyMissing, err: depname = err.packagename depid = err.packageid print '*** Dependency %s is missing ***' % depname # error message if err.errormessage: msg = err.errormessage from ..misc._formatstr import indent msg = indent(msg, '| ') print '* Error:\n%s\n' % msg # suggestion if err.suggestion: print '* Suggestion:\n%s\n' % err.suggestion print '* This builder could try to install it locally.' if raw_input(" * Install dependency '%s'? (yes/no) " % depname) != 'yes': print "\nAbort\n" return 1 print "Trying to install dependency '%s' ..." % depname # is installer specified? from deps import installers installer = installers.get( depid ) # use default installer if possible if installer is None: installer = get_installer( depid ) # install installer() #after installation, we want to make sure installation #is successful. checkInstallation( depid ) pass continue
tests = { 'internal': ('compiler unit tests', tests_compiler), 'compile-fail': ('compile-fail tests', tests_compile_fail), 'run-pass': ('run-pass tests', tests_run_pass), 'ir': ('IR tests', lambda: tests_emit(target='ir', ext='.ir', descr='IR')), 'asm': ('ASM tests', lambda: tests_emit(target='asm', ext='.s', descr='ASM')) } default_set = ['internal', 'compile-fail', 'run-pass', 'ir', 'asm'] if len(sys.argv) == 2: suites = sys.argv[1].split(',') else: suites = default_set # Build the compiler in debug mode build.run('build', release=False) # Run specified set of test suites for suite in suites: title, func = tests[suite] cprint('Running {}...'.format(title), 'blue') func() print_results() if session.failed > 0: sys.exit(1)
if __name__ == '__main__': import sys, os sys.path.append( os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) import build build.run()
tests = { 'internal': ('compiler unit tests', tests_compiler), 'compile-fail': ('compile-fail tests', tests_compile_fail), 'run-pass': ('run-pass tests', tests_run_pass), 'ir': ('IR tests', lambda: tests_emit(target='ir', ext='.ir', descr='IR')), 'asm': ('ASM tests', lambda: tests_emit(target='asm', ext='.s', descr='ASM')) } default_set = ['internal', 'compile-fail', 'run-pass', 'ir', 'asm'] if len(sys.argv) == 2: suites = sys.argv[1].split(',') else: suites = default_set # Build the compiler in debug mode build.run('build', release=True) # Run specified set of test suites for suite in suites: title, func = tests[suite] cprint('Running {}...'.format(title), 'blue') func() print_results() if session.failed > 0: sys.exit(1)
def run(): common.check_platform() common.init_dependencies() build.run() package.run() validate.run()
@@ -96,6 +98,19 @@ swigList = [ ("common.i", "common_wrap.cpp") ] pyModList = [ "common", "scheduler" ] +class my_build(build): + def run(self): + """Specialized Python source builder.""" + # Make the higher level stuff first + here = os.getcwd() + ulpath = os.path.join('..', '..') + os.chdir(ulpath) + cmd = 'sh dobuild.sh' + print "cmd = ", cmd + os.system(cmd) + os.chdir(here) + build.run(self) + # Distutils doesn't currently work with recent 1.3.x # versions of swig. def run_swig(swigList): @@ -116,7 +131,8 @@ check_swig_version() run_swig(swigList) -setup(name="common", version="1.2", +setup(cmdclass={'build': my_build}, + name="common", version="1.2", description="Python UCL Common Library wrapper", author="Ivan R. Judson", author_email="*****@*****.**", url="http://www.mcs.anl.gov/fl/research/common", @@ -127,10 +143,7 @@
def main(): """ Run main code """ build.run(args=parse.args())