App: Add support for <pythonmin> XML tag in metadata
This commit is contained in:
@@ -228,7 +228,11 @@ Meta::Version Metadata::freecadmin() const
|
||||
|
||||
Meta::Version Metadata::freecadmax() const
|
||||
{
|
||||
return _freecadmax;
|
||||
return _freecadmax; }
|
||||
|
||||
Meta::Version Metadata::pythonmin() const
|
||||
{
|
||||
return _pythonmin;
|
||||
}
|
||||
|
||||
std::multimap<std::string, Metadata> Metadata::content() const
|
||||
@@ -343,6 +347,11 @@ void Metadata::setFreeCADMin(const Meta::Version& version)
|
||||
_freecadmin = version;
|
||||
}
|
||||
|
||||
void Metadata::setPythonMin(const Meta::Version &version)
|
||||
{
|
||||
_pythonmin = version;
|
||||
}
|
||||
|
||||
void Metadata::setFreeCADMax(const Meta::Version& version)
|
||||
{
|
||||
_freecadmax = version;
|
||||
@@ -687,8 +696,11 @@ void Metadata::appendToElement(DOMElement* root) const
|
||||
if (_freecadmin != Meta::Version())
|
||||
appendSimpleXMLNode(root, "freecadmin", _freecadmin.str());
|
||||
|
||||
if (_freecadmax != Meta::Version())
|
||||
appendSimpleXMLNode(root, "freecadmax", _freecadmin.str());
|
||||
if (_freecadmax != Meta::Version())
|
||||
appendSimpleXMLNode(root, "freecadmax", _freecadmax.str());
|
||||
|
||||
if (_pythonmin != Meta::Version())
|
||||
appendSimpleXMLNode(root, "pythonmin", _pythonmin.str());
|
||||
|
||||
for (const auto& url : _url) {
|
||||
auto element = appendSimpleXMLNode(root, "url", url.location);
|
||||
@@ -784,6 +796,8 @@ void Metadata::parseVersion1(const DOMNode* startNode)
|
||||
_freecadmin = Meta::Version(StrXUTF8(element->getTextContent()).str);
|
||||
else if (tagString == "freecadmax")
|
||||
_freecadmax = Meta::Version(StrXUTF8(element->getTextContent()).str);
|
||||
else if (tagString == "pythonmin")
|
||||
_pythonmin = Meta::Version(StrXUTF8(element->getTextContent()).str);
|
||||
else if (tagString == "url")
|
||||
_url.emplace_back(element);
|
||||
else if (tagString == "author")
|
||||
|
||||
@@ -220,6 +220,7 @@ namespace App {
|
||||
std::vector<boost::filesystem::path> file() const; //< Arbitrary files associated with this package or content item.
|
||||
Meta::Version freecadmin() const; //< The minimum FreeCAD version.
|
||||
Meta::Version freecadmax() const; //< The maximum FreeCAD version.
|
||||
Meta::Version pythonmin() const; //< The minimum Python version.
|
||||
|
||||
/**
|
||||
* Access the metadata for the content elements of this package
|
||||
@@ -274,7 +275,8 @@ namespace App {
|
||||
void addFile(const boost::filesystem::path &path);
|
||||
void addContentItem(const std::string &tag, const Metadata &item);
|
||||
void setFreeCADMin(const Meta::Version& version);
|
||||
void setFreeCADMax(const Meta::Version& version);
|
||||
void setFreeCADMax(const Meta::Version &version);
|
||||
void setPythonMin(const Meta::Version &version);
|
||||
void addGenericMetadata(const std::string &tag, const Meta::GenericMetadata &genericMetadata);
|
||||
|
||||
// Deleters
|
||||
@@ -337,6 +339,7 @@ namespace App {
|
||||
std::vector<boost::filesystem::path> _file;
|
||||
Meta::Version _freecadmin;
|
||||
Meta::Version _freecadmax;
|
||||
Meta::Version _pythonmin;
|
||||
|
||||
std::multimap<std::string, Metadata> _content;
|
||||
|
||||
|
||||
@@ -184,6 +184,14 @@ If unset it will be 0.0.0.</UserDocu>
|
||||
<Parameter Name="FreeCADMax" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
<Attribute Name="PythonMin">
|
||||
<Documentation>
|
||||
<UserDocu>String representing the minimum version of Python needed for this item.
|
||||
If unset it will be 0.0.0.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="PythonMin" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
<Methode Name="getLastSupportedFreeCADVersion">
|
||||
<Documentation>
|
||||
<UserDocu>getLastSupportedFreeCADVersion() -> str or None\n
|
||||
|
||||
@@ -864,6 +864,21 @@ void MetadataPy::setFreeCADMax(Py::Object args)
|
||||
getMetadataPtr()->setFreeCADMax(App::Meta::Version());
|
||||
}
|
||||
|
||||
Py::Object MetadataPy::getPythonMin() const
|
||||
{
|
||||
return Py::String(getMetadataPtr()->pythonmin().str());
|
||||
}
|
||||
|
||||
void MetadataPy::setPythonMin(Py::Object args)
|
||||
{
|
||||
char *version = nullptr;
|
||||
PyObject *p = args.ptr();
|
||||
if (!PyArg_Parse(p, "z", &version)) throw Py::Exception();
|
||||
if (version) getMetadataPtr()->setPythonMin(App::Meta::Version(version));
|
||||
else
|
||||
getMetadataPtr()->setPythonMin(App::Meta::Version());
|
||||
}
|
||||
|
||||
PyObject *MetadataPy::getFirstSupportedFreeCADVersion(PyObject *p)
|
||||
{
|
||||
if (!PyArg_ParseTuple(p, ""))
|
||||
|
||||
Reference in New Issue
Block a user