Example #1
0
 def post_install(self):
     """
     Try to install egg, exe or msi after packaging.
     
     Search an egg, then an exe, then a msi.
     
     If it is an egg, use command alea_install -H None -f . mypackage.egg
     
     Can be overloaded.
     
     :return: True if success, else False
     """
     
     egg_search = self.egg_name() + "*"
     egg = glob.glob( path(".")/egg_search )
     if egg:
         egg = egg[0]
         cmd = "alea_install -H None -f . %s" %egg
         return sh(cmd) == 0
     else: 
         #
         name_search = "*" + self.name + "*.exe"
         name = glob.glob( path(".")/name_search )
         if not name:
             name_search = "*" + self.name + "*.msi"
             name = glob.glob( path(".")/name_search )
         
         if name:
             name = name[0]
             return util_install(name)
             
     return False
Example #2
0
    def post_install(self):
        """
        Try to install egg, exe or msi after packaging.
        
        Search an egg, then an exe, then a msi.
        
        If it is an egg, use command alea_install -H None -f . mypackage.egg
        
        Can be overloaded.
        
        :return: True if success, else False
        """

        egg_search = self.egg_name() + "*"
        egg = glob.glob(path(".") / egg_search)
        if egg:
            egg = egg[0]
            cmd = "alea_install -H None -f . %s" % egg
            return sh(cmd) == 0
        else:
            #
            name_search = "*" + self.name + "*.exe"
            name = glob.glob(path(".") / name_search)
            if not name:
                name_search = "*" + self.name + "*.msi"
                name = glob.glob(path(".") / name_search)

            if name:
                name = name[0]
                return util_install(name)

        return False
Example #3
0
 def packaged(self):
     """
     :return: True if not yet packaged in dist repo. Else False
     """
     name_search = "*" + self.name + "*"
     name = glob.glob(path(self.dist_dir) / name_search)
     if name:
         return True, name
     return False, ""
Example #4
0
def into_subdir(base, pattern):
    if pattern is not None:
        pths = glob.glob(path(base)/pattern)
        if len(pths):
            return pths[0]
        else:
            return None
    else:
        return base
Example #5
0
 def packaged(self):
     """
     :return: True if not yet packaged in dist repo. Else False
     """
     name_search = "*" + self.name + "*"
     name = glob.glob( path(self.dist_dir)/name_search )
     if name:
         return True, name
     return False, ""
Example #6
0
def formulas():
    """
    Return the list of formula available.
    """
    path_ = path(__file__).abspath().dirname()
    formula_list = glob.glob(path(path_)/"formulas"/"*.py")

    short_list = list()
    for formu in formula_list:
        formu = path(formu).splitpath()[-1]
        formu = path(formu).splitext()[0]
        short_list.append(str(formu))
        
    if short_list.count("__init__") > 0:
        short_list.remove("__init__")
        
    return short_list
Example #7
0
    def globInstaller(pk, mask_):
        dir_ = srcDir
        identifier = "*" + pk + "*"
        if bt(mask_, PY_DEP):
            identifier += pyMaj + "." + pyMin + "*"
        if bt(mask_, MSI): identifier += ".msi"
        elif bt(mask_, EXE): identifier += ".exe"
        elif bt(mask_, EXEDIST):
            identifier += ".exe"
            dir_ = tpp_eggDir
        elif bt(mask_, ZIPDIST):
            identifier += ".zip"
            dir_ = tpp_eggDir
        elif bt(mask_, TARDIST):
            identifier += ".tar.gz"
            dir_ = tpp_eggDir
        elif bt(mask_, EGG):
            identifier += ".egg"
            dir_ = tpp_eggDir
        elif bt(mask_, NOFLAG):
            return None
        else:
            raise Exception("Unknown installer type: " + pk + ":" + str(mask_))

        try:
            if bt(mask_, ARCH):  #WE CARE ABOUT THE ARCH
                if arch == "win32":  #either it has 32 or nothing but not 64
                    files = [
                        f for f in glob.iglob(path(dir_) / identifier)
                        if arch in f or ("win32" not in f and "64" not in f)
                    ]
                else:
                    files = [
                        f for f in glob.iglob(path(dir_) / identifier)
                        if arch in f
                    ]
                return sorted(files, lambda x, y: cmp(len(x), len(y)))[0]
            else:
                return glob.glob(path(dir_) / identifier)[0]
        except:
            #traceback.print_exc()
            err(u"\tNo installer found for %s for %s : %s\n" %
                (pk, dir_, identifier))
            return None
