from .xlate import XLATOR
-__version__ = '0.5.4'
+__version__ = '0.5.5'
LOG = logging.getLogger(__name__)
raise MetadataInitError(msg)
metadata = cls(appname=appname, verbose=verbose, base_dir=base_dir)
+ metadata._apply_json_data(json_data)
- metadata.name = json_data['name']
- metadata.version = json_data['version']
+ return metadata
+
+ # -------------------------------------------------------------------------
+ def _apply_json_data(self, json_data):
+
+ self.name = json_data['name']
+ self.version = json_data['version']
if 'author' in json_data:
- metadata.author = json_data['author']
+ self.author = json_data['author']
else:
- metadata.author = metadata.author
- metadata.license = json_data['license']
- metadata.summary = json_data['summary']
- metadata.source = json_data['source']
+ self.author = self.author
+ self.license = json_data['license']
+ self.summary = json_data['summary']
+ self.source = json_data['source']
for item in json_data['dependencies']:
dep = ModuleDependency.from_data(item)
- metadata.dependencies.append(dep)
+ self.dependencies.append(dep)
if 'requirements' in json_data:
for item in json_data['requirements']:
req = ModuleDependency.from_data(item)
- metadata.requirements.append(req)
+ self.requirements.append(req)
if 'project_page' in json_data:
- metadata.project_page = json_data['project_page']
+ self.project_page = json_data['project_page']
if 'issues_url' in json_data:
- metadata.issues_url = json_data['issues_url']
+ self.issues_url = json_data['issues_url']
if 'operatingsystem_support' in json_data:
for item in json_data['operatingsystem_support']:
supp = ModuleOsSupport.from_data(item)
- metadata.operatingsystem_support.append(supp)
+ self.operatingsystem_support.append(supp)
if 'tags' in json_data:
for tag in json_data['tags']:
tg = str(tag).strip()
if tg:
- metadata.tags.append(tg)
+ self.tags.append(tg)
- metadata.initialized = True
- if verbose > 3:
- LOG.debug("ModuleMetadata:\n{}".format(pp(metadata.as_dict())))
-
- return metadata
+ self.initialized = True
+ if self.verbose > 3:
+ LOG.debug("ModuleMetadata:\n{}".format(pp(self.as_dict())))
# -------------------------------------------------------------------------
def __copy__(self):