@@ -29,7 +29,7 @@ from shlex import quote
2929import xml .etree .ElementTree as ET
3030
3131# Constants
32- ZYPPERONI_VERSION = "1.0.0 "
32+ ZYPPERONI_VERSION = "1.0.1 "
3333ZYPPER_PID_FILE = "/run/zypp.pid"
3434
3535################################
@@ -444,7 +444,7 @@ if args.command_name in ["refresh", "ref"]:
444444 get_zypp_lock ()
445445 docroot = ET .fromstring (xml_output )
446446 for item in docroot .iter ("repo" ):
447- if item .attrib [ "enabled" ] == "1" :
447+ if item .attrib . get ( "enabled" ) == "1" :
448448 REPO_ALIAS .append (item .attrib ["alias" ])
449449 logging .debug (f"Enabled repos: { REPO_ALIAS } " )
450450 if not REPO_ALIAS :
@@ -483,7 +483,7 @@ elif args.command_name in ["dist-upgrade", "dup"]:
483483 # parse all packages from xml output
484484 DUP_PKG = []
485485 for item in docroot .iter ("solvable" ):
486- if item .attrib [ "type" ] == "package" :
486+ if item .attrib . get ( "type" ) == "package" :
487487 DUP_PKG .append (f"{ item .attrib ['name' ]} -{ item .attrib ['edition' ]} .{ item .attrib ['arch' ]} " )
488488 # parse all packages to be removed
489489 RM_PKG = []
@@ -504,7 +504,7 @@ elif args.command_name in ["dist-upgrade", "dup"]:
504504 # parse all packages from xml output
505505 DUP_PKG = []
506506 for item in docroot .iter ("update" ):
507- if item .attrib [ "kind" ] == "package" :
507+ if item .attrib . get ( "kind" ) == "package" :
508508 DUP_PKG .append (f"{ item .attrib ['name' ]} -{ item .attrib ['edition' ]} .{ item .attrib ['arch' ]} " )
509509 DUP_PKG .sort ()
510510 if not DUP_PKG :
@@ -554,7 +554,8 @@ elif args.command_name in ["install", "in"]:
554554 num_pkgs = int (item .attrib ["packages-to-change" ])
555555 logging .info (color ("info" , f"Number of packages to download: { num_pkgs } " ))
556556 logging .info (color ("info" , f"Total download size: { download_size_bytes / 1000 ** 2 :.2f} MB" ))
557- logging .info (color ("info" , f"Space usage difference after operation: { diff_bytes / 1000 ** 2 :+.2f} MB" ))
557+ if not args .download_only :
558+ logging .info (color ("info" , f"Space usage difference after operation: { diff_bytes / 1000 ** 2 :+.2f} MB" ))
558559 NO_ERR = True
559560 if not num_pkgs :
560561 msg = "There are package conflicts that must be manually resolved. See output of:\n " \
@@ -572,7 +573,7 @@ elif args.command_name in ["install", "in"]:
572573 # parse all packages from xml output
573574 IN_PKG = []
574575 for item in docroot .iter ("solvable" ):
575- if item .attrib [ "type" ] == "package" :
576+ if item .attrib . get ( "type" ) == "package" :
576577 IN_PKG .append (item .attrib ["name" ])
577578 # parse all packages to be removed
578579 RM_PKG = []
@@ -628,7 +629,8 @@ elif args.command_name in ["install-new-recommends", "inr"]:
628629 num_pkgs = int (item .attrib ["packages-to-change" ])
629630 logging .info (color ("info" , f"Number of packages to download: { num_pkgs } " ))
630631 logging .info (color ("info" , f"Total download size: { download_size_bytes / 1000 ** 2 :.2f} MB" ))
631- logging .info (color ("info" , f"Space usage difference after operation: { diff_bytes / 1000 ** 2 :+.2f} MB" ))
632+ if not args .download_only :
633+ logging .info (color ("info" , f"Space usage difference after operation: { diff_bytes / 1000 ** 2 :+.2f} MB" ))
632634 if not num_pkgs :
633635 msg = "There are package conflicts that must be manually resolved. See output of:\n " \
634636 "zypper --non-interactive --no-cd dist-upgrade --dry-run"
@@ -638,7 +640,7 @@ elif args.command_name in ["install-new-recommends", "inr"]:
638640 # parse all packages from xml output
639641 INR_PKG = []
640642 for item in docroot .iter ("solvable" ):
641- if item .attrib [ "type" ] == "package" :
643+ if item .attrib . get ( "type" ) == "package" :
642644 INR_PKG .append (item .attrib ["name" ])
643645 # parse all packages to be removed
644646 RM_PKG = []
0 commit comments