Skip to content

Commit

Permalink
Merge branch 'feature/print_suggestion_manifest_errors' into 'main'
Browse files Browse the repository at this point in the history
Print suggestion to update the component manager on manifest errors

Closes PACMAN-363

See merge request espressif/idf-component-manager!130
  • Loading branch information
kumekay committed May 31, 2022
2 parents 0d5022b + d4f1d88 commit bbedb15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Print suggestion to update the component manager on manifest errors

### Fixed

- Fix expansion of environment variables in manifest for `rules`
Expand Down
17 changes: 13 additions & 4 deletions idf_component_tools/manifest/manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
from io import open

import yaml
Expand All @@ -16,6 +17,12 @@

EMPTY_MANIFEST = dict() # type: Dict[str, Any]

UPDATE_SUGGESTION = """
SUGGESTION: This component may be using a newer version of the component manager.
You can try to update the component manager by running:
{} -m pip install --upgrade idf-component-manager
""".format(sys.executable)


class ManifestManager(object):
"""Parser for manifest files in the project"""
Expand Down Expand Up @@ -108,11 +115,13 @@ def load(self): # type: () -> Manifest
if not self.is_valid:
error_count = len(self.validation_errors)
if error_count == 1:
error_desc = ['A problem was found in the manifest file %s:' % self._path] + self.validation_errors
error_desc = ['A problem was found in the manifest file %s:' % self._path]
else:
error_desc = [
'%i problems were found in the manifest file %s:' % (error_count, self._path)
] + self.validation_errors
error_desc = ['%i problems were found in the manifest file %s:' % (error_count, self._path)]

error_desc.extend(self.validation_errors)

error_desc.append(UPDATE_SUGGESTION)

raise ManifestError('\n'.join(error_desc))

Expand Down

0 comments on commit bbedb15

Please sign in to comment.