def download(self): """Run the download primitive.""" # First check whether there is a download primitive implemented by # the Anod spec. self.anod_instance.build_space.create(quiet=True) download_data = self.anod_instance.download() if download_data is None: raise AnodError("no download metadata returned by the download primitive") try: metadata = self.store.get_resource_metadata(download_data) except E3Error as err: self.anod_instance.log.critical(err) raise AnodError( "cannot get resource metadata from store", origin=self.anod_instance.uid ).with_traceback(sys.exc_info()[2]) else: self.store.download_resource( metadata, self.anod_instance.build_space.binary_dir )
def activate(self): sbx = self.anod_instance.sandbox if sbx is None: raise AnodError('cannot activate a spec without a sandbox', 'activate') self.anod_instance.build_space = sbx.get_build_space( name=self.anod_instance.build_space_name, primitive=self.anod_instance.kind, platform=self.anod_instance.env.platform) self.anod_instance.log = e3.log.getLogger('spec.' + self.anod_instance.uid) e3.log.debug('activating spec %s', self.anod_instance.uid)
def wrapper(self, *args, **kwargs): if not has_primitive(self.anod_instance, func.__name__): raise AnodError("no primitive %s" % func.__name__) elif self.anod_instance.build_space is None: raise AnodError(".activate() has not been called") return func(self, *args, **kwargs)