Skip to content

Commit

Permalink
fix: wildcard is not expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Apr 10, 2021
1 parent 425701a commit dd99867
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ class Command:
def __init__(self, command_args):
self.console = Console(command_args.args.verbose)

def _run_command(self, command_list):
def _run_command(self, command_list, shell=False):
self.console.v(f"Running `{' '.join(command_list)}`")

if shell:
return subprocess.run(' '.join(command_list), check=True, shell=shell)

return subprocess.run(command_list, check=True)

def _copy(self, source, dest, mode=0o755):
Expand All @@ -61,7 +65,8 @@ def _copytree(self, source, dest):
self.console.v(f"Creating '{dest}'...")
os.makedirs(dest, 0o755)

shutil.copytree(source, dest, dirs_exist_ok=True)
# `shutil.copytree` fails on Windows if target file exists, so run `cp -r` instead.
self._run_command(['cp', '-r', f'{source}/*', dest], shell=True)

def _remove(self, path):
self.console.v(f"Removing '{path}'...")
Expand Down Expand Up @@ -153,7 +158,7 @@ def run(self):

self.console.info('Installing...')
# _copytree fails on Windows, so run `cp -r` instead.
self._run_command(['cp', '-r', f'{_BUILD_PATH}/*', _INSTALL_PATH])
self._copytree(_BUILD_PATH, _INSTALL_PATH)
self.console.info('Installed')

def _is_windows(self):
Expand Down

0 comments on commit dd99867

Please sign in to comment.