Example #8
0
    def globInstaller(pk, mask_):
        dir_ = srcDir
        identifier = "*"+pk+"*"
        if bt(mask_, PY_DEP):
            identifier+=pyMaj+"."+pyMin+"*"
        if bt(mask_, MSI): identifier+=".msi"
        elif bt(mask_, EXE): identifier+=".exe"
        elif bt(mask_, EXEDIST): 
            identifier+=".exe"
            dir_ = tpp_eggDir
        elif bt(mask_, ZIPDIST): 
            identifier+=".zip"
            dir_ = tpp_eggDir        
        elif bt(mask_, TARDIST): 
            identifier+=".tar.gz"
            dir_ = tpp_eggDir
        elif bt(mask_, EGG): 
            identifier+=".egg"
            dir_ = tpp_eggDir        
        elif bt(mask_, NOFLAG):
            return None
        else:
            raise Exception("Unknown installer type: " + pk +":"+str(mask_))

        try:
            if bt(mask_, ARCH): #WE CARE ABOUT THE ARCH
                if arch=="win32": #either it has 32 or nothing but not 64
                    files = [f for f in glob.iglob(path(dir_)/identifier)  if arch in f or ("win32" not in f and "64" not in f)]
                else:
                    files = [f for f in glob.iglob(path(dir_)/identifier)  if arch in f]
                return sorted(files, lambda x, y: cmp(len(x), len(y)))[0]
            else:
                return glob.glob(path(dir_)/identifier)[0]
        except:
            #traceback.print_exc()
            err(u"\tNo installer found for %s for %s : %s\n"%(pk, dir_,identifier))
            return None
Example #9
0
def get_project_eggs(arch, globs, outDir, srcDir):
    # real egg names have the project prefix eg, "OpenAlea", "VPlants".
    # then comes the python version "py2.6"
    # and optionnaly the OS "linux-i686", "win32".
    # However, we don't explicitly know which egg has the os in the name
    # so simply encoding the os in the glob is a bad idea. What we do is:
    # [glob for project_prefix*python_version.egg] + [glob for project_prefix*python_version*os.egg]
    # The egg globs at this stage have the project_prefix*python_version*.egg form.

    files = []
    for g in globs:
        files += glob.glob(g)

    # -- then we filter these files --
    files = [f for f in files if (arch in f) or (not "win" in f)]

    print "Gathering path to eggs..."
    egg_paths = []
    # localFiles = map(basename, files)
    localFiles = [path(file).basename() for file in files]
    for f, filename in zip(files, localFiles):
        egg_paths.append(f)
        print "\tWill install %s" % f
    return egg_paths
Example #10
0
def get_project_eggs(arch, globs, outDir, srcDir):
    # real egg names have the project prefix eg, "OpenAlea", "VPlants".
    # then comes the python version "py2.6"
    # and optionnaly the OS "linux-i686", "win32".
    # However, we don't explicitly know which egg has the os in the name
    # so simply encoding the os in the glob is a bad idea. What we do is:
    # [glob for project_prefix*python_version.egg] + [glob for project_prefix*python_version*os.egg]
    # The egg globs at this stage have the project_prefix*python_version*.egg form.   
    
    files = []
    for g in globs:
        files += glob.glob(g)

    # -- then we filter these files --
    files = [f for f in files if (arch in f) or (not "win" in f)]
        
    print "Gathering path to eggs..."
    egg_paths = []
    # localFiles = map(basename, files)
    localFiles = [path(file).basename() for file in files] 
    for f, filename in zip(files, localFiles):
        egg_paths.append(f)
        print "\tWill install %s"%f
    return egg_paths
Example #11
0
 def _glob_egg(self):
     """
     Search egg
     """
     eggs = glob.glob(path(self.dist_dir) / (self.egg_name() + "*.egg"))
     return None if not eggs else eggs[0]
Example #12
0
 def _glob_egg(self):
     """
     Search egg
     """
     eggs = glob.glob( path(self.dist_dir)/(self.egg_name()+"*.egg") )
     return None if not eggs else eggs[0]