ignore large folders during stage creation

This commit is contained in:
aj 2020-07-01 11:30:48 +01:00
parent b6a7d3afe3
commit 12c4894820

11
admin
View File

@ -8,6 +8,8 @@ stage_dir = '_playlist-manager'
scss_rel_path = os.path.join('src', 'scss', 'style.scss') scss_rel_path = os.path.join('src', 'scss', 'style.scss')
css_rel_path = os.path.join('build', 'style.css') css_rel_path = os.path.join('build', 'style.css')
folders_to_ignore = ['venv', 'docs', '.git', '.idea', 'node_modules']
class Admin(Cmd): class Admin(Cmd):
intro = 'Music Tools Admin... ? for help' intro = 'Music Tools Admin... ? for help'
@ -21,7 +23,11 @@ class Admin(Cmd):
shutil.rmtree(stage_dir, ignore_errors=True) shutil.rmtree(stage_dir, ignore_errors=True)
print('>> copying main source') print('>> copying main source')
shutil.copytree('playlist-manager', stage_dir) shutil.copytree('playlist-manager',
stage_dir,
ignore=lambda path, contents:
contents if any(i in path.split('/') for i in folders_to_ignore) else []
)
for dependency in ['spotframework', 'fmframework', 'spotfm']: for dependency in ['spotframework', 'fmframework', 'spotfm']:
print(f'>> injecting {dependency}') print(f'>> injecting {dependency}')
@ -51,8 +57,9 @@ class Admin(Cmd):
f'--timeout={timeout}s') f'--timeout={timeout}s')
def do_api(self, args): def do_api(self, args):
self.prepare_stage()
self.prepare_frontend() self.prepare_frontend()
self.prepare_stage()
self.prepare_main('api') self.prepare_main('api')
print('>> deploying') print('>> deploying')