Addon Manager: Cleanup
This commit is contained in:
@@ -655,7 +655,9 @@ void Metadata::appendToElement(DOMElement* root) const
|
||||
{
|
||||
appendSimpleXMLNode(root, "name", _name);
|
||||
appendSimpleXMLNode(root, "description", _description);
|
||||
appendSimpleXMLNode(root, "version", _version.str());
|
||||
if (_version != Meta::Version())
|
||||
// Only append version if it's not 0.0.0
|
||||
appendSimpleXMLNode(root, "version", _version.str());
|
||||
|
||||
for (const auto& maintainer : _maintainer) {
|
||||
auto element = appendSimpleXMLNode(root, "maintainer", maintainer.name);
|
||||
@@ -977,6 +979,8 @@ Meta::Version::Version(const std::string& versionString) :
|
||||
|
||||
std::string Meta::Version::str() const
|
||||
{
|
||||
if (*this == Meta::Version())
|
||||
return "";
|
||||
std::ostringstream stream;
|
||||
stream << major << "." << minor << "." << patch << suffix;
|
||||
return stream.str();
|
||||
|
||||
@@ -365,6 +365,13 @@ Add a new File. </UserDocu>
|
||||
Remove the File. </UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<Methode Name="write">
|
||||
<Documentation>
|
||||
<UserDocu>write(filename)\n
|
||||
Write the metadata to the given file as XML data.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<ClassDeclarations>
|
||||
public:
|
||||
|
||||
@@ -139,7 +139,7 @@ void MetadataPy::setVersion(Py::Object args)
|
||||
const char *name = nullptr;
|
||||
if (!PyArg_Parse(args.ptr(), "z", &name))
|
||||
throw Py::Exception();
|
||||
if (name)
|
||||
if (name && name[0] != '\0')
|
||||
getMetadataPtr()->setVersion(App::Meta::Version(std::string(name)));
|
||||
else
|
||||
getMetadataPtr()->setVersion(App::Meta::Version());
|
||||
@@ -934,6 +934,18 @@ PyObject *MetadataPy::removeContentItem(PyObject *arg)
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject* MetadataPy::write(PyObject* args)
|
||||
{
|
||||
char *filename = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "s", &filename))
|
||||
return nullptr;
|
||||
getMetadataPtr()->write(filename);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
PyObject *MetadataPy::getCustomAttributes(const char * /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user