Beispiel #1
0
        /// <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</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 = Path.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);
        }