From a5235c45e8c8b3a6710fc5a11df21b1999039f88 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 1 Nov 2023 14:30:08 -0500 Subject: [PATCH] Remove string concatenations --- conda_build/_load_setup_py_data.py | 6 +++--- conda_build/api.py | 2 +- conda_build/build.py | 2 +- conda_build/cli/main_build.py | 2 +- conda_build/cli/main_render.py | 2 +- conda_build/config.py | 4 ++-- conda_build/inspect_pkg.py | 2 +- conda_build/metadata.py | 2 +- conda_build/skeletons/cran.py | 2 +- conda_build/utils.py | 5 +---- tests/test_api_build.py | 2 +- 11 files changed, 14 insertions(+), 17 deletions(-) diff --git a/conda_build/_load_setup_py_data.py b/conda_build/_load_setup_py_data.py index 71b96dbaa7..efeb14c69d 100644 --- a/conda_build/_load_setup_py_data.py +++ b/conda_build/_load_setup_py_data.py @@ -140,18 +140,18 @@ def setup(**kw): parser.add_argument("setup_file", help="path or filename of setup.py file") parser.add_argument( "--from-recipe-dir", - help=("look for setup.py file in recipe " "dir (as opposed to work dir)"), + help="look for setup.py file in recipe dir (as opposed to work dir)", default=False, action="store_true", ) parser.add_argument( "--recipe-dir", - help=("(optional) path to recipe dir, where " "setup.py should be found"), + help="(optional) path to recipe dir, where setup.py should be found", ) parser.add_argument( "--permit-undefined-jinja", - help=("look for setup.py file in recipe " "dir (as opposed to work dir)"), + help="look for setup.py file in recipe dir (as opposed to work dir)", default=False, action="store_true", ) diff --git a/conda_build/api.py b/conda_build/api.py index 076a15beff..24824559aa 100644 --- a/conda_build/api.py +++ b/conda_build/api.py @@ -414,7 +414,7 @@ def convert( ) elif package_file.endswith(".whl"): raise RuntimeError( - "Conversion from wheel packages is not " "implemented yet, stay tuned." + "Conversion from wheel packages is not implemented yet, stay tuned." ) else: raise RuntimeError("cannot convert: %s" % package_file) diff --git a/conda_build/build.py b/conda_build/build.py index 6c8e2f474f..3d57f3617a 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -4090,7 +4090,7 @@ def handle_anaconda_upload(paths, config): prompter = "$ " if not upload or anaconda is None: no_upload_message = ( - "# If you want to upload package(s) to anaconda.org later, type:\n" "\n" + "# If you want to upload package(s) to anaconda.org later, type:\n\n" ) no_upload_message += ( "\n" diff --git a/conda_build/cli/main_build.py b/conda_build/cli/main_build.py index cba6fec6ff..f54388920d 100644 --- a/conda_build/cli/main_build.py +++ b/conda_build/cli/main_build.py @@ -437,7 +437,7 @@ def parse_args(args): ) p.add_argument( "--stats-file", - help=("File path to save build statistics to. Stats are " "in JSON format"), + help="File path to save build statistics to. Stats are in JSON format", ) p.add_argument( "--extra-deps", diff --git a/conda_build/cli/main_render.py b/conda_build/cli/main_render.py index a563e87c1b..4647d43996 100644 --- a/conda_build/cli/main_render.py +++ b/conda_build/cli/main_render.py @@ -66,7 +66,7 @@ def get_render_parser(): p.add_argument( "--output", action="store_true", - help="Output the conda package filename which would have been " "created", + help="Output the conda package filename which would have been created", ) p.add_argument( "--python", diff --git a/conda_build/config.py b/conda_build/config.py index e1bba06518..b3a4e74d58 100644 --- a/conda_build/config.py +++ b/conda_build/config.py @@ -868,11 +868,11 @@ def clean(self, remove_folders=True): rm_rf(os.path.join(self.build_folder, "prefix_files")) else: print( - "\nLeaving build/test directories:" "\n Work:\n", + "\nLeaving build/test directories:\n Work:\n", self.work_dir, "\n Test:\n", self.test_dir, - "\nLeaving build/test environments:" "\n Test:\nsource activate ", + "\nLeaving build/test environments:\n Test:\nsource activate ", self.test_prefix, "\n Build:\nsource activate ", self.build_prefix, diff --git a/conda_build/inspect_pkg.py b/conda_build/inspect_pkg.py index cbb60d4f25..81712c8696 100644 --- a/conda_build/inspect_pkg.py +++ b/conda_build/inspect_pkg.py @@ -283,7 +283,7 @@ def inspect_linkages( if len(deps) > 1: deps_str = [str(dep) for dep in deps] get_logger(__name__).warn( - "Warning: %s comes from multiple " "packages: %s", + "Warning: %s comes from multiple packages: %s", path, comma_join(deps_str), ) diff --git a/conda_build/metadata.py b/conda_build/metadata.py index 5ca91b2e81..6c98c7b62f 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -319,7 +319,7 @@ def ensure_valid_fields(meta): pin_depends = meta.get("build", {}).get("pin_depends", "") if pin_depends and pin_depends not in ("", "record", "strict"): raise RuntimeError( - "build/pin_depends must be 'record' or 'strict' - " "not '%s'" % pin_depends + f"build/pin_depends must be 'record' or 'strict' - not '{pin_depends}'" ) diff --git a/conda_build/skeletons/cran.py b/conda_build/skeletons/cran.py index 6a4dbe65f6..e4b54ccf71 100755 --- a/conda_build/skeletons/cran.py +++ b/conda_build/skeletons/cran.py @@ -387,7 +387,7 @@ def add_parser(repos): "--use-noarch-generic", action="store_true", dest="use_noarch_generic", - help=("Mark packages that do not need compilation as `noarch: generic`"), + help="Mark packages that do not need compilation as `noarch: generic`", ) cran.add_argument( "--use-rtools-win", diff --git a/conda_build/utils.py b/conda_build/utils.py index f8606ffe9d..f50b6fd73d 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -163,7 +163,6 @@ def directory_size_slow(path): def directory_size(path): - """ """ try: if on_win: command = 'dir /s "{}"' # Windows path can have spaces @@ -716,9 +715,7 @@ def merge_tree( existing = [f for f in new_files if isfile(f)] if existing and not clobber: - raise OSError( - "Can't merge {} into {}: file exists: " "{}".format(src, dst, existing[0]) - ) + raise OSError(f"Can't merge {src} into {dst}: file exists: {existing[0]}") locks = [] if locking: diff --git a/tests/test_api_build.py b/tests/test_api_build.py index e0a5b4df7b..54a4a1c0cd 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -1398,7 +1398,7 @@ def test_recursion_layers(testing_config): @pytest.mark.sanity @pytest.mark.skipif( sys.platform != "win32", - reason=("spaces break openssl prefix " "replacement on *nix"), + reason="spaces break openssl prefix replacement on *nix", ) def test_croot_with_spaces(testing_metadata, testing_workdir): testing_metadata.config.croot = os.path.join(testing_workdir, "space path")