Skip to content

Commit

Permalink
Replace cp --parents with bash script for macOS compatibility (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhikdps authored Nov 11, 2024
1 parent e5b8fa5 commit c58b014
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/tox_ansible/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@

ALLOWED_EXTERNALS = [
"bash",
"sh",
"cp",
"git",
"rm",
"mkdir",
"cd",
"echo",
"dirname",
]
ENV_LIST = """
{integration, sanity, unit}-py3.9-{2.15}
Expand Down Expand Up @@ -519,8 +521,13 @@ def conf_commands_pre(
group = "echo ::group::Copy the collection to the galaxy build dir"
commands.append(group)
cd_tox_dir = f"cd {TOX_WORK_DIR}"
copy_cmd = f"cp -r --parents $(git ls-files 2> /dev/null || ls) {galaxy_build_dir}"
full_cmd = f"bash -c '{cd_tox_dir} && {copy_cmd}'"
copy_script = (
f"for file in $(git ls-files 2> /dev/null || ls); do\n\t"
f"mkdir -p {galaxy_build_dir}/$(dirname $file);\n\t"
f"cp -r $file {galaxy_build_dir}/$file;\n"
"done"
)
full_cmd = f"sh -c '{cd_tox_dir} && {copy_script}'"
commands.append(full_cmd)
if in_action():
commands.append(end_group)
Expand Down

0 comments on commit c58b014

Please sign in to comment.