OneapiPackage: do not use getpass.getuser (#45727)
* OneapiPackage: do not use getpass.getuser
This commit is contained in:
parent
586a35be43
commit
2b6bdc7013
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
"""Common utilities for managing intel oneapi packages."""
|
"""Common utilities for managing intel oneapi packages."""
|
||||||
import getpass
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
@ -13,6 +12,7 @@
|
|||||||
from llnl.util.filesystem import HeaderList, LibraryList, find_libraries, join_path, mkdirp
|
from llnl.util.filesystem import HeaderList, LibraryList, find_libraries, join_path, mkdirp
|
||||||
from llnl.util.link_tree import LinkTree
|
from llnl.util.link_tree import LinkTree
|
||||||
|
|
||||||
|
import spack.util.path
|
||||||
from spack.build_environment import dso_suffix
|
from spack.build_environment import dso_suffix
|
||||||
from spack.directives import conflicts, license, redistribute, variant
|
from spack.directives import conflicts, license, redistribute, variant
|
||||||
from spack.package_base import InstallError
|
from spack.package_base import InstallError
|
||||||
@ -99,7 +99,7 @@ def install_component(self, installer_path):
|
|||||||
# with other install depends on the userid. For root, we
|
# with other install depends on the userid. For root, we
|
||||||
# delete the installercache before and after install. For
|
# delete the installercache before and after install. For
|
||||||
# non root we redefine the HOME environment variable.
|
# non root we redefine the HOME environment variable.
|
||||||
if getpass.getuser() == "root":
|
if spack.util.path.get_user() == "root":
|
||||||
shutil.rmtree("/var/intel/installercache", ignore_errors=True)
|
shutil.rmtree("/var/intel/installercache", ignore_errors=True)
|
||||||
|
|
||||||
bash = Executable("bash")
|
bash = Executable("bash")
|
||||||
@ -122,7 +122,7 @@ def install_component(self, installer_path):
|
|||||||
self.prefix,
|
self.prefix,
|
||||||
)
|
)
|
||||||
|
|
||||||
if getpass.getuser() == "root":
|
if spack.util.path.get_user() == "root":
|
||||||
shutil.rmtree("/var/intel/installercache", ignore_errors=True)
|
shutil.rmtree("/var/intel/installercache", ignore_errors=True)
|
||||||
|
|
||||||
# Some installers have a bug and do not return an error code when failing
|
# Some installers have a bug and do not return an error code when failing
|
||||||
|
Loading…
Reference in New Issue
Block a user