Beispiel #1
0
 private EnvironmentView(string id, string localizedName, string localizedHelpText)
 {
     Configuration     = new VisualStudioInterpreterConfiguration(id, id);
     Description       = LocalizedDisplayName = localizedName;
     LocalizedHelpText = localizedHelpText ?? "";
     Extensions        = new ObservableCollection <object>();
 }
Beispiel #2
0
        internal Task <VsProjectAnalyzer> CreateAnalyzerAsync(IPythonInterpreterFactory factory)
        {
            if (factory == null)
            {
                var configuration = new VisualStudioInterpreterConfiguration("AnalysisOnly|2.7", "Analysis Only 2.7", version: new Version(2, 7));
                factory = InterpreterFactoryCreator.CreateInterpreterFactory(configuration);
            }

            return(VsProjectAnalyzer.CreateDefaultAsync(EditorServices, factory));
        }
Beispiel #3
0
 public InterpreterPlaceholder(string id, string description)
 {
     Configuration = new VisualStudioInterpreterConfiguration(
         PlaceholderId + ";" + id.ToString(),
         description,
         null,
         null,
         null,
         null,
         InterpreterArchitecture.Unknown,
         new Version(),
         InterpreterUIMode.Normal
         );
 }
 public IronPythonAstInterpreterFactory(Dictionary <string, object> properties) :
     this(VisualStudioInterpreterConfiguration.CreateFromDictionary(properties), InterpreterFactoryCreationOptions.FromDictionary(properties))
 {
 }
 public IronPythonAstInterpreterFactory(VisualStudioInterpreterConfiguration config, InterpreterFactoryCreationOptions options)
     : base(config, options)
 {
 }
Beispiel #6
0
        public void Search(RegistryKey root, InterpreterArchitecture assumedArch)
        {
            if (root == null)
            {
                return;
            }

            var companies = GetSubkeys(root).Union(StoreAppCompanies);

            foreach (var company in companies)
            {
                if ("PyLauncher".Equals(company, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                bool pythonCore = PythonCoreCompany.Equals(company, StringComparison.OrdinalIgnoreCase);

                using (var companyKey = root.OpenSubKey(company))
                {
                    if (companyKey == null)
                    {
                        continue;
                    }

                    var companyDisplay    = companyKey.GetValue("DisplayName") as string;
                    var companySupportUrl = companyKey.GetValue("SupportUrl") as string;

                    if (pythonCore)
                    {
                        companyDisplay    = companyDisplay ?? PythonCoreCompanyDisplayName;
                        companySupportUrl = companySupportUrl ?? PythonCoreSupportUrl;
                    }
                    else
                    {
                        companyDisplay = companyDisplay ?? company;
                    }

                    var tags = GetSubkeys(companyKey).Union(StoreAppTags);
                    foreach (var tag in tags)
                    {
                        using (var tagKey = companyKey.OpenSubKey(tag))
                            using (var installKey = tagKey?.OpenSubKey("InstallPath"))
                            {
                                VisualStudioInterpreterConfiguration config = TryReadConfiguration(company, tag, tagKey, installKey, pythonCore, assumedArch);
                                if (config == null)
                                {
                                    continue;
                                }

                                if (_seenIds.Add(config.Id))
                                {
                                    var supportUrl = tagKey.GetValue("SupportUrl") as string ?? companySupportUrl;

                                    // We don't want to send people to http://python.org, even
                                    // if that's what is in the registry, so catch and fix it.
                                    if (!string.IsNullOrEmpty(supportUrl))
                                    {
                                        var url = supportUrl.TrimEnd('/');
                                        if (url.Equals("http://www.python.org", StringComparison.OrdinalIgnoreCase) ||
                                            url.Equals("http://python.org", StringComparison.OrdinalIgnoreCase))
                                        {
                                            supportUrl = PythonCoreSupportUrl;
                                        }
                                    }

                                    PythonInterpreterInformation info = new PythonInterpreterInformation(config, companyDisplay, companySupportUrl, supportUrl);
                                    _info.Add(info);
                                }
                            }
                    }
                }
            }

            InterpreterConfiguration.DisambiguateDescriptions(_info.Select(i => i.Configuration).ToArray());
        }