Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _generate_resources():
"""
Copy the data files from src/main/resources to ${freeze_dir}.
Automatically filters files mentioned in the setting files_to_filter:
Placeholders such as ${app_name} are automatically replaced by the
corresponding setting in files on that list.
"""
freeze_dir = path('${freeze_dir}')
if is_mac():
resources_dest_dir = join(freeze_dir, 'Contents', 'Resources')
else:
resources_dest_dir = freeze_dir
for path_fn in default_path, path:
for profile in LOADED_PROFILES:
_copy(path_fn, 'src/main/resources/' + profile, resources_dest_dir)
_copy(path_fn, 'src/freeze/' + profile, freeze_dir)
def _generate_resources():
"""
Copy the data files from src/main/resources to ${freeze_dir}.
Automatically filters files mentioned in the setting files_to_filter:
Placeholders such as ${app_name} are automatically replaced by the
corresponding setting in files on that list.
"""
freeze_dir = path('${freeze_dir}')
if is_mac():
resources_dest_dir = join(freeze_dir, 'Contents', 'Resources')
else:
resources_dest_dir = freeze_dir
for path_fn in default_path, path:
for profile in LOADED_PROFILES:
_copy(path_fn, 'src/main/resources/' + profile, resources_dest_dir)
_copy(path_fn, 'src/freeze/' + profile, freeze_dir)
require_existing_project()
build_dir = path('target/%s-docker-image' % name)
if exists(build_dir):
rmtree(build_dir)
src_root = 'src/build/docker'
available_vms = set(listdir(default_path(src_root)))
if exists(path(src_root)):
available_vms.update(listdir(path(src_root)))
if name not in available_vms:
raise FbsError(
'Could not find %s. Available VMs are:%s' %
(name, ''.join(['\n * ' + vm for vm in available_vms]))
)
src_dir = src_root + '/' + name
for path_fn in default_path, path:
_copy(path_fn, src_dir, build_dir)
settings = SETTINGS['docker_images'].get(name, {})
for path_fn in default_path, path:
for p in settings.get('build_files', []):
_copy(path_fn, p, build_dir)
args = ['build', '--pull', '-t', _get_docker_id(name), build_dir]
for arg, value in settings.get('build_args', {}).items():
args.extend(['--build-arg', '%s=%s' % (arg, value)])
try:
_run_docker(
args, check=True, stdout=PIPE, stderr=PIPE,
universal_newlines=True
)
except CalledProcessError as e:
if '/private-key.gpg: no such file or directory' in e.stderr:
message = 'Could not find private-key.gpg. Maybe you want to ' \
'run:\n fbs gengpgkey'
src_root = 'src/build/docker'
available_vms = set(listdir(default_path(src_root)))
if exists(path(src_root)):
available_vms.update(listdir(path(src_root)))
if name not in available_vms:
raise FbsError(
'Could not find %s. Available VMs are:%s' %
(name, ''.join(['\n * ' + vm for vm in available_vms]))
)
src_dir = src_root + '/' + name
for path_fn in default_path, path:
_copy(path_fn, src_dir, build_dir)
settings = SETTINGS['docker_images'].get(name, {})
for path_fn in default_path, path:
for p in settings.get('build_files', []):
_copy(path_fn, p, build_dir)
args = ['build', '--pull', '-t', _get_docker_id(name), build_dir]
for arg, value in settings.get('build_args', {}).items():
args.extend(['--build-arg', '%s=%s' % (arg, value)])
try:
_run_docker(
args, check=True, stdout=PIPE, stderr=PIPE,
universal_newlines=True
)
except CalledProcessError as e:
if '/private-key.gpg: no such file or directory' in e.stderr:
message = 'Could not find private-key.gpg. Maybe you want to ' \
'run:\n fbs gengpgkey'
else:
message = e.stdout + '\n' + e.stderr
raise FbsError(message)
_LOG.info('Done. You can now execute:\n fbs runvm ' + name)
def _generate_installer_resources():
for path_fn in default_path, path:
for profile in LOADED_PROFILES:
_copy(path_fn, 'src/installer/' + profile, path('target/installer'))