예제 #1
0
def getVersionSafely(proj):
    """
    Call dist.getVersion, and if an error is raised, return None.
    """
    try:
        currentVersionStr = dist.getVersion(proj)
    except:
        currentVersionStr = None
    return currentVersionStr
예제 #2
0
def getVersionSafely(proj):
    """
    Call dist.getVersion, and if an error is raised, return None.
    """
    try:
        currentVersionStr = dist.getVersion(proj)
    except:
        currentVersionStr = None
    return currentVersionStr
예제 #3
0
    def test_getVersionCore(self):
        """
        Test that getting the version of core reads from the
        [base]/_version.py file.
        """
        with open(os.path.join(self.dirname, "_version.py"), "w") as f:
            f.write("""
from twisted.python import versions
version = versions.Version("twisted", 0, 1, 2)
""")
        self.assertEqual(dist.getVersion(base=self.dirname), "0.1.2")
    def test_getVersionCore(self):
        """
        Test that getting the version of core reads from the
        [base]/_version.py file.
        """
        with open(os.path.join(self.dirname, "_version.py"), "w") as f:
            f.write("""
from twisted.python import versions
version = versions.Version("twisted", 0, 1, 2)
""")
        self.assertEqual(dist.getVersion(base=self.dirname), "0.1.2")
예제 #5
0
    def test_getVersionOther(self):
        """
        Test that getting the version of a non-core project reads from
        the [base]/[projname]/_version.py file.
        """
        os.mkdir(os.path.join(self.dirname, "blat"))
        f = open(os.path.join(self.dirname, "blat", "_version.py"), "w")
        f.write("""
from twisted.python import versions
version = versions.Version("twisted.blat", 9, 8, 10)
""")
        f.close()
        self.assertEquals(dist.getVersion("blat", base=self.dirname), "9.8.10")