예제 #1
0
def load_bundle(bundle_dir):
    from databundles.run import import_file
    
    rp = os.path.realpath(os.path.join(bundle_dir, 'bundle.py'))
    mod = import_file(rp)
  
    return mod.Bundle
예제 #2
0
파일: git.py 프로젝트: kball/databundles
    def dependencies(self):
        '''Return a set of dependencies for the source packages'''
        from collections import defaultdict
        import os
        from databundles.identity import Identity
        from databundles.run import import_file
        
        if not self._dependencies:
            
            depset = defaultdict(set)
        
            for root, _, files in os.walk(self.dir_):
                if 'bundle.yaml' in files:

                    rp = os.path.realpath(os.path.join(root, 'bundle.py'))
                    mod = import_file(rp)
  
                    bundle = mod.Bundle(root)
                    deps =  bundle.library.dependencies

                    for _,v in deps.items():
                        ident = Identity.parse_name(v) # Remove revision 
                        #print "XXX {:50s} {:30s} {}".format(v, ident.name, ident.to_dict())
                        depset[bundle.identity.name].add(ident.name)            
                    
            self._dependencies = depset
            
        return dict(self._dependencies.items())
예제 #3
0
    def setUp(self):
        import testbundle.bundle, shutil, os
        
        self.bundle_dir = os.path.dirname(testbundle.bundle.__file__)
        self.rc = get_runconfig((os.path.join(self.bundle_dir,'source-test-config.yaml'),
                                 os.path.join(self.bundle_dir,'bundle.yaml'),
                                 RunConfig.USER_CONFIG))

        self.copy_or_build_bundle()

        bundle = Bundle()    

        print "Deleting: {}".format(self.rc.group('filesystem').root_dir)
        databundles.util.rm_rf(self.rc.group('filesystem').root_dir)

        bdir = os.path.join(self.rc.group('sourcerepo')['dir'],'testbundle')


        pats = shutil.ignore_patterns('build', 'build-save','*.pyc', '.git','.gitignore','.ignore','__init__.py')

        print "Copying test dir tree to ", bdir
        shutil.copytree(bundle.bundle_dir, bdir, ignore=pats)

        # Import the bundle file from the directory
        from databundles.run import import_file
        import imp
        rp = os.path.realpath(os.path.join(bdir, 'bundle.py'))
        mod = import_file(rp)
     
        dir_ = os.path.dirname(rp)
        self.bundle = mod.Bundle(dir_)

        print self.bundle.bundle_dir
예제 #4
0
파일: git.py 프로젝트: kball/databundles
 def bundle_dir(self, bundle_dir):
     self._bundle_dir = bundle_dir
     
     # Import the bundle file from the directory
     from databundles.run import import_file
     import os
     rp = os.path.realpath(os.path.join(bundle_dir, 'bundle.py'))
     mod = import_file(rp)
  
     dir_ = os.path.dirname(rp)
     self.bundle = mod.Bundle(dir_)