示例#1
0
文件: app.py 项目: CraigLoomis/eups
def productDir(productName=None, versionName=Tag("setup"), eupsenv=None):
    """
    return the installation directory (PRODUCT_DIR) for the specified 
    product.  None is returned if no matching product can be found
    @param productName   the name of the product of interest; if None return a dictionary of all productDirs
    @param version       the desired version.  This can in one of the 
                         following forms:
                          *  an explicit version 
                          *  a version expression (e.g. ">=3.3")
                          *  a Tag instance 
                          *  None, in which case, the (most) preferred 
                               version will be returned.
                         The default is the global tag "setup".  
    @param eupsenv       The Eups instance to use to find the product.  If 
                            not provided, a default will created.  
    """
    if productName and versionName == Tag("setup"): # we can take a shortcut
        return os.environ.get(utils.dirEnvNameFor(productName))

    if not eupsenv:
        eupsenv = Eups()

    if not productName:
        tags = None
        if versionName == Tag("setup"):
            tags = versionName
            versionName = ""
            
        productList = eupsenv.findProducts(productName, versionName, tags)
        productDirs = {}
        for prod in productList:
            pdir = prod.dir
            if pdir == "none":
                pdir = None
            productDirs[prod.name] = pdir

        return productDirs

    prod = eupsenv.findProduct(productName, versionName)
    if not prod:
        return None

    pdir = prod.dir
    if pdir == "none":
        pdir = None
        
    return pdir
示例#2
0
def productDir(productName=None, versionName=Tag("setup"), eupsenv=None):
    """
    return the installation directory (PRODUCT_DIR) for the specified 
    product.  None is returned if no matching product can be found
    @param productName   the name of the product of interest; if None return a dictionary of all productDirs
    @param version       the desired version.  This can in one of the 
                         following forms:
                          *  an explicit version 
                          *  a version expression (e.g. ">=3.3")
                          *  a Tag instance 
                          *  None, in which case, the (most) preferred 
                               version will be returned.
                         The default is the global tag "setup".  
    @param eupsenv       The Eups instance to use to find the product.  If 
                            not provided, a default will created.  
    """
    if productName and versionName == Tag("setup"):  # we can take a shortcut
        return os.environ.get(utils.dirEnvNameFor(productName))

    if not eupsenv:
        eupsenv = Eups()

    if not productName:
        tags = None
        if versionName == Tag("setup"):
            tags = versionName
            versionName = ""

        productList = eupsenv.findProducts(productName, versionName, tags)
        productDirs = {}
        for prod in productList:
            pdir = prod.dir
            if pdir == "none":
                pdir = None
            productDirs[prod.name] = pdir

        return productDirs

    prod = eupsenv.findProduct(productName, versionName)
    if not prod:
        return None

    pdir = prod.dir
    if pdir == "none":
        pdir = None

    return pdir
示例#3
0
文件: Product.py 项目: jhoblitt/eups
 def envarDirName(self):
     return utils.dirEnvNameFor(self.name)
示例#4
0
文件: Product.py 项目: airnandez/eups
 def envarDirName(self):
     return utils.dirEnvNameFor(self.name)