コード例 #1
0
 def setUp(self):
     self.environ0 = os.environ.copy()
     os.environ["EUPS_PATH"] = testEupsStack
     os.environ["EUPS_FLAVOR"] = "Linux"
     if eups.Eups().isSetup("python"):
         eups.unsetup("python")
     self.dbpath = os.path.join(testEupsStack, "ups_db")
コード例 #2
0
 def setUp(self):
     self.environ0 = os.environ.copy()
     os.environ["EUPS_PATH"] = testEupsStack
     os.environ["EUPS_FLAVOR"] = "Linux"
     if eups.Eups().isSetup("python"):
         eups.unsetup("python")
     self.dbpath = os.path.join(testEupsStack, "ups_db")
コード例 #3
0
    def testTaggedTarget(self):
        """
        test equivalent to "setup --tag mine prod" where prod is tagged "mine"
        """

        # do some setup for this test
        pdir = os.path.join(testEupsStack, "Linux", "newprod")
        pdir10 = os.path.join(pdir, "1.0")
        pdir20 = os.path.join(pdir, "1.0")
        pdbdir = os.path.join(self.dbpath, "newprod")
        pupsdir = os.path.join(pdbdir, "Linux")
        ptble10 = os.path.join(pupsdir, "1.0.table")
        ptble20 = os.path.join(pupsdir, "2.0.table")
        newprodtable = \
"""
setupRequired(python)
"""
        self.eups.declare("newprod",
                          "1.0",
                          pdir10,
                          testEupsStack,
                          tablefile=StringIO(newprodtable))
        self.eups.declare("newprod",
                          "2.0",
                          pdir20,
                          testEupsStack,
                          tablefile=StringIO(newprodtable),
                          tag="beta")
        # test the setup
        self.assert_(
            self.eups.findProduct("newprod", "1.0") is not None,
            "newprod 1.0 not declared")
        self.assert_(
            self.eups.findProduct("newprod", "2.0") is not None,
            "newprod 2.0 not declared")
        self.assert_(os.path.exists(ptble10),
                     "Can't find newprod 1.0's table file")
        self.assert_(os.path.exists(ptble20),
                     "Can't find newprod 2.0's table file")

        self.assertEqual(
            len(p for p in self.eups.uses("python") if p[0] == "newprod"), 2,
            "newprod does not depend on python")

        # now we are ready to go: request the beta version of newprod
        eups.setup("newprod", prefTags="beta")

        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is not None, "newprod not setup")
        self.assertEqual(prod.version, "2.0")
        self.assertIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        self.assertEqual(os.environ["NEWPROD_DIR"], pdir20)

        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEqual(prod.version, "2.5.2")  # tagged current
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEqual(os.environ["PYTHON_DIR"], prod.dir)

        eups.unsetup("newprod")
        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is None, "newprod is still setup")
        self.assertNotIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertNotIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ,
                         "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")

        # now test with dependent product with requested tag
        self.eups.assignTag("beta", "python", "2.6")
        eups.setup("newprod", prefTags="beta")

        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is not None, "newprod not setup")
        self.assertEqual(prod.version, "2.0")
        self.assertIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        self.assertEqual(os.environ["NEWPROD_DIR"], pdir20)

        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEqual(prod.version, "2.6")  # tagged beta
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEqual(os.environ["PYTHON_DIR"], prod.dir)

        self.eups.unassignTag("beta", "python")
コード例 #4
0
    def testDefPrefTag(self):
        """
        test equivalent to "setup prod"
        """
        # test some assumptions
        preftags = self.eups.getPreferredTags()
        self.assertIn("current", preftags, "no python marked current")
        self.assertNotIn("SETUP_PYTHON", os.environ, "python already set")

        # setup the preferred (tagged current) version
        eups.setup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEqual(prod.version, "2.5.2")
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEqual(os.environ["PYTHON_DIR"], prod.dir)

        # check for dependent product
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is not None, "tcltk not setup")
        self.assertEqual(prod.version, "8.5a4")
        self.assertIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK not set")
        self.assertIn("TCLTK_DIR", os.environ, "TCLTK_DIR not set")
        self.assertEqual(os.environ["TCLTK_DIR"], prod.dir)

        eups.unsetup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ,
                         "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is None, "tcltk is still setup")
        self.assertNotIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK is still set")
        self.assertNotIn("TCLTK_DIR", os.environ, "TCLTK_DIR is still set")

        # set up an explicit version
        eups.setup("python", "2.5.2")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEqual(prod.version, "2.5.2")
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEqual(os.environ["PYTHON_DIR"], prod.dir)

        # check for dependent product
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is not None, "tcltk not setup")
        self.assertEqual(prod.version, "8.5a4")
        self.assertIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK not set")
        self.assertIn("TCLTK_DIR", os.environ, "TCLTK_DIR not set")
        self.assertEqual(os.environ["TCLTK_DIR"], prod.dir)

        eups.unsetup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ,
                         "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is None, "tcltk is still setup")
        self.assertNotIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK is still set")
        self.assertNotIn("TCLTK_DIR", os.environ, "TCLTK_DIR is still set")
