/// <summary> /// Gets the default set of search paths based on the path to the root /// of the standard library. /// </summary> /// <param name="fs">File system</param> /// <param name="library">Root of the standard library.</param> /// <returns>A list of search paths for the interpreter.</returns> /// <remarks>New in 2.2, moved in 3.3</remarks> private static List <PythonLibraryPath> GetDefaultSearchPaths(IFileSystem fs, string library) { var result = new List <PythonLibraryPath>(); if (!Directory.Exists(library)) { return(result); } result.Add(new PythonLibraryPath(library, PythonLibraryPathType.StdLib)); var sitePackages = IOPath.Combine(library, "site-packages"); if (!Directory.Exists(sitePackages)) { return(result); } result.Add(new PythonLibraryPath(sitePackages)); result.AddRange(ModulePath.ExpandPathFiles(fs, sitePackages) .Select(p => new PythonLibraryPath(p)) ); return(result); }
/// <summary> /// Gets the default set of search paths based on the path to the root /// of the standard library. /// </summary> /// <param name="library">Root of the standard library.</param> /// <returns>A list of search paths for the interpreter.</returns> /// <remarks>New in 2.2, moved in 3.3</remarks> public static List <PythonLibraryPath> GetDefaultDatabaseSearchPaths(string library) { var result = new List <PythonLibraryPath>(); if (!Directory.Exists(library)) { return(result); } result.Add(new PythonLibraryPath(library, true, null)); var sitePackages = IOPath.Combine(library, "site-packages"); if (!Directory.Exists(sitePackages)) { return(result); } result.Add(new PythonLibraryPath(sitePackages, false, null)); result.AddRange(ModulePath.ExpandPathFiles(sitePackages) .Select(p => new PythonLibraryPath(p, false, null)) ); return(result); }
/// <summary> /// Gets the default set of search paths based on the path to the root /// of the standard library. /// </summary> /// <param name="fs">File system</param> /// <param name="library">Root of the standard library.</param> /// <returns>A list of search paths for the interpreter.</returns> /// <remarks>New in 2.2, moved in 3.3</remarks> private static ImmutableArray <PythonLibraryPath> GetDefaultSearchPaths(IFileSystem fs, string library) { var result = ImmutableArray <PythonLibraryPath> .Empty; if (!Directory.Exists(library)) { return(result); } result = result.Add(new PythonLibraryPath(library, PythonLibraryPathType.StdLib)); var sitePackages = IOPath.Combine(library, "site-packages"); if (!Directory.Exists(sitePackages)) { return(result); } result = result.Add(new PythonLibraryPath(sitePackages)); foreach (var pathFile in ModulePath.ExpandPathFiles(fs, sitePackages)) { result = result.Add(new PythonLibraryPath(pathFile)); } return(result); }