当前位置: 首页>>代码示例>>C#>>正文


C# PythonProjectNode.GetInterpreterFactory方法代码示例

本文整理汇总了C#中PythonProjectNode.GetInterpreterFactory方法的典型用法代码示例。如果您正苦于以下问题:C# PythonProjectNode.GetInterpreterFactory方法的具体用法?C# PythonProjectNode.GetInterpreterFactory怎么用?C# PythonProjectNode.GetInterpreterFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PythonProjectNode的用法示例。


在下文中一共展示了PythonProjectNode.GetInterpreterFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddVirtualEnvironmentView

        public AddVirtualEnvironmentView(
            PythonProjectNode project,
            IInterpreterRegistryService interpreterService,
            IPythonInterpreterFactory selectInterpreter
        ) {
            _interpreterService = interpreterService;
            _project = project;
            VirtualEnvBasePath = _projectHome = project.ProjectHome;
            Interpreters = new ObservableCollection<InterpreterView>(InterpreterView.GetInterpreters(project.Site, project));
            var selection = Interpreters.FirstOrDefault(v => v.Interpreter == selectInterpreter);
            if (selection == null) {
                selection = Interpreters.FirstOrDefault(v => v.Interpreter == project.GetInterpreterFactory())
                    ?? Interpreters.LastOrDefault();
            }
            BaseInterpreter = selection;

            _project.InterpreterFactoriesChanged += OnInterpretersChanged;

            var venvName = "env";
            for (int i = 1; Directory.Exists(Path.Combine(_projectHome, venvName)); ++i) {
                venvName = "env" + i.ToString();
            }
            VirtualEnvName = venvName;

            CanInstallRequirementsTxt = File.Exists(PathUtils.GetAbsoluteFilePath(_projectHome, "requirements.txt"));
            WillInstallRequirementsTxt = CanInstallRequirementsTxt;
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:27,代码来源:AddVirtualEnvironmentView.cs

示例2: CreateVirtualEnvironment

        internal static IPythonInterpreterFactory CreateVirtualEnvironment(string pythonVersion, VisualStudioApp app, PythonProjectNode pyProj) {
            var uiThread = app.ServiceProvider.GetUIThread();
            var task = uiThread.InvokeTask(() => {
                var model = app.GetService<IComponentModel>(typeof(SComponentModel));
                var service = model.GetService<IInterpreterRegistryService>();

                return pyProj.CreateOrAddVirtualEnvironment(
                    service,
                    true,
                    Path.Combine(pyProj.ProjectHome, "env"),
                    service.FindInterpreter("Global|PythonCore|" + pythonVersion + "-32"),
                    Version.Parse(pythonVersion) >= new Version(3, 3)
                );
            });
            try {
                Assert.IsTrue(task.Wait(TimeSpan.FromMinutes(2.0)), "Timed out waiting for venv");
            } catch (AggregateException ex) {
                throw ex.InnerException;
            }
            var factory = task.Result;
            Assert.IsTrue(uiThread.Invoke(() => factory.Configuration.Id == pyProj.GetInterpreterFactory().Configuration.Id));
            return factory;
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:23,代码来源:WebProjectTests.cs


注:本文中的PythonProjectNode.GetInterpreterFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。