def uninstall(deploy, target, build, name, toolchain = False): globals()['technicolor'] = yawn.get(name) if not technicolor.production: console.error('*NOT* going to remove everything!') return # Start with clean envs env.set(target, build) # Setup the prefixes env.native.prefix = fs.join(deploy, 'Toolchain', target) env.current.prefix = fs.join(deploy, target) # And tmp dirs # env.native.tmp = fs.join(roottmp, 'Toolchain') # env.current.tmp = fs.join(roottmp, target) path = __find(technicolor.production, env.native if toolchain else env.current, ignoresystem = True) if path: console.info("Found tracks of it. Removing production. %s" % path) fs.remove(path) else: console.error("The requested monade is NOT installed. Doing nothing.")
def c_library(self): name = self.kontinuation[1] old_env = self.kontinuation[2] k = self.kontinuation[3] self.kontinuation = k lib_env = {} if self.export: for i in self.export: # Gets all the dependants and adds it to the functions environment if isinstance(self.env[i], tokens.function.Function): for ident, val in self.get_dependants(self.env[i], env): self.env[i].env.set(ident, val) lib_env.set(i, self.env[i]) self.export = None env.set(name, lib_env) self.env = old_env self.control = self.eval_value return
AS SUCH, NEITHER CAN BE IMPLEMENTED IN THESE CLASSES WITHOUT WREAKING HAVOC """ from checks import checkPathFormat, fullPathExists, fileExists from inspect import stack from env import set import datetime import time import inspect import logging import logging.handlers import os import re import sys set() # sys.path.append("./common") class log(object): """ :NAME: loghanlder.log('message', [KW-params]) :DESCRIPTION: 'log' is an interface and controller for the Python module 'logging'. It functions using the same basic interface as the 'logging', but handles the instantiation and management blindly in the backend. from loghandler import log log.info( "I automatically instantiate the logging object.",
def install(rootsrc, roottmp, deploy, target, build, name, toolchain = False, clean = False, cleanarchive = False, debug = False, static = False): globals()['technicolor'] = yawn.get(name) # If already done, for this target, during *this* session, silently pass - avoid verbose dependency checking and recursive references # (yeah, I'm looking at you goddamn pkgconfig) if (not toolchain) and (target in technicolor.done): return console.header("Target: %s - Build: %s - Yawn: %s (version %s - license %s)" % (target, build, technicolor.name, technicolor.version, technicolor.license), 1) # Start with clean envs env.set(target, build) # Setup the prefixes # XXX this totally sucks ass. Toolchain of a package may in turn depend on a specific tool, which makes it compiled into the Toolchain/Darwin directory # anyway... debug = not (not debug or (debug == "false")) static = not (not static or (static == "false")) env.native.prefix = fs.join(deploy, 'Toolchain', toolchain if toolchain else target) env.current.prefix = fs.join(deploy, target, 'debug' if debug else 'release', 'static' if static else 'dynamic') # And tmp dirs env.native.tmp = fs.join(roottmp, 'Toolchain', toolchain if toolchain else target) env.current.tmp = fs.join(roottmp, target, 'debug' if debug else 'release', 'static' if static else 'dynamic') # And src dirs env.native.src = fs.join(rootsrc, 'Toolchain', toolchain if toolchain else target) env.current.src = fs.join(rootsrc, target) console.header('Searching for it') if technicolor.production and __find(technicolor.production, env.native if toolchain else env.current, target != build): console.info("The requested monade seems to be already compiled and installed. Will do nothing.") technicolor.done[target] = True return else: console.info("Will build") console.header("Building tools") # Walk tool dependencies first and build them if need be for depname in technicolor.toolchain: # If we already are compiling a tool, forward the original toolchain value. If not, that will be the target forwardtoolchaintarget = toolchain if toolchain else target install(rootsrc, roottmp, deploy, build, build, depname, forwardtoolchaintarget, clean, cleanarchive) console.info('Done with tools') console.header('Building dependencies') # Get back to the original yawn now - XXX EXTREMELY bad design globals()['technicolor'] = yawn.get(name) # Walk dependencies and build them if need be for depname in technicolor.depends: # If we already are compiling a tool, forward the original toolchain value. If not, that will be the target forwardtoolchaintarget = toolchain if toolchain else False install(rootsrc, roottmp, deploy, target, build, depname, forwardtoolchaintarget, clean, cleanarchive, debug, static) console.info('Done with dependencies') # Get back to the original yawn now - XXX EXTREMELY bad design globals()['technicolor'] = yawn.get(name) env.set(target, build) env.current.debug = True if debug else False env.current.static = True if static else False env.native.prefix = fs.join(deploy, 'Toolchain', toolchain if toolchain else target) env.current.prefix = fs.join(deploy, target, 'debug' if debug else 'release', 'static' if static else 'dynamic') env.native.tmp = fs.join(roottmp, 'Toolchain', toolchain if toolchain else target) env.current.tmp = fs.join(roottmp, target, 'debug' if debug else 'release', 'static' if static else 'dynamic') env.native.src = fs.join(rootsrc, 'Toolchain', toolchain if toolchain else target) env.current.src = fs.join(rootsrc, target) console.header("Back onto Target: %s - Build: %s - Yawn: %s (version %s - license %s)" % (target, build, technicolor.name, technicolor.version, technicolor.license), 1) if not technicolor.url: console.warn('This is a dummy package with no url. Just passing by.') return # Load the python script file # sys.path.insert(0, 'monades') # currentjob = __import__('%s' % name) exec('from technicolor import %s as currentjob' % technicolor.name) # Ensure the package is here console.header('Getting remote stuff here') globals()['environ'] = env.native if toolchain else env.current # Set current directory now to source directory environ.pwd = fs.join(environ.src, technicolor.local) if technicolor.fetch(environ.src, cleanarchive): console.header("Got remote package, applying patches now.") technicolor.patch(environ.pwd, target) technicolor.copy(environ.pwd) if 'preprocess' in dir(currentjob): console.header('Preprocessing') currentjob.preprocess() else: console.warn('NO preprocessing specified for this monade. Going on.') else: console.warn("Output directory already exist. NOT getting package again and NOT running pre hook. If this is not acceptable, rm %s" % environ.pwd) # Ensure target dir are there to avoid complaints fs.makedir(fs.join(environ.prefix, 'lib')) fs.makedir(fs.join(environ.prefix, 'bin')) fs.makedir(fs.join(environ.prefix, 'include')) # Switch current directory now to temp directory environ.pwd = fs.join(environ.tmp, technicolor.local) if not fs.exists(environ.pwd): fs.makedir(environ.pwd) if 'configure' in dir(currentjob): # Exec console.header('Configure') currentjob.configure() else: console.warn('NO configure instructions specified for this monade! Going on.') if clean: if 'clean' in dir(currentjob): # Exec console.header('Clean') currentjob.clean() else: console.warn('NO clean instructions specified for this monade! Going on.') if 'make' in dir(currentjob): # Exec console.header('Make') currentjob.make() else: console.warn('NO make instructions specified for this monade! Going on.') # XXX switch this to deploy directory? console.header('Post-processing!', 1) if 'postprocess' in dir(currentjob): currentjob.postprocess() else: console.warn('NO post-process instructions specified for this monade! Going on.') technicolor.done[target] = True