コード例 #5
0
    def testDefPrefTag(self):
        """
        test equivalent to "setup prod"
        """
        # test some assumptions
        preftags = self.eups.getPreferredTags()
        self.assertIn("current", preftags, "no python marked current")
        self.assertNotIn("SETUP_PYTHON", os.environ, "python already set")

        # setup the preferred (tagged current) version
        eups.setup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEquals(prod.version, "2.5.2")
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEquals(os.environ["PYTHON_DIR"], prod.dir)

        # check for dependent product
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is not None, "tcltk not setup")
        self.assertEquals(prod.version, "8.5a4")
        self.assertIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK not set")
        self.assertIn("TCLTK_DIR", os.environ, "TCLTK_DIR not set")
        self.assertEquals(os.environ["TCLTK_DIR"], prod.dir)        

        eups.unsetup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is None, "tcltk is still setup")
        self.assertNotIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK is still set")
        self.assertNotIn("TCLTK_DIR", os.environ, "TCLTK_DIR is still set")

        # set up an explicit version
        eups.setup("python", "2.5.2")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEquals(prod.version, "2.5.2")
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEquals(os.environ["PYTHON_DIR"], prod.dir)

        # check for dependent product
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is not None, "tcltk not setup")
        self.assertEquals(prod.version, "8.5a4")
        self.assertIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK not set")
        self.assertIn("TCLTK_DIR", os.environ, "TCLTK_DIR not set")
        self.assertEquals(os.environ["TCLTK_DIR"], prod.dir)        

        eups.unsetup("python")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")
        prod = self.eups.findSetupProduct("tcltk")
        self.assert_(prod is None, "tcltk is still setup")
        self.assertNotIn("SETUP_TCLTK", os.environ, "SETUP_TCLTK is still set")
        self.assertNotIn("TCLTK_DIR", os.environ, "TCLTK_DIR is still set")
コード例 #6
0
    def testTaggedTarget(self):
        """
        test equivalent to "setup --tag mine prod" where prod is tagged "mine"
        """

        # do some setup for this test
        pdir = os.path.join(testEupsStack, "Linux", "newprod")
        pdir10 = os.path.join(pdir, "1.0")
        pdir20 = os.path.join(pdir, "1.0")
        pdbdir = os.path.join(self.dbpath, "newprod")
        pupsdir = os.path.join(pdbdir, "Linux")
        ptble10 = os.path.join(pupsdir, "1.0.table")
        ptble20 = os.path.join(pupsdir, "2.0.table")
        newprodtable = \
"""
setupRequired(python)
"""
        self.eups.declare("newprod", "1.0", pdir10, testEupsStack, 
                          tablefile=StringIO(newprodtable))
        self.eups.declare("newprod", "2.0", pdir20, testEupsStack, 
                          tablefile=StringIO(newprodtable), tag="beta")
        # test the setup
        self.assert_(self.eups.findProduct("newprod", "1.0") is not None, "newprod 1.0 not declared")
        self.assert_(self.eups.findProduct("newprod", "2.0") is not None, "newprod 2.0 not declared")
        self.assert_(os.path.exists(ptble10), "Can't find newprod 1.0's table file")
        self.assert_(os.path.exists(ptble20), "Can't find newprod 2.0's table file")

        self.assertEquals(len(p for p in self.eups.uses("python") if p[0] == "newprod"), 2,
                          "newprod does not depend on python")

        # now we are ready to go: request the beta version of newprod
        eups.setup("newprod", prefTags="beta")

        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is not None, "newprod not setup")
        self.assertEquals(prod.version, "2.0")
        self.assertIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        self.assertEquals(os.environ["NEWPROD_DIR"], pdir20)

        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEquals(prod.version, "2.5.2")  # tagged current 
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEquals(os.environ["PYTHON_DIR"], prod.dir)

        eups.unsetup("newprod")
        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is None, "newprod is still setup")
        self.assertNotIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertNotIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is None, "python is still setup")
        self.assertNotIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON is still set")
        self.assertNotIn("PYTHON_DIR", os.environ, "PYTHON_DIR is still set")

        # now test with dependent product with requested tag
        self.eups.assignTag("beta", "python", "2.6")
        eups.setup("newprod", prefTags="beta")

        prod = self.eups.findSetupProduct("newprod")
        self.assert_(prod is not None, "newprod not setup")
        self.assertEquals(prod.version, "2.0")
        self.assertIn("SETUP_NEWPROD", os.environ, "SETUP_NEWPROD not set")
        self.assertIn("NEWPROD_DIR", os.environ, "NEWPROD_DIR not set")
        self.assertEquals(os.environ["NEWPROD_DIR"], pdir20)

        prod = self.eups.findSetupProduct("python")
        self.assert_(prod is not None, "python not setup")
        self.assertEquals(prod.version, "2.6")  # tagged beta
        self.assertIn("SETUP_PYTHON", os.environ, "SETUP_PYTHON not set")
        self.assertIn("PYTHON_DIR", os.environ, "PYTHON_DIR not set")
        self.assertEquals(os.environ["PYTHON_DIR"], prod.dir)

        self.eups.unassignTag("beta", "python")