bugfix: fix macos incompatibility in lock test (#8573)
- Spack was assuming that a group with gid == current uid would always exist. - This was breaking the travis build for macos. - also fix issue with the DB tarball test finding coverage filesx
This commit is contained in:

committed by
Massimiliano Culpo

parent
bdd5aab8be
commit
a48bdfaf1d
@@ -27,8 +27,10 @@
|
||||
import hashlib
|
||||
import fileinput
|
||||
import glob
|
||||
import grp
|
||||
import numbers
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
import shutil
|
||||
import stat
|
||||
@@ -212,6 +214,21 @@ def set_install_permissions(path):
|
||||
os.chmod(path, 0o644)
|
||||
|
||||
|
||||
def group_ids(uid=None):
|
||||
"""Get group ids that a uid is a member of.
|
||||
|
||||
Arguments:
|
||||
uid (int): id of user, or None for current user
|
||||
|
||||
Returns:
|
||||
(list of int): gids of groups the user is a member of
|
||||
"""
|
||||
if uid is None:
|
||||
uid = os.getuid()
|
||||
user = pwd.getpwuid(uid).pw_name
|
||||
return [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
|
||||
|
||||
|
||||
def copy_mode(src, dest):
|
||||
"""Set the mode of dest to that of src unless it is a link.
|
||||
"""
|
||||
|
Reference in New Issue
Block a user