diff --git a/README.sync b/README.sync index eeec28292..79981d548 100644 --- a/README.sync +++ b/README.sync @@ -4,13 +4,12 @@ The pkg5 components have been updated to the latest upstream solaris-ips as of: - commit c1fc9182ee12aa1369a5f6a23d147594a3e2656f - Author: Jakub Kulik - AuthorDate: Wed Aug 6 08:41:48 2025 -0700 - Commit: Jakub Kulik - CommitDate: Wed Aug 6 08:41:48 2025 -0700 + commit 4a9340355072e296bf37c27f1c8aa90e7c1e57d3 + Author: Jakub Kulik + Date: Tue Mar 10 04:41:17 2026 -0700 - 38108626 "PKG_CLIENT_MAX_TIMEOUT=0" doesn't work as documented + PSARC/2026/020 EOF Python ply and create its private copy in the IPS gate + 38920215 introduce a private copy of ply ----------------------------------------------------------------------------- diff --git a/src/brand/bhyve/bootlib.py b/src/brand/bhyve/bootlib.py index 8c920a467..d12d2cd39 100644 --- a/src/brand/bhyve/bootlib.py +++ b/src/brand/bhyve/bootlib.py @@ -364,7 +364,7 @@ def parse_ram(v): m = re.search(rf"^(\d+)(.?)$", v) if not m: fatal(f'Could not parse ram value "{v}"') - (mem, suffix) = m.groups() + mem, suffix = m.groups() mem = int(mem) if not suffix: diff --git a/src/brand/emu/boot.py b/src/brand/emu/boot.py index 016009ed0..56ff83c5b 100755 --- a/src/brand/emu/boot.py +++ b/src/brand/emu/boot.py @@ -94,15 +94,13 @@ def usage(msg=None): - print( - """ + print(""" boot [-t] [-x xml] <[-z] zone> -t Test mode - just show what would be done -j Output the computed zone data in JSON format -x Path to zone's XML file -z Name of zone -""" - ) +""") if msg: print(msg) diff --git a/src/cffi_src/build_arch.py b/src/cffi_src/build_arch.py index b3a13db28..096459b95 100755 --- a/src/cffi_src/build_arch.py +++ b/src/cffi_src/build_arch.py @@ -38,8 +38,7 @@ extra_compile_args=["-O3"], ) -ffi.cdef( - """ +ffi.cdef(""" /* Macros */ #define SI_RELEASE 3 /* return release of operating system */ #define SI_ARCHITECTURE_32 516 /* basic 32-bit SI_ARCHITECTURE */ @@ -51,8 +50,7 @@ void *realloc(void *, size_t); void free(void *); int sysinfo(int, char *, long); -""" -) +""") if __name__ == "__main__": ffi.compile(verbose=False) diff --git a/src/cffi_src/build_sha512_t.py b/src/cffi_src/build_sha512_t.py index 409d1c05e..5b68e8033 100755 --- a/src/cffi_src/build_sha512_t.py +++ b/src/cffi_src/build_sha512_t.py @@ -40,8 +40,7 @@ libraries=["md"], ) -ffi.cdef( - """ +ffi.cdef(""" #define SHA512_224 9 #define SHA512_256 10 @@ -68,8 +67,7 @@ void SHA2Update(SHA2_CTX *ctx, const void *buf, size_t bufsz); void SHA2Final(void *digest, SHA2_CTX *ctx); void *memcpy(void *restrict s1, const void *restrict s2, size_t n); -""" -) +""") if __name__ == "__main__": ffi.compile(verbose=False) diff --git a/src/cffi_src/build_sysattr.py b/src/cffi_src/build_sysattr.py index f7b27304d..7d770f052 100755 --- a/src/cffi_src/build_sysattr.py +++ b/src/cffi_src/build_sysattr.py @@ -42,8 +42,7 @@ libraries=["nvpair"], ) -ffi.cdef( - """ +ffi.cdef(""" /* Macros */ #define NV_UNIQUE_NAME 0x1 @@ -148,8 +147,7 @@ char *nvpair_name(nvpair_t *); data_type_t nvpair_type(nvpair_t *); int nvpair_value_boolean_value(nvpair_t *, boolean_t *); -""" -) +""") if __name__ == "__main__": ffi.compile(verbose=False) diff --git a/src/cffi_src/build_syscallat.py b/src/cffi_src/build_syscallat.py index fe6ef113f..76aee4699 100755 --- a/src/cffi_src/build_syscallat.py +++ b/src/cffi_src/build_syscallat.py @@ -40,8 +40,7 @@ extra_compile_args=["-O3"], ) -ffi.cdef( - """ +ffi.cdef(""" /* Types */ typedef int... mode_t; /* file attribute type */ @@ -50,8 +49,7 @@ int openat(int, const char *, int, mode_t); int renameat(int, const char *, int, const char *); int unlinkat(int, const char *, int); -""" -) +""") if __name__ == "__main__": ffi.compile(verbose=False) diff --git a/src/client.py b/src/client.py index ea25b8bfc..039ebeb2e 100755 --- a/src/client.py +++ b/src/client.py @@ -103,15 +103,13 @@ def altbe(): import sys if sys.platform == "sunos5": - print( - """ + print(""" The Python environment on this system is damaged and missing a critical core component (pkg.site_paths) and can not be repaired with pkg(1). To recover this system reboot and select an alternate Boot Environment (BE) from the boot menu. From the alternate BE mount and run 'pkg fix' on this BE. -""" - ) +""") sys.exit(1) pkg.site_paths.init() @@ -650,23 +648,17 @@ def print_cmds(cmd_list, cmd_dic): if verbose: # Display a verbose usage message of subcommands. - logger.error( - _( - """\ + logger.error(_("""\ Usage: pkg [options] command [cmd_options] [operands] -""" - ) - ) +""")) logger.error(_("Basic subcommands:")) print_cmds(basic_cmds, basic_usage) logger.error(_("\nAdvanced subcommands:")) print_cmds(advanced_cmds, adv_usage) - logger.error( - _( - """ + logger.error(_(""" Options: -R dir --no-network-cache @@ -674,21 +666,13 @@ def print_cmds(cmd_list, cmd_dic): Environment: PKG_IMAGE - PKG_SUCCESS_ON_NOP""" - ) - ) + PKG_SUCCESS_ON_NOP""")) else: # Display the full list of subcommands. - logger.error( - _( - """\ -Usage: pkg [options] command [cmd_options] [operands]""" - ) - ) + logger.error(_("""\ +Usage: pkg [options] command [cmd_options] [operands]""")) logger.error(_("The following commands are supported:")) - logger.error( - _( - """ + logger.error(_(""" Package Information : list search info contents Package Transitions : update install uninstall history exact-install apply-hot-fix @@ -703,9 +687,7 @@ def print_cmds(cmd_list, cmd_dic): property set-property add-property-value unset-property remove-property-value Miscellaneous : image-create dehydrate rehydrate clean -For more info, run: pkg help """ - ) - ) +For more info, run: pkg help """)) sys.exit(retcode) @@ -1047,31 +1029,23 @@ def __display_plan(api_inst, verbose, noexecute, op=None): if api_inst.is_liveroot and not api_inst.is_active_liveroot_be: # Warn the user since this isn't likely what they wanted. if plan.new_be: - logger.warning( - _( - """\ + logger.warning(_("""\ ****************************************************************************** WARNING: The boot environment being modified is not the active one. Changes made in the active BE will not be reflected on the next boot. ****************************************************************************** -""" - ) - ) +""")) else: - logger.warning( - _( - """\ + logger.warning(_("""\ ****************************************************************************** WARNING: The boot environment being modified is not the active one. Changes made will not be reflected on the next boot. ****************************************************************************** -""" - ) - ) +""")) # a = change(!!!) (due to fix or mediator/variant/facet) # c = update @@ -2159,12 +2133,12 @@ def __api_plan_exception(op, noexecute, verbose, api_inst): return e.lix_exitrv if e_type == api_errors.IpkgOutOfDateException: msg( - _( - """\ + _("""\ WARNING: pkg(7) appears to be out of date, and should be updated before running {op}. Please update pkg(7) by executing 'pkg install -pkg:/package/pkg' as a privileged user and then retry the {op}.""" - ).format(**locals()) +pkg:/package/pkg' as a privileged user and then retry the {op}.""").format( + **locals() + ) ) return EXIT_OOPS if e_type == api_errors.NonLeafPackageException: @@ -2954,16 +2928,12 @@ def _emit_error_general_cb( if selected_type and err["errtype"] not in selected_type: return False - emsg( - _( - """ + emsg(_(""" To add a publisher using this repository, execute the following command as a privileged user: pkg set-publisher -g {0} -""" - ).format(add_info["repo_uri"]) - ) +""").format(add_info["repo_uri"])) elif "info" in err: msg(err["info"]) elif "reason" in err: @@ -5018,15 +4988,9 @@ def list_contents(api_inst, args): if invalid_atype == action_types: usage(_("no valid action types specified"), cmd=subcommand) elif invalid_atype: - emsg( - _( - """\ + emsg(_("""\ WARNING: invalid action types specified: {0} -""".format( - ",".join(invalid_atype) - ) - ) - ) +""".format(",".join(invalid_atype)))) check_attrs(attrs, subcommand) @@ -5158,12 +5122,8 @@ def list_contents(api_inst, args): rval = EXIT_OK if attr_match and manifests and not found: rval = EXIT_OOPS - logger.error( - _( - """\ -pkg: contents: no matching actions found in the listed packages""" - ) - ) + logger.error(_("""\ +pkg: contents: no matching actions found in the listed packages""")) if manifests and rval == EXIT_OK: displayed_results = display_contents_results( @@ -5219,22 +5179,14 @@ def list_contents(api_inst, args): if manifests: logger.error("") if local: - logger.error( - _( - """\ + logger.error(_("""\ pkg: contents: no packages matching the following patterns you specified are -installed on the system. Try specifying -r to query remotely:""" - ) - ) +installed on the system. Try specifying -r to query remotely:""")) elif remote: - logger.error( - _( - """\ + logger.error(_("""\ pkg: contents: no packages matching the following patterns you specified were found in the catalog. Try relaxing the patterns, refreshing, and/or -examining the catalogs:""" - ) - ) +examining the catalogs:""")) logger.error("") for p in notfound: logger.error(" {0}".format(p)) @@ -6574,7 +6526,7 @@ def attach_linked( api_inst.progresstracker.set_major_phase( api_inst.progresstracker.PHASE_UTILITY ) - (rv, err, p_dict) = api_inst.attach_linked_child( + rv, err, p_dict = api_inst.attach_linked_child( lin, li_path, li_props, @@ -7964,13 +7916,9 @@ def handle_errors(func, non_wrap_print=True, *args, **kwargs): except api_errors.InvalidCatalogFile as __e: if _api_inst: _api_inst.abort(result=RESULT_FAILED_STORAGE) - logger.error( - _( - """ + logger.error(_(""" An error was encountered while attempting to read image state information -to perform the requested operation. Details follow:\n\n{0}""" - ).format(__e) - ) +to perform the requested operation. Details follow:\n\n{0}""").format(__e)) __ret = EXIT_OOPS except api_errors.InvalidDepotResponseException as __e: if _api_inst: diff --git a/src/depot-config.py b/src/depot-config.py index 0dbd0fd4c..75cbabe4f 100755 --- a/src/depot-config.py +++ b/src/depot-config.py @@ -96,16 +96,12 @@ file 1 manifest 0 status 0 -""".format( - pkg.VERSION -) +""".format(pkg.VERSION) # versions response used when we provide search capability DEPOT_VERSIONS_STR = """{0}admin 0 search 0 1 -""".format( - DEPOT_FRAGMENT_VERSIONS_STR -) +""".format(DEPOT_FRAGMENT_VERSIONS_STR) DEPOT_USER = "pkg5srv" DEPOT_GROUP = "pkg5srv" @@ -145,9 +141,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - msg( - _( - """\ + msg(_("""\ Usage: pkg.depot-config ( -d repository_dir | -S ) -r runtime_dir [-c cache_dir] [-s cache_size] [-p port] [-h hostname] @@ -158,9 +152,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): --cert-key-dir cert_key_directory ) [ (--ca-cert ca_cert_file --ca-key ca_key_file ) ] [--smf-fmri smf_pkg_depot_fmri] ] ) -""" - ) - ) +""")) sys.exit(retcode) diff --git a/src/depot.py b/src/depot.py index bbf0a68fb..5befd4518 100755 --- a/src/depot.py +++ b/src/depot.py @@ -144,8 +144,7 @@ def usage(text=None, retcode=EXIT_BADOPT, full=False): emsg(_("Try `pkg.depotd --help or -?' for more " "information.")) sys.exit(retcode) - print( - """\ + print("""\ Usage: /usr/lib/pkg.depotd [-a address] [-d inst_root] [-p port] [-s threads] [-t socket_timeout] [--cfg] [--content-root] [--disable-ops op[/1][,...]] [--debug feature_list] @@ -240,8 +239,7 @@ def usage(text=None, retcode=EXIT_BADOPT, full=False): Environment: PKG_REPO Used as default inst_root if -d not provided. PKG_DEPOT_CONTENT Used as default content_root if --content-root - not provided.""" - ) + not provided.""") sys.exit(retcode) diff --git a/src/modules/actions/driver.py b/src/modules/actions/driver.py index 2250b510e..0eea76a30 100644 --- a/src/modules/actions/driver.py +++ b/src/modules/actions/driver.py @@ -259,22 +259,17 @@ def install(self, pkgplan, orig): "imgroot": image.get_root(), } if name in driver_actions: - raise RuntimeError( - "\ + raise RuntimeError("\ The '{new}' driver shares the alias '{alias}' with the '{old}'\n\ driver; both drivers cannot be installed simultaneously. Please remove\n\ the package delivering '{old}' or ensure that the package delivering\n\ -'{new}' will not be installed, and try the operation again.".format( - **errdict - ) - ) +'{new}' will not be installed, and try the operation again.".format(**errdict)) else: comment = "# pkg(7): " lines[line] = comment + lines[line] # XXX Module printing if be_name: - print( - "\ + print("\ The '{new}' driver shares the alias '{alias}' with the '{old}'\n\ driver, but the system cannot determine how the latter was delivered.\n\ Its entry on line {line:d} in /etc/driver_aliases has been commented\n\ @@ -283,22 +278,15 @@ def install(self, pkgplan, orig): as well as removing line {line:d} from /etc/driver_aliases or, before\n\ rebooting, mounting the '{be}' boot environment and running\n\ 'rem_drv -b {old}' and removing line {line:d} from\n\ -/etc/driver_aliases.".format( - **errdict - ) - ) +/etc/driver_aliases.".format(**errdict)) else: - print( - "\ + print("\ The '{new}' driver shares the alias '{alias}' with the '{old}'\n\ driver, but the system cannot determine how the latter was delivered.\n\ Its entry on line {line:d} in /etc/driver_aliases has been commented\n\ out. If this driver is no longer needed, it may be removed by invoking\n\ 'rem_drv -b {imgroot} {old}' as well as removing line {line:d}\n\ -from {imgroot}/etc/driver_aliases.".format( - **errdict - ) - ) +from {imgroot}/etc/driver_aliases.".format(**errdict)) dap = image.get_root() + "/etc/driver_aliases" datd, datp = mkstemp( diff --git a/src/modules/altroot.py b/src/modules/altroot.py index 4152adfdb..2d221987b 100644 --- a/src/modules/altroot.py +++ b/src/modules/altroot.py @@ -53,7 +53,7 @@ def __path_abs_to_relative(path): path_new = None while True: - (path, tail) = os.path.split(path) + path, tail = os.path.split(path) if not tail: break if path_new: diff --git a/src/modules/api_common.py b/src/modules/api_common.py index 512141b55..cfe9fb15a 100644 --- a/src/modules/api_common.py +++ b/src/modules/api_common.py @@ -30,7 +30,6 @@ """Contains API functions and classes common to both pkg.client.api and pkg.server.api.""" - import pkg.client.pkgdefs as pkgdefs import pkg.fmri as fmri import pkg.misc as misc diff --git a/src/modules/client/api.py b/src/modules/client/api.py index 89219b75d..121b9c716 100644 --- a/src/modules/client/api.py +++ b/src/modules/client/api.py @@ -375,14 +375,12 @@ def __init__( and "PKG_NO_RUNPY_CMDPATH" in os.environ and self.cmdpath.endswith(os.sep + "run.py") ): - raise RuntimeError( - """ + raise RuntimeError(""" An ImageInterface object was allocated from within ipkg test suite and cmdpath was not explicitly overridden. Please make sure to set explicitly set cmdpath when allocating an ImageInterface object, or override cmdpath when allocating an Image object by setting PKG_CMDPATH -in the environment or by setting simulate_cmdpath in DebugValues.""" - ) +in the environment or by setting simulate_cmdpath in DebugValues.""") if isinstance(img_path, str): # Store this for reset(). diff --git a/src/modules/client/api_errors.py b/src/modules/client/api_errors.py index 971ccc7d7..d4e1a2c2e 100644 --- a/src/modules/client/api_errors.py +++ b/src/modules/client/api_errors.py @@ -55,10 +55,8 @@ def verbose_info(self): class SuidUnsupportedError(ApiException): def __str__(self): - return _( - """ -The pkg client api module can not be invoked from an setuid executable.""" - ) + return _(""" +The pkg client api module can not be invoked from an setuid executable.""") class HistoryException(ApiException): @@ -277,17 +275,13 @@ def __init__(self, paths): def __str__(self): return "{0}\n\n {1}\n\n{2}".format( - _( - """\ + _("""\ The files listed below match exclusions which are configured -on this image and can therefore not be installed:""" - ), +on this image and can therefore not be installed:"""), "\n ".join(list(self.paths)), - _( - """\ + _("""\ See the 'exclude-patterns' and 'exclude-policy' image properties in pkg(1) for -more information.""" - ), +more information."""), ) @@ -468,12 +462,10 @@ def __str__(self): "command again as a privileged user." ).format(self.path) else: - return _( - """ + return _(""" Could not complete the operation because of insufficient permissions. Please try the command again as a privileged user. -""" - ) +""") class FileInUseException(PermissionsException): @@ -658,31 +650,25 @@ def __init__( def __str__(self): res = [] if self.unmatched_fmris: - s = _( - """\ + s = _("""\ The following pattern(s) did not match any allowable packages. Try using a different matching pattern, or refreshing publisher information: -""" - ) +""") res += [s] res += ["\t{0}".format(p) for p in self.unmatched_fmris] if self.rejected_pats: - s = _( - """\ + s = _("""\ The following pattern(s) only matched packages rejected by user request. Try using a different matching pattern, or refreshing publisher information: -""" - ) +""") res += [s] res += ["\t{0}".format(p) for p in self.rejected_pats] if self.wrong_variants: - s = _( - """\ + s = _("""\ The following pattern(s) only matched packages that are not available -for the current image's architecture, zone type, and/or other variant:""" - ) +for the current image's architecture, zone type, and/or other variant:""") res += [s] res += ["\t{0}".format(p) for p in self.wrong_variants] @@ -756,11 +742,9 @@ def __str__(self): res.extend(self.no_solution) if self.pkg_updates_required: - s = _( - """\ + s = _("""\ Syncing this linked image would require the following package updates: -""" - ) +""") res += [s] for oldfmri, newfmri in self.pkg_updates_required: res += [ @@ -773,14 +757,12 @@ def __str__(self): res += self.no_version if self.no_tmp_origins: - s = _( - """ + s = _(""" The proposed operation on this parent image can not be performed because temporary origins were specified and this image has children. Please either retry the operation again without specifying any temporary origins, or if packages from additional origins are required, please configure those origins -persistently.""" - ) +persistently.""") res = [s] if self.missing_dependency: @@ -842,27 +824,19 @@ def __format_li_pubs(pubs, res): if self.linked_pub_error: res = [] - (pubs, parent_pubs) = self.linked_pub_error + pubs, parent_pubs = self.linked_pub_error - res.append( - _( - """ + res.append(_(""" Invalid child image publisher configuration. Child image publisher configuration must be a superset of the parent image publisher configuration. Please update the child publisher configuration to match the parent. If the child image is a zone this can be done automatically by detaching and attaching the zone. -The parent image has the following enabled publishers:""" - ) - ) +The parent image has the following enabled publishers:""")) __format_li_pubs(parent_pubs, res) - res.append( - _( - """ -The child image has the following enabled publishers:""" - ) - ) + res.append(_(""" +The child image has the following enabled publishers:""")) __format_li_pubs(pubs, res) if self.no_repo_pubs: @@ -1977,11 +1951,9 @@ def __init__(self, be_name): self.be_name = be_name def __str__(self): - return _( - """\ + return _("""\ Boot environment naming during package install is not supported on this -version of OpenSolaris. Please update without the --be-name option.""" - ) +version of OpenSolaris. Please update without the --be-name option.""") class UnableToCopyBE(BEException): @@ -1997,11 +1969,9 @@ def __init__(self, orig, dest): def __str__(self): d = {"orig": self.original_name, "dest": self.destination_name} - return _( - """\ + return _("""\ A problem occurred while attempting to rename the boot environment -currently named {orig} to {dest}.""" - ).format(**d) +currently named {orig} to {dest}.""").format(**d) class UnableToMountBE(BEException): @@ -2022,11 +1992,9 @@ def __init__(self, be_name): self.name = be_name def __str__(self): - return _( - """\ + return _("""\ Naming a boot environment when operating on a non-live image is -not allowed.""" - ) +not allowed.""") class UnrecognizedOptionsToInfo(ApiException): @@ -2259,14 +2227,12 @@ def __init__(self, prefix): self.publisher = prefix def __str__(self): - return _( - """ + return _(""" The requested operation requires that one or more package repositories are configured for publisher '{0}'. Use 'pkg set-publisher' to add new package repositories or restore previously -configured package repositories for publisher '{0}'.""" - ).format(self.publisher) +configured package repositories for publisher '{0}'.""").format(self.publisher) class MoveRelativeToSelf(PublisherError): @@ -2523,15 +2489,13 @@ class UnknownSysrepoConfiguration(ApiException): repository but can't find the configuration for it.""" def __str__(self): - return _( - """\ + return _("""\ pkg is configured to use the system repository (via the use-system-repo property) but it could not get the host and port from svc:/application/pkg/zones-proxy-client nor svc:/application/pkg/system-repository, and the PKG_SYSREPO_URL environment variable was not set. Please try enabling one of those services or setting the PKG_SYSREPO_URL environment variable. -""" - ) +""") class ModifyingSyspubException(ApiException): @@ -3516,7 +3480,7 @@ def __init__( err = _("Unknown child linked image: {0}").format(child_unknown) if cmd_failed is not None: - (rv, cmd, errout) = cmd_failed + rv, cmd, errout = cmd_failed err = _( "The following subprocess returned an " "unexpected exit code of {rv:d}:\n {cmd}" @@ -3528,7 +3492,7 @@ def __init__( ) if cmd_output_invalid is not None: - (cmd, output) = cmd_output_invalid + cmd, output = cmd_output_invalid err = _( "The following subprocess:\n" " {cmd}\n" @@ -3614,26 +3578,23 @@ def __init__( if pkg_op_failed is not None: assert lin - (op, exitrv, errout, e) = pkg_op_failed + op, exitrv, errout, e = pkg_op_failed assert op is not None if e is None: - err = _( - """ + err = _(""" A '{op}' operation failed for child '{lin}' with an unexpected return value of {exitrv:d} and generated the following output: {errout} -""" - ).format( +""").format( lin=lin, op=op, exitrv=exitrv, errout=force_str(errout), ) else: - err = _( - """ + err = _(""" A '{op}' operation failed for child '{lin}' with an unexpected exception: {e} @@ -3641,8 +3602,7 @@ def __init__( The child generated the following output: {errout} -""" - ).format( +""").format( lin=lin, op=op, errout=force_str(errout), @@ -3662,9 +3622,8 @@ def __init__( ) if unparsable_output is not None: - (op, errout, e) = unparsable_output - err = _( - """ + op, errout, e = unparsable_output + err = _(""" A '{op}' operation for child '{lin}' generated non-json output. The json parser failed with the following error: {e} @@ -3672,8 +3631,7 @@ def __init__( The child generated the following output: {errout} -""" - ).format( +""").format( lin=lin, op=op, e=e, @@ -3726,12 +3684,10 @@ def __init__( def __str__(self): res = [] if self.multiversions: - s = _( - """\ + s = _("""\ The following packages were frozen at two different versions by the patterns provided. The package stem and the versions it was frozen at are -provided:""" - ) +provided:""") res += [s] res += [ "\t{0}\t{1}".format( @@ -3741,22 +3697,18 @@ def __str__(self): ] if self.unmatched_wildcards: - s = _( - """\ + s = _("""\ The following patterns contained wildcards but matched no -installed packages.""" - ) +installed packages.""") res += [s] res += [ "\t{0}".format(pat) for pat in sorted(self.unmatched_wildcards) ] if self.version_mismatch: - s = _( - """\ + s = _("""\ The following patterns attempted to freeze the listed packages -at a version different from the version at which the packages are installed.""" - ) +at a version different from the version at which the packages are installed.""") res += [s] for pat in sorted(self.version_mismatch): res += ["\t{0}".format(pat)] @@ -3767,12 +3719,10 @@ def __str__(self): ] if self.versionless_uninstalled: - s = _( - """\ + s = _("""\ The following patterns don't match installed packages and contain no version information. Uninstalled packages can only be frozen by -providing a version at which to freeze them.""" - ) +providing a version at which to freeze them.""") res += [s] res += [ "\t{0}".format(p) for p in sorted(self.versionless_uninstalled) diff --git a/src/modules/client/bootenv.py b/src/modules/client/bootenv.py index 0542bd9af..16a33d92e 100644 --- a/src/modules/client/bootenv.py +++ b/src/modules/client/bootenv.py @@ -565,31 +565,23 @@ def activate_live_be(): os.rmdir(self.clone_dir) if set_active: - logger.info( - _( - """ + logger.info(_(""" A clone of {be_name} exists and has been updated and activated. On the next boot the Boot Environment {be_name_clone} will be mounted on '/'. Reboot when ready to switch to this updated BE. *** Reboot required *** New BE: {be_name_clone} -""" - ).format(**self.__dict__) - ) +""").format(**self.__dict__)) else: - logger.info( - _( - """ + logger.info(_(""" A clone of {be_name} exists and has been updated. To set the new BE as the active one on next boot, execute the following command as a privileged user and reboot when ready to switch to the updated BE: beadm activate {be_name_clone} -""" - ).format(**self.__dict__) - ) +""").format(**self.__dict__)) def activate_be(): # Delete the snapshot that was taken before we diff --git a/src/modules/client/client_api.py b/src/modules/client/client_api.py index 502b768d9..29575999a 100644 --- a/src/modules/client/client_api.py +++ b/src/modules/client/client_api.py @@ -1309,12 +1309,12 @@ def __api_plan_exception( return __prepare_json(e.lix_exitrv, errors=errors_json) if e_type == api_errors.IpkgOutOfDateException: error = { - "info": _( - """\ + "info": _("""\ WARNING: pkg(7) appears to be out of date, and should be updated before running {op}. Please update pkg(7) by executing 'pkg install -pkg:/package/pkg' as a privileged user and then retry the {op}.""" - ).format(**locals()) +pkg:/package/pkg' as a privileged user and then retry the {op}.""").format( + **locals() + ) } errors_json.append(error) return __prepare_json(EXIT_OOPS, errors=errors_json) @@ -2203,13 +2203,11 @@ def get_pubs(): # specified publisher prefix. if "data" not in ret_json: _error_json( - _( - """ + _(""" The specified repository did not contain any publisher configuration information. This is likely the result of a repository configuration error. Please contact the repository administrator for further -assistance.""" - ), +assistance."""), errors_json=errors_json, ) return __prepare_json(EXIT_OOPS, errors=errors_json) @@ -3059,18 +3057,14 @@ def __append_attr_lists(label, values): err = EXIT_OOPS if not quiet: if info_local: - err_txt += _( - """\ + err_txt += _("""\ pkg: info: no packages matching the following patterns you specified are -installed on the system. Try querying remotely instead:\n""" - ) +installed on the system. Try querying remotely instead:\n""") elif info_remote: - err_txt += _( - """\ + err_txt += _("""\ pkg: info: no packages matching the following patterns you specified were found in the catalog. Try relaxing the patterns, refreshing, and/or -examining the catalogs:\n""" - ) +examining the catalogs:\n""") err_txt += "\n" for p in notfound: err_txt += " {0}".format(p) diff --git a/src/modules/client/image.py b/src/modules/client/image.py index abbe877f4..65c605f9d 100644 --- a/src/modules/client/image.py +++ b/src/modules/client/image.py @@ -158,14 +158,12 @@ def __init__( and "PKG_NO_RUNPY_CMDPATH" in os.environ and self.cmdpath.endswith(os.sep + "run.py") ): - raise RuntimeError( - """ + raise RuntimeError(""" An Image object was allocated from within ipkg test suite and cmdpath was not explicitly overridden. Please make sure to explicitly set cmdpath when allocating an Image object, or override cmdpath when allocating an Image object by setting PKG_CMDPATH -in the environment or by setting simulate_cmdpath in DebugValues.""" - ) +in the environment or by setting simulate_cmdpath in DebugValues.""") self.linked = None diff --git a/src/modules/client/imageplan.py b/src/modules/client/imageplan.py index 3f8395177..a81271a30 100644 --- a/src/modules/client/imageplan.py +++ b/src/modules/client/imageplan.py @@ -4729,12 +4729,10 @@ def __make_excl_msg(self, elided: list[str]) -> str: actions.""" return ( - _( - """\ + _("""\ ***************************************************************************** WARNING: The following actions have not been installed as this is a partial -image (there are configured exclusions):""" - ) +image (there are configured exclusions):""") + "\n\n " + "\n ".join(elided) + """ diff --git a/src/modules/client/linkedimage/common.py b/src/modules/client/linkedimage/common.py index 203a48338..3dfe541d0 100644 --- a/src/modules/client/linkedimage/common.py +++ b/src/modules/client/linkedimage/common.py @@ -51,7 +51,6 @@ from functools import reduce - # pkg classes import pkg.actions import pkg.altroot as ar @@ -1701,7 +1700,7 @@ def __validate_child_attach(self, lin, path, props, allow_relink=False): # Does the parent image (ourselves) reside in clonable BE? # Unused variable 'be_uuid'; pylint: disable=W0612 - (be_name, be_uuid) = bootenv.BootEnv.get_be_name(self.__root) + be_name, be_uuid = bootenv.BootEnv.get_be_name(self.__root) # pylint: enable=W0612 img_is_clonable = bool(be_name) @@ -3501,7 +3500,7 @@ def child_op_rv(self, expect_plan): # make sure we're not going to block assert self.__pkg_remote.is_done() - (rv, e, stdout, stderr) = self.__pkg_remote.result() + rv, e, stdout, stderr = self.__pkg_remote.result() if e is not None: rv = pkgdefs.EXIT_OOPS diff --git a/src/modules/client/linkedimage/zone.py b/src/modules/client/linkedimage/zone.py index 95410ef36..80cef874d 100644 --- a/src/modules/client/linkedimage/zone.py +++ b/src/modules/client/linkedimage/zone.py @@ -37,7 +37,6 @@ import tempfile import subprocess - # pkg classes import pkg.client.api_errors as apx import pkg.client.pkgdefs as pkgdefs diff --git a/src/modules/client/pkgremote.py b/src/modules/client/pkgremote.py index 1b27e9f46..fb72ea879 100644 --- a/src/modules/client/pkgremote.py +++ b/src/modules/client/pkgremote.py @@ -37,7 +37,6 @@ import tempfile import traceback - # pkg classes import pkg.client.api_errors as apx import pkg.client.pkgdefs as pkgdefs diff --git a/src/modules/client/plandesc.py b/src/modules/client/plandesc.py index 61c2989c4..3ed3f036f 100644 --- a/src/modules/client/plandesc.py +++ b/src/modules/client/plandesc.py @@ -485,8 +485,8 @@ def get_mediators(self): ret = [] for m, ver, impl in sorted(self.mediators): - ((orig_ver, orig_ver_source), (new_ver, new_ver_source)) = ver - ((orig_impl, orig_impl_source), (new_impl, new_impl_source)) = impl + (orig_ver, orig_ver_source), (new_ver, new_ver_source) = ver + (orig_impl, orig_impl_source), (new_impl, new_impl_source) = impl out = "mediator {0}:\n".format(m) if orig_ver and new_ver: out += ( diff --git a/src/modules/client/progress.py b/src/modules/client/progress.py index 363892e81..c4cd77f25 100644 --- a/src/modules/client/progress.py +++ b/src/modules/client/progress.py @@ -173,7 +173,7 @@ def newdata(self, nbytes, timestamp=None): # Step 2: Expunge old data # while len(self.__deque) > 0: - (ts, val) = self.__deque[0] + ts, val = self.__deque[0] if ts < curtime - self.INTERVAL: self.__intervalbytes -= val self.__deque.popleft() diff --git a/src/modules/client/publisher.py b/src/modules/client/publisher.py index fdd1d34a3..8ed01d7e7 100644 --- a/src/modules/client/publisher.py +++ b/src/modules/client/publisher.py @@ -1769,8 +1769,7 @@ def __validate_metadata(self, croot, repo): origins = repo.origins origin = origins[0] logger.error( - _( - """ + _(""" Unable to retrieve package data for publisher '{prefix}' from one of the following origin(s): @@ -1778,8 +1777,7 @@ def __validate_metadata(self, croot, repo): The catalog retrieved from one of the origin(s) listed above only contains package data for: {pubs}. -""" - ).format( +""").format( origins="\n".join(str(o) for o in origins), prefix=self.prefix, pubs=", ".join(pubs), @@ -1787,54 +1785,36 @@ def __validate_metadata(self, croot, repo): ) if global_settings.client_name != "pkg": - logger.error( - _( - """\ + logger.error(_("""\ This is either a result of invalid origin information being provided for publisher '{0}', or because the wrong publisher name was provided when this publisher was added. -""" - ).format(self.prefix) - ) +""").format(self.prefix)) # Remaining messages are for pkg client only. return - logger.error( - _( - """\ + logger.error(_("""\ To resolve this issue, correct the origin information provided for publisher '{prefix}' using the pkg set-publisher subcommand, or re-add the publisher using the correct name and remove the '{prefix}' publisher. -""" - ).format(prefix=self.prefix) - ) +""").format(prefix=self.prefix)) if len(pubs) == 1: - logger.warning( - _( - """\ + logger.warning(_("""\ To re-add this publisher with the correct name, execute the following commands as a privileged user: pkg set-publisher -P -g {origin} {pub} pkg unset-publisher {prefix} -""" - ).format( - origin=origin, prefix=self.prefix, pub=list(pubs)[0] - ) - ) +""").format(origin=origin, prefix=self.prefix, pub=list(pubs)[0])) return - logger.warning( - _( - """\ + logger.warning(_("""\ The origin(s) listed above contain package data for more than one publisher, but this issue can likely be resolved by executing one of the following commands as a privileged user: -""" - ) - ) +""")) for pfx in pubs: logger.warning( @@ -1843,16 +1823,12 @@ def __validate_metadata(self, croot, repo): ) ) - logger.warning( - _( - """\ + logger.warning(_("""\ Afterwards, the old publisher should be removed by executing the following command as a privileged user: pkg unset-publisher {0} -""" - ).format(self.prefix) - ) +""").format(self.prefix)) @property def catalog(self): diff --git a/src/modules/client/transport/repo.py b/src/modules/client/transport/repo.py index ba46a07c8..b861f36db 100644 --- a/src/modules/client/transport/repo.py +++ b/src/modules/client/transport/repo.py @@ -353,36 +353,28 @@ def _analyze_server_error(error_header): SERVER_ERROR = "SVR" MAINTENANCE = "MNT" - entitlement_err_msg = N_( - """ + entitlement_err_msg = N_(""" This account is not entitled to access this repository. Ensure that the correct certificate is being used and that the support contract for the product being accessed is still valid. -""" - ) +""") - license_err_msg = N_( - """ + license_err_msg = N_(""" The license agreement required to access this repository has not been accepted yet or the license agreement for the product has changed. Please go to https://pkg-register.oracle.com and accept the license for the product you are trying to access. -""" - ) +""") - server_err_msg = N_( - """ + server_err_msg = N_(""" Repository access is currently unavailable due to service issues. Please retry later or contact your customer service representative. -""" - ) +""") - maintenance_msg = N_( - """ + maintenance_msg = N_(""" Repository access rights can currently not be verified due to server maintenance. Please retry later. -""" - ) +""") msg = "" # multiple errors possible (e.g. license and entitlement not ok) diff --git a/src/modules/file_layout/layout.py b/src/modules/file_layout/layout.py index 9cd5c6ffa..d0ca18d73 100644 --- a/src/modules/file_layout/layout.py +++ b/src/modules/file_layout/layout.py @@ -57,7 +57,6 @@ a server can open a file to serve it. File sizes from 1 to 10M were used to asses the scalability of the different layouts.""" - import os diff --git a/src/modules/indexer.py b/src/modules/indexer.py index 9f26815b0..2ad7262f1 100644 --- a/src/modules/indexer.py +++ b/src/modules/indexer.py @@ -622,7 +622,7 @@ def _update_index(self, dicts, out_dir): try: for line in file_handle: - (tok, at_lst) = self._data_main_dict.parse_main_dict_line(line) + tok, at_lst = self._data_main_dict.parse_main_dict_line(line) existing_entries = [] for at, st_list in at_lst: st_res = [] diff --git a/src/modules/lint/config.py b/src/modules/lint/config.py index d9e9b6321..7467c4e96 100644 --- a/src/modules/lint/config.py +++ b/src/modules/lint/config.py @@ -31,7 +31,6 @@ import configparser from collections import OrderedDict - defaults = { "log_level": "INFO", "do_pub_checks": "True", diff --git a/src/modules/lint/engine.py b/src/modules/lint/engine.py index 6918bbc05..3fe68af82 100644 --- a/src/modules/lint/engine.py +++ b/src/modules/lint/engine.py @@ -381,7 +381,7 @@ def _load_checker_module(self, name, config): # the fifth parameter is 'level', which defaults to -1 # in Python 2 and 0 in Python 3. __import__(name, None, None, []) - (checkers, excluded) = base.get_checkers(sys.modules[name], config) + checkers, excluded = base.get_checkers(sys.modules[name], config) return (checkers, excluded) except (KeyError, ImportError) as err: raise base.LintException(err) @@ -459,12 +459,12 @@ def load_config(self, config, verbose=False): if "pkglint.ext" in key: if value in excl: # want to exclude everything from here - (checkers, exclude) = self._load_checker_module(value, conf) + checkers, exclude = self._load_checker_module(value, conf) self.excluded_checkers.extend(checkers) self.excluded_checkers.extend(exclude) continue try: - (checkers, exclude) = self._load_checker_module(value, conf) + checkers, exclude = self._load_checker_module(value, conf) self.checkers.extend(checkers) self.excluded_checkers.extend(exclude) diff --git a/src/modules/misc.py b/src/modules/misc.py index a052868a4..78b90a983 100644 --- a/src/modules/misc.py +++ b/src/modules/misc.py @@ -127,12 +127,10 @@ def get_traceback_message(): is necessary since the _() call must be done at runtime after locale setup.""" - return _( - """\n + return _("""\n This is an internal error in pkg(7) version {version}. Please log a Service Request about this issue including the information above and this -message.""" - ).format(version=VERSION) +message.""").format(version=VERSION) def get_release_notes_url(): @@ -3245,7 +3243,7 @@ def set_fd_limits(printer=None): printer = emsg try: - (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE) + soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE) soft = max(hard, FILE_DESCRIPTOR_LIMIT) resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard)) except (OSError, ValueError) as e: diff --git a/src/modules/publish/dependencies.py b/src/modules/publish/dependencies.py index 67743750a..141b7fe6e 100644 --- a/src/modules/publish/dependencies.py +++ b/src/modules/publish/dependencies.py @@ -218,15 +218,13 @@ def __init__(self, conditionals, pkg_vars): self.pkg_vct = pkg_vars def __str__(self): - s = _( - """\ + s = _("""\ pkgdepend has inferred conditional dependencies with different targets but which share a predicate. pkg(7) can not represent these dependencies. This issue can be resolved by changing the packaging of the links which generated the conditional dependencies so that they have different predicates or share the same FMRI. Each pair of problematic conditional dependencies follows: -""" - ) +""") for i, (d1, d2, v) in enumerate(self.conditionals): i += 1 v.simplify(self.pkg_vct) diff --git a/src/modules/server/depot.py b/src/modules/server/depot.py index 7805821e8..5323b38bd 100644 --- a/src/modules/server/depot.py +++ b/src/modules/server/depot.py @@ -22,7 +22,7 @@ # # Copyright 2020 OmniOS Community Edition (OmniOSce) Association. -# Copyright (c) 2008, 2025, Oracle and/or its affiliates. +# Copyright (c) 2008, 2026, Oracle and/or its affiliates. # import cherrypy @@ -2191,13 +2191,13 @@ def nasty_serve_file(self, filepath, content_type): ncorrupt = 1 + int(abs(random.gauss(0, 1))) for x in range(0, ncorrupt): p = random.randint(0, max(0, filesz - 1)) - char = ord(body[p]) + char = body[p] # pick a bit to flip; favor low numbers, must # also cap at bit #7. bit = min(7, int(abs(random.gauss(0, 3)))) # flip it char ^= 1 << bit - body = body[:p] + chr(char) + body[p + 1 :] + body = body[:p] + char.to_bytes() + body[p + 1 :] response.body = body else: response.body = nfile.read(filesz) diff --git a/src/modules/server/feed.py b/src/modules/server/feed.py index d6566ca5b..25494d03a 100644 --- a/src/modules/server/feed.py +++ b/src/modules/server/feed.py @@ -45,7 +45,6 @@ import pkg.catalog as catalog import pkg.misc as misc - MIME_TYPE = "application/atom+xml" CACHE_FILENAME = "feed.xml" RFC3339_FMT = "%Y-%m-%dT%H:%M:%SZ" diff --git a/src/modules/sysvpkg.py b/src/modules/sysvpkg.py index fa164ecd3..cd4a827cb 100644 --- a/src/modules/sysvpkg.py +++ b/src/modules/sysvpkg.py @@ -69,7 +69,7 @@ def __init__(self, line, basedir=""): self.klass = None if self.type == "i": - (self.pathname, self.size, self.chksum, self.modtime) = array[2:] + self.pathname, self.size, self.chksum, self.modtime = array[2:] return self.klass = array[2] @@ -96,10 +96,10 @@ def __init__(self, line, basedir=""): ) = array[3:] elif self.type == "d" or self.type == "x" or self.type == "p": - (self.pathname, self.mode, self.owner, self.group) = array[3:] + self.pathname, self.mode, self.owner, self.group = array[3:] elif self.type == "l" or self.type == "s": - (self.pathname, self.target) = array[3].split("=") + self.pathname, self.target = array[3].split("=") self.target = self.target.replace("$BASEDIR", basedir) else: raise ValueError("Invalid file type: " + self.type) @@ -212,7 +212,7 @@ def readDependFile(self): fp = open(self.pkgpath + "/install/depend") except IOError as xxx_todo_changeme: # Missing depend file is just fine - (err, msg) = xxx_todo_changeme.args + err, msg = xxx_todo_changeme.args # Missing depend file is just fine if err == errno.ENOENT: return [] @@ -255,7 +255,7 @@ def readPkginfoFile(self): pkginfo["faspac"] = line.lstrip("#FASPACD=").split() continue - (key, val) = line.split("=", 1) + key, val = line.split("=", 1) pkginfo[key] = val.strip('"') # Expose the platform-specific package name, too. diff --git a/src/pkgdep.py b/src/pkgdep.py index 69fa87cac..85363597d 100755 --- a/src/pkgdep.py +++ b/src/pkgdep.py @@ -98,9 +98,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - emsg( - _( - """\ + emsg(_("""\ Usage: pkgdepend [options] command [cmd_options] [operands] @@ -114,9 +112,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): -R dir --help or -? Environment: - PKG_IMAGE""" - ) - ) + PKG_IMAGE""")) sys.exit(retcode) diff --git a/src/pkgrepo.py b/src/pkgrepo.py index 714acc68a..af4d2753b 100755 --- a/src/pkgrepo.py +++ b/src/pkgrepo.py @@ -152,9 +152,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT, full=False): logger.error(_("Try `pkgrepo --help or -?' for more information.")) sys.exit(retcode) - msg( - _( - """\ + msg(_("""\ Usage: pkgrepo [options] command [cmd_options] [operands] @@ -205,9 +203,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT, full=False): Options: --help or -? - Displays a usage message.""" - ) - ) + Displays a usage message.""")) sys.exit(retcode) @@ -1375,13 +1371,9 @@ def subcmd_contents(conf, args): if unmatched: if manifests: logger.error("") - logger.error( - _( - """\ + logger.error(_("""\ pkgrepo: contents: no packages matching the following patterns you specified -were found in the repository.""" - ) - ) +were found in the repository.""")) logger.error("") for p in unmatched: logger.error(" {0}".format(p)) @@ -2493,14 +2485,10 @@ def __diff_pub_helper(pub, symbol): # Here "number of packages" and "total distinct # versions" are shown outside and inside of square # brackets respectively. - msg( - _( - """ + msg(_(""" The table below shows the number of packages [total distinct versions] by publisher in the specified repositories. -""" - ) - ) +""")) for leg in res_dict["table_legend"]: msg("* " + leg[0] + ": " + leg[1]) msg("") diff --git a/src/publish.py b/src/publish.py index 3b5c6f6d2..c2cbc4a74 100755 --- a/src/publish.py +++ b/src/publish.py @@ -105,9 +105,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - print( - _( - """\ + print(_("""\ Usage: pkgsend [options] command [cmd_options] [operands] @@ -121,9 +119,7 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): --help or -? display usage message Environment: - PKG_REPO The path or URI of the destination repository.""" - ) - ) + PKG_REPO The path or URI of the destination repository.""")) sys.exit(retcode) diff --git a/src/pull.py b/src/pull.py index fbe1abef6..a5b0682ad 100755 --- a/src/pull.py +++ b/src/pull.py @@ -105,9 +105,7 @@ def usage(usage_error=None, retcode=pkgdefs.EXIT_BADOPT): if usage_error: error(usage_error) - msg( - _( - """\ + msg(_("""\ Usage: pkgrecv [-aknrv] [-s src_uri] [-d (path|dest_uri)] [-c cache_dir] [-m match] [--mog-file file_path ...] [--raw] @@ -202,9 +200,7 @@ def usage(usage_error=None, retcode=pkgdefs.EXIT_BADOPT): Environment: PKG_DEST Destination directory or URI - PKG_SRC Source URI or path""" - ) - ) + PKG_SRC Source URI or path""")) sys.exit(retcode) diff --git a/src/sign.py b/src/sign.py index 374776326..718f4921f 100755 --- a/src/sign.py +++ b/src/sign.py @@ -97,16 +97,12 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - emsg( - _( - """\ + emsg(_("""\ Usage: pkgsign -s path_or_uri [-acikn] [--no-index] [--no-catalog] [--dkey dest_key --dcert dest_cert] (fmri|pattern) ... -""" - ) - ) +""")) sys.exit(retcode) diff --git a/src/sysrepo.py b/src/sysrepo.py index 94fd054b7..51818243e 100755 --- a/src/sysrepo.py +++ b/src/sysrepo.py @@ -122,9 +122,7 @@ file 1 syspub 0 manifest 0 -""".format( - pkg.VERSION -) +""".format(pkg.VERSION) SYSREPO_USER = "pkg5srv" SYSREPO_GROUP = "pkg5srv" @@ -171,16 +169,12 @@ def usage(usage_error=None, cmd=None, retcode=EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - msg( - _( - """\ + msg(_("""\ Usage: pkg.sysrepo -p [-R image_root] [ -c cache_dir] [-h hostname] [-l logs_dir] [-r runtime_dir] [-s cache_size] [-t template_dir] [-T http_timeout] [-w http_proxy] [-W https_proxy] - """ - ) - ) + """)) sys.exit(retcode) diff --git a/src/tests/api/t_action.py b/src/tests/api/t_action.py index b4600135a..6592530db 100644 --- a/src/tests/api/t_action.py +++ b/src/tests/api/t_action.py @@ -95,25 +95,17 @@ def assertAttributeValue(self, action, attr, value): value.sort() if attrs != value: - self.fail( - """\ + self.fail("""\ Incorrect attribute value. Expected: {0} - Actual: {1}""".format( - value, attrs - ) - ) + Actual: {1}""".format(value, attrs)) def assertAttributes(self, action, attrlist): if sorted(action.attrs.keys()) != sorted(attrlist): - self.fail( - """\ + self.fail("""\ Incorrect attribute list. Expected: {0} - Actual: {1}""".format( - sorted(attrlist), sorted(action.attrs.keys()) - ) - ) + Actual: {1}""".format(sorted(attrlist), sorted(action.attrs.keys()))) def test_action_parser(self): action.fromstr("file 12345 name=foo path=/tmp/foo") diff --git a/src/tests/api/t_api.py b/src/tests/api/t_api.py index 3629f572b..3cd6e9898 100644 --- a/src/tests/api/t_api.py +++ b/src/tests/api/t_api.py @@ -776,7 +776,7 @@ def validate_results(results): # Verify that parse returns the expected object and information # when provided a file path. fobj.seek(0) - (fd1, path1) = tempfile.mkstemp(dir=self.test_root) + fd1, path1 = tempfile.mkstemp(dir=self.test_root) with open(path1, "w") as f: f.write(fobj.read()) validate_results(api_obj.parse_p5i(location=path1)) diff --git a/src/tests/api/t_api_list.py b/src/tests/api/t_api_list.py index d2791af46..048cd640b 100644 --- a/src/tests/api/t_api_list.py +++ b/src/tests/api/t_api_list.py @@ -196,9 +196,7 @@ def setUp(self): open {stem}@{ver} add set name=pkg.summary value="{summ}" add set name=pkg.description value="{desc}" -""".format( - stem=stem, ver=ver, summ=summ, desc=desc - ) +""".format(stem=stem, ver=ver, summ=summ, desc=desc) cats = self.__get_pkg_cats(stem, sver) if cats: diff --git a/src/tests/api/t_api_refresh.py b/src/tests/api/t_api_refresh.py index a99e5e95d..292d59910 100644 --- a/src/tests/api/t_api_refresh.py +++ b/src/tests/api/t_api_refresh.py @@ -59,13 +59,9 @@ class TestApiRefresh(pkg5unittest.ManyDepotTestCase): pkgs_data = {} for i, pkg in enumerate(pkgs): - pkgs_data[i] = ( - """ + pkgs_data[i] = """ open {pkg} - close""".format( - pkg=pkg - ) - ) + close""".format(pkg=pkg) def setUp(self): # we want two publishers with the same name diff --git a/src/tests/api/t_config.py b/src/tests/api/t_config.py index 3650b76b6..becdff2d6 100644 --- a/src/tests/api/t_config.py +++ b/src/tests/api/t_config.py @@ -1482,9 +1482,7 @@ def test_base(self): bool_basic = False str_basic = {0} -""".format( - TH_PACKAGE - ), +""".format(TH_PACKAGE), str(conf), ) @@ -1509,9 +1507,7 @@ def test_base(self): bool_basic = False str_basic = {0} -""".format( - TH_PACKAGE - ), +""".format(TH_PACKAGE), str(conf), ) @@ -1623,9 +1619,7 @@ def test_file_read_write(self): [unknown_section] unknown_property = {0} -""".format( - TH_PACKAGE - ) +""".format(TH_PACKAGE) scpath = self.make_misc_files({"cfg_cache": content})[0] conf = cfg.FileConfig(scpath, definitions=self._defs) self.assertEqual(conf.version, 0) @@ -1642,9 +1636,7 @@ def test_file_read_write(self): [new_section] new_property = {0} -""".format( - TH_PACKAGE - ) +""".format(TH_PACKAGE) scpath = self.make_misc_files({"cfg_cache": content})[0] conf = cfg.FileConfig(scpath, definitions=self._defs) self.assertEqual(conf.version, 2) diff --git a/src/tests/api/t_dependencies.py b/src/tests/api/t_dependencies.py index a1e435ed1..b89ac108f 100644 --- a/src/tests/api/t_dependencies.py +++ b/src/tests/api/t_dependencies.py @@ -129,113 +129,81 @@ class TestDependencyAnalyzer(pkg5unittest.Pkg5TestCase): hardlink path=usr/foo target=../{syslog_path} hardlink path=usr/bar target=../{syslog_path} hardlink path=baz target={authlog_path} -""".format( - **paths - ) +""".format(**paths) int_hardlink_manf = """ \ hardlink path=usr/foo target=../{syslog_path} file NOHASH group=sys mode=0644 owner=root path={syslog_path} -""".format( - **paths - ) +""".format(**paths) int_hardlink_manf_test_symlink = """ \ hardlink path=usr/foo target=../{syslog_path} file NOHASH group=sys mode=0644 owner=root path=bar/syslog -""".format( - **paths - ) +""".format(**paths) ext_script_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={script_path} -""".format( - **paths - ) +""".format(**paths) int_script_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={script_path} file NOHASH group=bin mode=0755 owner=root path={ksh_path} -""".format( - **paths - ) +""".format(**paths) ext_elf_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={curses_path} -""".format( - **paths - ) +""".format(**paths) int_elf_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={libc_path} file NOHASH group=bin mode=0755 owner=root path={curses_path} -""".format( - **paths - ) +""".format(**paths) ext_python_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={indexer_path} -""".format( - **paths - ) +""".format(**paths) ext_python_pkg_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={pkg_path} -""".format( - **paths - ) +""".format(**paths) python_mod_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={py_mod_path} file NOHASH group=bin mode=0755 owner=root path={py_mod_path_alt} -""".format( - **paths - ) +""".format(**paths) relative_ext_depender_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={relative_depender} -""".format( - **paths - ) +""".format(**paths) relative_int_manf = """ \ file NOHASH group=bin mode=0755 owner=root path={relative_dependee} file NOHASH group=bin mode=0755 owner=root path={relative_depender} -""".format( - **paths - ) +""".format(**paths) variant_manf_1 = """ \ set name=variant.arch value=foo value=bar value=baz file NOHASH group=bin mode=0755 owner=root path={script_path} file NOHASH group=bin mode=0755 owner=root path={ksh_path} variant.arch=foo -""".format( - **paths - ) +""".format(**paths) variant_manf_2 = """ \ set name=variant.arch value=foo value=bar value=baz file NOHASH group=bin mode=0755 owner=root path={script_path} variant.arch=foo file NOHASH group=bin mode=0755 owner=root path={ksh_path} variant.arch=foo -""".format( - **paths - ) +""".format(**paths) variant_manf_3 = """ \ set name=variant.arch value=foo value=bar value=baz file NOHASH group=bin mode=0755 owner=root path={script_path} variant.arch=bar file NOHASH group=bin mode=0755 owner=root path={ksh_path} variant.arch=foo -""".format( - **paths - ) +""".format(**paths) variant_manf_4 = """ \ set name=variant.arch value=foo set name=variant.opensolaris.zone value=global value=nonglobal file NOHASH group=bin mode=0755 owner=root path={script_path} variant.opensolaris.zone=global file NOHASH group=bin mode=0755 owner=root path={ksh_path} variant.opensolaris.zone=global -""".format( - **paths - ) +""".format(**paths) python_abs_text = """\ #!/usr/bin/python @@ -284,9 +252,7 @@ def run(self): ] smf_manifest_text = {} - smf_manifest_text[ - "service_single" - ] = """ + smf_manifest_text["service_single"] = """ @@ -356,9 +322,7 @@ def run(self): "svc:/application/pkg5test/delivered-many:nodeps2", ] - smf_manifest_text[ - "service_single_specific" - ] = """ + smf_manifest_text["service_single_specific"] = """ @@ -432,9 +396,7 @@ def run(self): "svc:/application/pkg5test/delivered-many" ] - smf_manifest_text[ - "service_general" - ] = """ + smf_manifest_text["service_general"] = """ @@ -511,9 +473,7 @@ def run(self): "svc:/application/pkg5test/foreign-many" ] - smf_manifest_text[ - "service_many" - ] = """ + smf_manifest_text["service_many"] = """ @@ -606,9 +566,7 @@ def run(self): "svc:/application/pkg5test/another-unknown:default", ] - smf_manifest_text[ - "service_unknown" - ] = """ + smf_manifest_text["service_unknown"] = """ @@ -695,9 +653,7 @@ def run(self): smf_known_deps["svc:/application/pkg5test/delivered-many:nodeps"] = [] smf_known_deps["svc:/application/pkg5test/delivered-many:nodeps1"] = [] - smf_manifest_text[ - "delivered_many_nodeps" - ] = """ + smf_manifest_text["delivered_many_nodeps"] = """ -\"{2}\"
""".format( - url, fname, title - ) +\"{2}\"
""".format(url, fname, title) rf.close() @@ -371,9 +360,7 @@ def report_by_country(data, title, summary_file=None):
    -""".format( - title, title, title - ) +""".format(title, title, title) sel = 'class="selected"' for r in map_regions: diff --git a/src/util/log-scripts/an_search.py b/src/util/log-scripts/an_search.py index 15620be65..edd1aadd8 100644 --- a/src/util/log-scripts/an_search.py +++ b/src/util/log-scripts/an_search.py @@ -64,9 +64,7 @@ def emit_search_report(summary_file, searchtype, label, results):
    - """.format( - label=label, searchtype=searchtype - ), + """.format(label=label, searchtype=searchtype), file=summary_file, ) @@ -100,9 +98,7 @@ def emit_search_report(summary_file, searchtype, label, results): myColumnDefs, myDataSource, {sortedBy:{key:"{label}", dir:YAHOO.widget.DataTable.CLASS_DESC}}); - """.format( - label=label, searchtype=searchtype - ), + """.format(label=label, searchtype=searchtype), file=summary_file, ) diff --git a/src/util/log-scripts/in_header.py b/src/util/log-scripts/in_header.py index 9c8bbc2d1..2ef4df146 100644 --- a/src/util/log-scripts/in_header.py +++ b/src/util/log-scripts/in_header.py @@ -110,9 +110,7 @@

    {1} {2} Statistics

    -""".format( - hostname, hostname, hostname -) +""".format(hostname, hostname, hostname) print(header) diff --git a/src/util/log-scripts/translate.py b/src/util/log-scripts/translate.py index 5528e5f06..10e6da104 100644 --- a/src/util/log-scripts/translate.py +++ b/src/util/log-scripts/translate.py @@ -58,7 +58,7 @@ # print("line: [{0}]".format(line)) fields = line.split() - (ip, d, fullop) = (fields[0], fields[3], fields[6]) + ip, d, fullop = (fields[0], fields[3], fields[6]) del fields # Get country code and translate ip -> md5 of ip diff --git a/src/util/publish/pkgdiff.py b/src/util/publish/pkgdiff.py index 667a5a3bd..f56ca62a5 100755 --- a/src/util/publish/pkgdiff.py +++ b/src/util/publish/pkgdiff.py @@ -63,15 +63,11 @@ def usage(errmsg="", exitcode=EXIT_BADOPT): if errmsg: print("pkgdiff: {0}".format(errmsg), file=sys.stderr) - print( - _( - """\ + print(_("""\ Usage: pkgdiff [-i attribute]... [-o attribute] [-t action_name[,action_name]...]... - [-v name=value]... (file1 | -) (file2 | -)""" - ) - ) + [-v name=value]... (file1 | -) (file2 | -)""")) sys.exit(exitcode) diff --git a/src/util/publish/pkgfmt.py b/src/util/publish/pkgfmt.py index 255d964e1..8133ab408 100755 --- a/src/util/publish/pkgfmt.py +++ b/src/util/publish/pkgfmt.py @@ -105,11 +105,9 @@ def usage(errmsg="", exitcode=EXIT_BADOPT): error(errmsg) print( - _( - """\ + _("""\ Usage: - pkgfmt [-cdsu] [-f v1|v2] [file1] ... """ - ), + pkgfmt [-cdsu] [-f v1|v2] [file1] ... """), file=sys.stderr, ) diff --git a/src/util/publish/pkgmerge.py b/src/util/publish/pkgmerge.py index eaa454bc2..d7204da59 100755 --- a/src/util/publish/pkgmerge.py +++ b/src/util/publish/pkgmerge.py @@ -108,9 +108,7 @@ def usage(errmsg="", exitcode=EXIT_BADOPT): if errmsg: emsg("pkgmerge: {0}".format(errmsg)) - msg( - _( - """\ + msg(_("""\ Usage: pkgmerge [-n] -d dest_repo -s variant=value[,...],src_repo ... [-p publisher_prefix ... ] [pkg_fmri_pattern ...] @@ -146,9 +144,7 @@ def usage(errmsg="", exitcode=EXIT_BADOPT): TMPDIR, TEMP, TMP The absolute path of the directory where temporary data should be stored during program execution. -""" - ) - ) +""")) sys.exit(exitcode) @@ -430,7 +426,7 @@ def main_func(): " not have matching versions across all " "repositories for publisher {pubs}: " "{patterns}" - ).format(pub=pub.prefix, patterns=processdict[entry]) + ).format(pubs=pub.prefix, patterns=processdict[entry]) ) continue diff --git a/src/util/publish/pkgmogrify.py b/src/util/publish/pkgmogrify.py index 52399e0ee..2326222a0 100755 --- a/src/util/publish/pkgmogrify.py +++ b/src/util/publish/pkgmogrify.py @@ -51,14 +51,10 @@ def usage(errmsg="", exitcode=EXIT_BADOPT): if errmsg: print("pkgmogrify: {0}".format(errmsg), file=sys.stderr) - print( - _( - """\ + print(_("""\ Usage: pkgmogrify [-vi] [-I includedir ...] [-D macro=value ...] - [-O outputfile] [-P printfile] [inputfile ...]""" - ) - ) + [-O outputfile] [-P printfile] [inputfile ...]""")) sys.exit(exitcode) diff --git a/src/util/publish/pkgsurf.py b/src/util/publish/pkgsurf.py index befd0ed6b..e2d04742f 100755 --- a/src/util/publish/pkgsurf.py +++ b/src/util/publish/pkgsurf.py @@ -135,18 +135,14 @@ def cleanup(no_msg=False): global temp_root if repo_modified and not repo_finished and not no_msg: - error( - _( - """ + error(_(""" The target repository has been modified but the operation did not finish successfully. It is now in an inconsistent state. To re-try the operation, run the following commands: /usr/bin/pkgrepo rebuild -s {repo} {argv} -""" - ).format(repo=repo_uri, argv=" ".join(sys.argv)) - ) +""").format(repo=repo_uri, argv=" ".join(sys.argv))) if temp_root: shutil.rmtree(temp_root) @@ -160,9 +156,7 @@ def usage(usage_error=None, cmd=None, retcode=pkgdefs.EXIT_BADOPT): if usage_error: error(usage_error, cmd=cmd) - emsg( - _( - """\ + emsg(_("""\ Usage: pkgsurf -s target_path -r ref_uri [-n] [-p publisher ...] [-i name ...] [-c pattern ...] @@ -188,9 +182,7 @@ def usage(usage_error=None, cmd=None, retcode=pkgdefs.EXIT_BADOPT): filesystem-based repository. -?/--help Print this message. -""" - ) - ) +""")) sys.exit(retcode)
    Term{label}