Skip to content

Commit

Permalink
Merge pull request #2 from boegel/allinea-templates+system.config-han…
Browse files Browse the repository at this point in the history
…dling

get rid of tabs, clarify use of shutil.copy + minor style fixes
  • Loading branch information
akesandgren authored Dec 8, 2016
2 parents d433ed3 + bc5edd1 commit f540531
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions easybuild/easyblocks/a/allinea.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import copy_file, adjust_permissions
from easybuild.tools.filetools import adjust_permissions, copy_file


class EB_Allinea(Binary):
Expand Down Expand Up @@ -84,29 +84,29 @@ def install_step(self):
# copy templates
templ_path = os.path.join(self.installdir, 'templates')
for templ in self.cfg['templates']:
path = self.obtain_file(templ, extension='qtf')
if path:
self.log.debug('Template file %s found' % path)
else:
raise EasyBuildError('No template file named %s found', templ)
path = self.obtain_file(templ, extension='qtf')
if path:
self.log.debug('Template file %s found' % path)
else:
raise EasyBuildError('No template file named %s found', templ)

try:
# use shutil.copy (not copy2) so that permissions of copied file match with rest of installation
shutil.copy(path, templ_path)
except OSError, err:
raise EasyBuildError("Failed to copy template %s to %s: %s", templ, templ_path, err)

# copy system.config if requested
sysconf_path = os.path.join(self.installdir, 'system.config')
if self.cfg['sysconfig'] is not None:
path = self.obtain_file(self.cfg['sysconfig'], extension=False)
if path:
self.log.debug('system.config file %s found' % path)
else:
raise EasyBuildError('No system.config file named %s found', sysconfig)

copy_file(path, sysconf_path)

adjust_permissions(sysconf_path, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH, recursive=False, relative=False)
sysconf_path = os.path.join(self.installdir, 'system.config')
if self.cfg['sysconfig'] is not None:
path = self.obtain_file(self.cfg['sysconfig'], extension=False)
if path:
self.log.debug('system.config file %s found' % path)
else:
raise EasyBuildError('No system.config file named %s found', sysconfig)

copy_file(path, sysconf_path)
adjust_permissions(sysconf_path, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH, recursive=False, relative=False)

def sanity_check_step(self):
"""Custom sanity check for Allinea."""
Expand Down

0 comments on commit f540531

Please sign in to comment.