Skip to content

Commit d743fe8

Browse files
author
ocaisa
authored
Use change_dir and srcpath where possible
1 parent 93e9263 commit d743fe8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

easybuild/easyblocks/generic/packedbinary.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from easybuild.framework.easyblock import EasyBlock
3333
from easybuild.easyblocks.generic.binary import Binary
3434
from easybuild.tools.build_log import EasyBuildError
35-
from easybuild.tools.filetools import copy
35+
from easybuild.tools.filetools import change_dir, copy
3636

3737

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

4747
def install_step(self):
4848
"""Copy all unpacked source files/directories to install directory, one-by-one."""
49-
os.chdir(self.builddir)
49+
change_dir(self.builddir)
5050
for src in os.listdir(self.builddir):
5151
srcpath = os.path.join(self.builddir, src)
5252
# we only handle the case of a single file and no install_cmd here
53-
if os.path.isfile(src) and self.cfg.get('install_cmd', None) is None:
53+
if os.path.isfile(srcpath) and self.cfg.get('install_cmd', None) is None:
5454
copy(srcpath, self.installdir)
5555
else:
56-
if os.path.isdir(src):
56+
if os.path.isdir(srcpath):
5757
self.cfg['start_dir'] = src
58-
elif os.path.isfile(src):
58+
elif os.path.isfile(srcpath):
5959
self.cfg['start_dir'] = self.builddir
6060
else:
6161
raise EasyBuildError("Path %s is not a file nor a directory?", srcpath)

0 commit comments

Comments
 (0)