mirror of
https://github.com/platformio/platformio-core.git
synced 2026-07-04 23:41:03 +02:00
Improve UnknownPackageError message clarity (#5336)
* Improve UnknownPackageError message clarity * Add IncompatiblePackageError for architecture-specific tool packages
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from platformio import util
|
||||
from platformio.exception import UserSideException
|
||||
|
||||
|
||||
@@ -52,9 +51,13 @@ class MissingPackageManifestError(ManifestException):
|
||||
|
||||
|
||||
class UnknownPackageError(PackageException):
|
||||
MESSAGE = "Could not find the package with '{0}' requirements"
|
||||
|
||||
|
||||
class IncompatiblePackageError(UnknownPackageError):
|
||||
MESSAGE = (
|
||||
"Could not find the package with '{0}' requirements for your system '%s'"
|
||||
% util.get_systype()
|
||||
"Could not find a version of the package with '{0}' requirements "
|
||||
"compatible with the '{1}' system"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import time
|
||||
|
||||
import click
|
||||
|
||||
from platformio.package.exception import UnknownPackageError
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.package.exception import IncompatiblePackageError, UnknownPackageError
|
||||
from platformio.package.meta import PackageSpec, PackageType
|
||||
from platformio.package.version import cast_version_to_semver
|
||||
from platformio.registry.client import RegistryClient
|
||||
from platformio.registry.mirror import RegistryFileMirrorIterator
|
||||
@@ -44,6 +44,10 @@ class PackageManagerRegistryMixin:
|
||||
|
||||
pkgfile = self.pick_compatible_pkg_file(version["files"]) if version else None
|
||||
if not pkgfile:
|
||||
if self.pkg_type == PackageType.TOOL:
|
||||
from platformio import util
|
||||
|
||||
raise IncompatiblePackageError(spec.humanize(), util.get_systype())
|
||||
raise UnknownPackageError(spec.humanize())
|
||||
|
||||
for url, checksum in RegistryFileMirrorIterator(pkgfile["download_url"]):
|
||||
|
||||
Reference in New Issue
Block a user