Revision 57c177af lib/backend.py
b/lib/backend.py | ||
---|---|---|
962 | 962 |
return detail |
963 | 963 |
|
964 | 964 |
|
965 |
def _OSSearch(name, search_path=None): |
|
966 |
"""Search for OSes with the given name in the search_path. |
|
967 |
|
|
968 |
Args: |
|
969 |
name: The name of the OS to look for |
|
970 |
search_path: List of dirs to search (defaults to constants.OS_SEARCH_PATH) |
|
971 |
|
|
972 |
Returns: |
|
973 |
The base_dir the OS resides in |
|
974 |
|
|
975 |
""" |
|
976 |
if search_path is None: |
|
977 |
search_path = constants.OS_SEARCH_PATH |
|
978 |
|
|
979 |
for dir_name in search_path: |
|
980 |
t_os_dir = os.path.sep.join([dir_name, name]) |
|
981 |
if os.path.isdir(t_os_dir): |
|
982 |
return t_os_dir |
|
983 |
|
|
984 |
return None |
|
985 |
|
|
986 |
|
|
987 | 965 |
def _OSOndiskVersion(name, os_dir): |
988 | 966 |
"""Compute and return the API version of a given OS. |
989 | 967 |
|
... | ... | |
1073 | 1051 |
""" |
1074 | 1052 |
|
1075 | 1053 |
if base_dir is None: |
1076 |
os_dir = _OSSearch(name)
|
|
1054 |
os_dir = utils.FindFile(name, constants.OS_SEARCH_PATH, os.path.isdir)
|
|
1077 | 1055 |
if os_dir is None: |
1078 | 1056 |
raise errors.InvalidOS(name, None, "OS dir not found in search path") |
1079 | 1057 |
else: |
Also available in: Unified diff