Exemplo n.º 1
0
    def test_parse(self):
        dcfp1 = parseDCF(DCF1)
        self.assertEquals(
            dcfp1[0]["Depends"],
            "glmnet, graphics, gplots, pls, survival, DLBCL, superpc, utils, methods, stats, Biobase"
        )
        self.assertEquals(dcfp1[0]["Repository"], "CRAN",
                          "single line Depends")

        dcfp2 = parseDCF(DCF2)
        self.assertEquals(
            dcfp2[0]["Imports"],
            "evaluate (>= 0.4.7), digest, formatR (>= 0.9), highr (>= 0.2), markdown (>= 0.6.3), stringr (>= 0.6), tools"
        )
Exemplo n.º 2
0
 def test_collate_dcf_parses(self):
     dcfp1 = parseDCF(DCF1)
     dcfp2 = parseDCF(DCF2)
     (dc, dv) = DCFparse2DependencyLists(dcfp1 + dcfp2)
     print json.dumps(dc, indent=4)
     self.assertEquals(dc["knitr"]["1.4"], "2013-08-10")
     self.assertEquals(dc["aBioMarVsuit"]["1.0"], "2012-12-26")
     self.assertEquals(dv["knitr"]["1.4"]["evaluate"],
                       [("Imports", ">= 0.4.7")])
     self.assertEquals(dv["knitr"]["1.4"]["stringr"],
                       [("Imports", ">= 0.6")])
     self.assertEquals(dv["knitr"]["1.4"]["digest"], [("Imports", "")])
     self.assertEquals(dv["knitr"]["1.4"]["rgl"], [("Suggests", "")])
     self.assertEquals(dv["knitr"]["1.4"]["R2SWF"],
                       [("Suggests", ">= 0.4")])
Exemplo n.º 3
0
def scan_R_descriptions(descriptionDir):
    """Turn cache of DESCRIPTION files from R projects over time into dependency data structure"""
    depstruct = []
    for root, dirs, files in os.walk(descriptionDir):
        if len(depstruct) % 500 == 0:
            print "Reading directory", root
        for f in files:
            if f == "DESCRIPTION":
                with open( os.path.join(root,f), "r") as f:
                    try:
                        depstruct = depstruct + parseDCF(f.read())
                    except Exception, e:
                        print "Error reading ", dirs, "/DESCRIPTION", e
Exemplo n.º 4
0
def scan_R_descriptions(descriptionDir):
    """Turn cache of DESCRIPTION files from R projects over time into dependency data structure"""
    depstruct = []
    for root, dirs, files in os.walk(descriptionDir):
        if len(depstruct) % 500 == 0:
            print "Reading directory", root
        for f in files:
            if f == "DESCRIPTION":
                with open(os.path.join(root, f), "r") as f:
                    try:
                        depstruct = depstruct + parseDCF(f.read())
                    except Exception, e:
                        print "Error reading ", dirs, "/DESCRIPTION", e
Exemplo n.º 5
0
def scan_R_descriptions(descriptionDir):
    """Turn cache of DESCRIPTION files from R projects over time into dependency data structure"""
    depstruct = []
    for root, dirs, files in os.walk(descriptionDir):
        if len(depstruct) % 500 == 0:
            print "Reading directory", root
        for f in files:
            if f == "DESCRIPTION":
                with open( os.path.join(root,f), "r") as f:
                    depstruct = depstruct + parseDCF(f.read())
    (da, dc, dv) = DCFparse2DependencyLists(depstruct)
    vh = versionhistory.VersionHistories()
    vh.preload(da, dc, dv, datetime.datetime.now().replace(tzinfo=pytz.UTC))
    return vh