aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-11-13 22:33:56 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-11-13 22:33:56 +0000
commit324f4dd660878d5d9d28f440fd82555c2738b444 (patch)
tree5aca729f2f9950510498a91da9122f20c3b49ef2
parent4ffb6352a47e26132a92f6a0d152f13ea61e1d8d (diff)
downloadpaludis-324f4dd660878d5d9d28f440fd82555c2738b444.tar.gz
paludis-324f4dd660878d5d9d28f440fd82555c2738b444.tar.xz
(python) Add has_{try,scm}_part to VersionSpec.
-rwxr-xr-xdoc/api/python/example_version_spec.py2
-rw-r--r--python/version_spec.cc10
-rwxr-xr-xpython/version_spec_TEST.py11
3 files changed, 23 insertions, 0 deletions
diff --git a/doc/api/python/example_version_spec.py b/doc/api/python/example_version_spec.py
index 93f5ba5..c479d73 100755
--- a/doc/api/python/example_version_spec.py
+++ b/doc/api/python/example_version_spec.py
@@ -17,4 +17,6 @@ for v in versions:
print " Revision only: %s" % v.revision_only()
print " Bump: %s" % v.bump()
print " Is SCM? %s" % v.is_scm
+ print " Has -try? %s" % v.has_try_part
+ print " Has -scm? %s" % v.has_scm_part
print
diff --git a/python/version_spec.cc b/python/version_spec.cc
index b96095e..2581427 100644
--- a/python/version_spec.cc
+++ b/python/version_spec.cc
@@ -58,6 +58,16 @@ void expose_version_spec()
"Are we an -scm package, or something pretending to be one?"
)
+ .add_property("has_scm_part", &VersionSpec::has_scm_part,
+ "[ro] bool\n"
+ "Do we have an -scm part?"
+ )
+
+ .add_property("has_try_part", &VersionSpec::has_try_part,
+ "[ro] bool\n"
+ "Do we have a -try part?"
+ )
+
.def("remove_revision", &VersionSpec::remove_revision,
"remove_revision() -> VersionSpec\n"
"Remove the revision part."
diff --git a/python/version_spec_TEST.py b/python/version_spec_TEST.py
index 2c44ceb..1573632 100755
--- a/python/version_spec_TEST.py
+++ b/python/version_spec_TEST.py
@@ -61,6 +61,17 @@ class TestCase_VersionSpec(unittest.TestCase):
def test_08_is_scm(self):
self.assert_(VersionSpec("scm").is_scm)
+ self.assert_(VersionSpec("9999").is_scm)
+ self.assert_(not VersionSpec("1").is_scm)
+
+ def test_09_has_scm_part(self):
+ self.assert_(VersionSpec("1-scm").has_scm_part)
+ self.assert_(not VersionSpec("1").has_scm_part)
+
+ def test_09_has_scm_part(self):
+ self.assert_(VersionSpec("1-try").has_try_part)
+ self.assert_(not VersionSpec("1").has_try_part)
+
if __name__ == "__main__":
unittest.main()