@@ -385,7 +385,7 @@ def __init__(self, given_package_spec: str, authoritative=False, settings=None):
385385 self .auto_upgrade_spec = given_package_spec
386386 runez .log .trace (f"Authoritative auto-upgrade spec '{ self .auto_upgrade_spec } '" )
387387
388- else :
388+ elif self . _canonical_name :
389389 # Non-authoritative specs are necessarily canonical names (since only authoritative specs can refer to git urls, etc.)
390390 manifest = self .manifest
391391 if manifest and manifest .settings and manifest .settings .auto_upgrade_spec :
@@ -398,6 +398,10 @@ def __init__(self, given_package_spec: str, authoritative=False, settings=None):
398398 runez .log .trace (f"Assuming auto-upgrade spec '{ self ._canonical_name } '" )
399399 self .auto_upgrade_spec = self ._canonical_name
400400
401+ else :
402+ # Should not be reachable, unless we are given a non-authoritative spec that is not a canonical name
403+ self .auto_upgrade_spec = given_package_spec
404+
401405 cache_file_name = self .auto_upgrade_spec
402406 if PypiStd .std_package_name (cache_file_name ) != cache_file_name :
403407 # If package spec is not a canonical name, use md5 hash of it as filename
@@ -501,7 +505,7 @@ def target_installation_folder(self):
501505 def upgrade_reason (self ):
502506 """Reason this package spec needs an upgrade (if any)"""
503507 if self .currently_installed_version != self .target_version :
504- return "new version available"
508+ return f "new version available, current version is { self . currently_installed_version } "
505509
506510 manifest = self .manifest
507511 if not manifest :
0 commit comments