Skip to content

Commit

Permalink
Merge pull request #1762 from SUSE/no_future
Browse files Browse the repository at this point in the history
remove ensure_future wrapping for coroutines
  • Loading branch information
dirkmueller authored Sep 30, 2024
2 parents 06b89fe + d60558b commit 67c8e74
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,29 +1295,21 @@ async def write_file_to_dest(fname: str, contents: str | bytes) -> None:
if dockerfile[-1] != "\n":
dockerfile += "\n"

tasks.append(asyncio.ensure_future(write_file_to_dest(fname, dockerfile)))
tasks.append(write_file_to_dest(fname, dockerfile))
files.append(fname)

elif self.build_recipe_type == BuildType.KIWI:
fname = f"{self.package_name}.kiwi"
tasks.append(
asyncio.ensure_future(
write_file_to_dest(
fname,
KIWI_TEMPLATE.render(
image=self, INFOHEADER=INFOHEADER_TEMPLATE
),
)
write_file_to_dest(
fname,
KIWI_TEMPLATE.render(image=self, INFOHEADER=INFOHEADER_TEMPLATE),
)
)
files.append(fname)

if self.config_sh:
tasks.append(
asyncio.ensure_future(
write_file_to_dest("config.sh", self.config_sh)
)
)
tasks.append(write_file_to_dest("config.sh", self.config_sh))
files.append("config.sh")

else:
Expand All @@ -1326,9 +1318,7 @@ async def write_file_to_dest(fname: str, contents: str | bytes) -> None:
), f"got an unexpected build_recipe_type: '{self.build_recipe_type}'"

tasks.append(
asyncio.ensure_future(
write_file_to_dest("_service", SERVICE_TEMPLATE.render(image=self))
)
write_file_to_dest("_service", SERVICE_TEMPLATE.render(image=self))
)

changes_file_name = self.package_name + ".changes"
Expand All @@ -1348,15 +1338,13 @@ async def write_file_to_dest(fname: str, contents: str | bytes) -> None:
):
name_to_include += f" {ver}"
tasks.append(
asyncio.ensure_future(
write_file_to_dest(
changes_file_name,
f"""-------------------------------------------------------------------
write_file_to_dest(
changes_file_name,
f"""-------------------------------------------------------------------
{datetime.datetime.now(tz=datetime.timezone.utc).strftime("%a %b %d %X %Z %Y")} - SUSE Update Bot <[email protected]>
- First version of the {name_to_include} BCI
""",
)
)
)
files.append(changes_file_name)
Expand Down

0 comments on commit 67c8e74

Please sign in to comment.