Skip to content

Commit

Permalink
Use change_dir and srcpath where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa authored Apr 7, 2021
1 parent 93e9263 commit d743fe8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions easybuild/easyblocks/generic/packedbinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from easybuild.framework.easyblock import EasyBlock
from easybuild.easyblocks.generic.binary import Binary
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import copy
from easybuild.tools.filetools import change_dir, copy


class PackedBinary(Binary, EasyBlock):
Expand All @@ -46,16 +46,16 @@ def extract_step(self):

def install_step(self):
"""Copy all unpacked source files/directories to install directory, one-by-one."""
os.chdir(self.builddir)
change_dir(self.builddir)
for src in os.listdir(self.builddir):
srcpath = os.path.join(self.builddir, src)
# we only handle the case of a single file and no install_cmd here
if os.path.isfile(src) and self.cfg.get('install_cmd', None) is None:
if os.path.isfile(srcpath) and self.cfg.get('install_cmd', None) is None:
copy(srcpath, self.installdir)
else:
if os.path.isdir(src):
if os.path.isdir(srcpath):
self.cfg['start_dir'] = src
elif os.path.isfile(src):
elif os.path.isfile(srcpath):
self.cfg['start_dir'] = self.builddir
else:
raise EasyBuildError("Path %s is not a file nor a directory?", srcpath)
Expand Down

0 comments on commit d743fe8

Please sign in to comment.