aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-30 11:37:31 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:32:59 +0100
commit28626b8aa3b39d400f8f9eb3a0730ac101b2e53a (patch)
treec60cfb02dcee2efcf7045ccfd53316e5a8fe94a8 /python
parenta004eeed5dda3432dcb1a4c0a865ae24daae4fd3 (diff)
downloadpaludis-28626b8aa3b39d400f8f9eb3a0730ac101b2e53a.tar.gz
paludis-28626b8aa3b39d400f8f9eb3a0730ac101b2e53a.tar.xz
slot to requirements
Diffstat (limited to 'python')
-rw-r--r--python/dep_spec.cc47
-rw-r--r--python/dep_spec.hh3
-rw-r--r--python/package_dep_spec_constraint.cc34
3 files changed, 68 insertions, 16 deletions
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 5d5ce2fd1..ab05cfb12 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -78,7 +78,8 @@ namespace paludis
std::shared_ptr<const PackageNamePartConstraint> package_name_part_constraint;
std::shared_ptr<VersionRequirements> version_requirements;
VersionRequirementsMode version_requirements_mode;
- std::shared_ptr<const SlotRequirement> slot;
+ std::shared_ptr<const AnySlotConstraint> any_slot;
+ std::shared_ptr<const ExactSlotConstraint> exact_slot;
std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const FromRepositoryConstraint> from_repository;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements;
@@ -90,7 +91,8 @@ namespace paludis
const std::shared_ptr<const PackageNamePartConstraint> & p,
const std::shared_ptr<VersionRequirements> & v,
const VersionRequirementsMode m,
- const std::shared_ptr<const SlotRequirement> & s,
+ const std::shared_ptr<const AnySlotConstraint> & s,
+ const std::shared_ptr<const ExactSlotConstraint> & xs,
const std::shared_ptr<const InRepositoryConstraint> & ri,
const std::shared_ptr<const FromRepositoryConstraint> & rf,
const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u,
@@ -100,7 +102,8 @@ namespace paludis
package_name_part_constraint(p),
version_requirements(v),
version_requirements_mode(m),
- slot(s),
+ any_slot(s),
+ exact_slot(xs),
in_repository(ri),
from_repository(rf),
additional_requirements(u),
@@ -228,7 +231,8 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
p.package_name_part_constraint(),
std::make_shared<VersionRequirements>(),
p.version_requirements_mode(),
- p.slot_requirement_ptr(),
+ p.any_slot_constraint(),
+ p.exact_slot_constraint(),
p.in_repository_constraint(),
p.from_repository_constraint(),
p.additional_requirements_ptr(),
@@ -249,7 +253,8 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) :
p.package_name_part_constraint(),
std::make_shared<VersionRequirements>(),
p.version_requirements_mode(),
- p.slot_requirement_ptr(),
+ p.any_slot_constraint(),
+ p.exact_slot_constraint(),
p.in_repository_constraint(),
p.from_repository_constraint(),
p.additional_requirements_ptr(),
@@ -278,8 +283,11 @@ PythonPackageDepSpec::operator PackageDepSpec() const
p.version_requirements_mode(version_requirements_mode());
- if (slot_requirement_ptr())
- p.slot_requirement(slot_requirement_ptr());
+ if (any_slot_constraint())
+ p.any_slot_constraint(any_slot_constraint()->locking());
+
+ if (exact_slot_constraint())
+ p.exact_slot_constraint(exact_slot_constraint()->name(), exact_slot_constraint()->locked());
if (in_repository_constraint())
p.in_repository(in_repository_constraint()->name());
@@ -346,10 +354,16 @@ PythonPackageDepSpec::set_version_requirements_mode(const VersionRequirementsMod
_imp->version_requirements_mode = m;
}
-std::shared_ptr<const SlotRequirement>
-PythonPackageDepSpec::slot_requirement_ptr() const
+const std::shared_ptr<const AnySlotConstraint>
+PythonPackageDepSpec::any_slot_constraint() const
+{
+ return _imp->any_slot;
+}
+
+const std::shared_ptr<const ExactSlotConstraint>
+PythonPackageDepSpec::exact_slot_constraint() const
{
- return _imp->slot;
+ return _imp->exact_slot;
}
const std::shared_ptr<const InRepositoryConstraint>
@@ -1226,12 +1240,15 @@ void expose_dep_spec()
"Version requirements mode."
)
-#if 0
- .add_property("slot", &PythonPackageDepSpec::slot_ptr,
- "[ro] SlotName\n"
- "Slot name (may be None)."
+ .add_property("exact_slot", &PythonPackageDepSpec::exact_slot_constraint,
+ "[ro] ExactSlotConstraint\n"
+ "Exact slot constraint (may be None)."
+ )
+
+ .add_property("any_slot", &PythonPackageDepSpec::any_slot_constraint,
+ "[ro] AnySlotConstraint\n"
+ "Any slot constraint (may be None)."
)
-#endif
.add_property("in_repository_constraint", &PythonPackageDepSpec::in_repository_constraint,
"[ro] InRepositoryConstraint\n"
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 46963aca0..d53d4ebc0 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -177,11 +177,12 @@ namespace paludis
const std::shared_ptr<const CategoryNamePartConstraint> category_name_part_constraint() const;
const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const;
const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const;
+ const std::shared_ptr<const ExactSlotConstraint> exact_slot_constraint() const;
+ const std::shared_ptr<const AnySlotConstraint> any_slot_constraint() const;
std::shared_ptr<const VersionRequirements> version_requirements_ptr() const;
VersionRequirementsMode version_requirements_mode() const;
void set_version_requirements_mode(const VersionRequirementsMode m);
- std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
std::string py_str() const;
diff --git a/python/package_dep_spec_constraint.cc b/python/package_dep_spec_constraint.cc
index e89f463d9..c78ba4127 100644
--- a/python/package_dep_spec_constraint.cc
+++ b/python/package_dep_spec_constraint.cc
@@ -186,5 +186,39 @@ void expose_package_dep_spec_constraint()
"[RO] Whether to include masked, as per ::repo??"
)
;
+
+ /**
+ * AnySlotConstraint
+ */
+ class_package_dep_spec_constraint<AnySlotConstraint>
+ (
+ "AnySlotConstraint",
+ "A :* or := constraint for a PackageDepSpec.",
+ bp::no_init
+ )
+
+ .add_property("locking", &AnySlotConstraint::locking,
+ "[RO] Are we locking (:= rather than :*)?"
+ )
+ ;
+
+ /**
+ * ExactSlotConstraint
+ */
+ class_package_dep_spec_constraint<ExactSlotConstraint>
+ (
+ "ExactSlotConstraint",
+ "A :slot or :=slot constraint for a PackageDepSpec.",
+ bp::no_init
+ )
+
+ .add_property("locked", &ExactSlotConstraint::locked,
+ "[RO] Are we locked (:=blah)?"
+ )
+
+ .add_property("name", &ExactSlotConstraint::name,
+ "[RO] The slot name"
+ )
+ ;
}