Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda_smithy/ci_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def add_project_to_travis(user, project):
end="",
)
sys.stdout.flush()
sync_url = "{}/user/{}/sync".format(travis_endpoint, user_info["id"])
sync_url = f"{travis_endpoint}/user/{user_info['id']}/sync"
response = requests.post(sync_url, headers=headers)
if response.status_code != 409:
# 409 status code is for indicating that another synching might be happening at the
Expand Down
22 changes: 10 additions & 12 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,9 +1045,7 @@ def _get_fast_finish_script(provider_name, forge_config, forge_dir, fast_finish_
)
if provider_name == "appveyor":
if os.path.exists(cfbs_fpath):
fast_finish_script = "{recipe_dir}\\ff_ci_pr_build".format(
recipe_dir=forge_config["recipe_dir"]
)
fast_finish_script = f"{forge_config['recipe_dir']}\\ff_ci_pr_build"
else:
get_fast_finish_script = '''powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/conda-forge/conda-forge-ci-setup-feedstock/{branch}/recipe/conda_forge_ci_setup/ff_ci_pr_build.py', 'ff_ci_pr_build.py')"''' # NOQA
fast_finish_script += "ff_ci_pr_build"
Expand All @@ -1064,8 +1062,8 @@ def _get_fast_finish_script(provider_name, forge_config, forge_dir, fast_finish_
# If the recipe supplies its own ff_ci_pr_build.py script,
# we use it instead of the global one.
if os.path.exists(cfbs_fpath):
get_fast_finish_script += "cat {recipe_dir}/ff_ci_pr_build.py".format(
recipe_dir=forge_config["recipe_dir"]
get_fast_finish_script += (
f"cat {forge_config['recipe_dir']}/ff_ci_pr_build.py"
)
else:
get_fast_finish_script += "curl https://raw.githubusercontent.com/conda-forge/conda-forge-ci-setup-feedstock/{branch}/recipe/conda_forge_ci_setup/ff_ci_pr_build.py" # NOQA
Expand Down Expand Up @@ -1521,15 +1519,15 @@ def _get_build_setup_line(forge_dir, platform, forge_config):

""")
elif platform == "win":
build_setup += textwrap.dedent("""\
build_setup += textwrap.dedent(f"""\
:: Overriding global run_conda_forge_build_setup_win with local copy.
CALL {recipe_dir}\\run_conda_forge_build_setup_win
""".format(recipe_dir=forge_config["recipe_dir"]))
CALL {forge_config["recipe_dir"]}\\run_conda_forge_build_setup_win
""")
else:
build_setup += textwrap.dedent("""\
build_setup += textwrap.dedent(f"""\
# Overriding global run_conda_forge_build_setup_osx with local copy.
source {recipe_dir}/run_conda_forge_build_setup_osx
""".format(recipe_dir=forge_config["recipe_dir"]))
source {forge_config["recipe_dir"]}/run_conda_forge_build_setup_osx
""")
else:
if platform == "win":
build_setup += textwrap.dedent("""\
Expand Down Expand Up @@ -1600,7 +1598,7 @@ def generate_yum_requirements(forge_config, forge_dir):
# "recipe/yum_requirements.txt" file. After updating that file,
# run "conda smithy rerender" and this line will be updated
# automatically.
/usr/bin/sudo -n yum install -y {}""".format(" ".join(requirements)))
/usr/bin/sudo -n yum install -y {" ".join(requirements)}""")
return yum_build_setup


Expand Down
17 changes: 5 additions & 12 deletions conda_smithy/feedstock_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,14 @@ def generate_and_write_feedstock_token(user, project, provider=None):
# spill tokens
failed = False
err_msg = None
provider_str = "provider" if provider is None else "provider " + provider
with _secure_io():
try:
token = secrets.token_hex(32)
pth = feedstock_token_local_path(user, project, provider=provider)
if os.path.exists(pth):
failed = True
err_msg = (
"Token for {}/{} on provider{} is already written locally!".format(
user,
project,
"" if provider is None else " " + provider,
)
)
err_msg = f"Token for {user}/{project} on {provider_str} is already written locally!"
raise FeedstockTokenError(err_msg)

os.makedirs(os.path.dirname(pth), exist_ok=True)
Expand All @@ -117,11 +112,9 @@ def generate_and_write_feedstock_token(user, project, provider=None):
raise FeedstockTokenError(err_msg)
else:
raise FeedstockTokenError(
(
"Generating the feedstock token for {}/{} on provider{} failed!"
" Try the command locally with DEBUG_FEEDSTOCK_TOKENS"
" defined in the environment to investigate!"
).format(user, project, "" if provider is None else " " + provider)
f"Generating the feedstock token for {user}/{project} on {provider_str} failed!"
" Try the command locally with DEBUG_FEEDSTOCK_TOKENS"
" defined in the environment to investigate!"
)

return failed
Expand Down
23 changes: 23 additions & 0 deletions news/2520-simplify-string-formatting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Simplify string formatting by using f-strings. (#2520)

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>