Beispiel #1
0
        public PipPackageManager(
            IPythonInterpreterFactory factory,
            PipPackageManagerCommands commands,
            int priority,
            ICondaLocatorProvider condaLocatorProvider
            )
        {
            _packages = new List <PackageSpec>();
            _pipListHasFormatOption = true;

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (!File.Exists(factory.Configuration?.InterpreterPath))
            {
                throw new NotSupportedException();
            }

            _factory              = factory;
            _commands             = commands ?? new PipPackageManagerCommands();
            Priority              = priority;
            _condaLocatorProvider = condaLocatorProvider;
            _cache = PipPackageCache.GetCache();
        }
Beispiel #2
0
        public void SetInterpreterFactory(IPythonInterpreterFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (!File.Exists(factory.Configuration?.InterpreterPath))
            {
                throw new NotSupportedException();
            }

            _factory = factory;

            _cache = PipPackageCache.GetCache();

            if (_libWatchers != null)
            {
                CreateLibraryWatchers().DoNotWait();
            }

            Task.Delay(100).ContinueWith(async t => {
                try {
                    await UpdateIsReadyAsync(false, CancellationToken.None);
                } catch (OperationCanceledException) {
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    Debug.Fail(ex.ToUnhandledExceptionMessage(GetType()));
                }
            }).DoNotWait();
        }
Beispiel #3
0
        public void SetInterpreterFactory(IPythonInterpreterFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (!File.Exists(factory.Configuration?.InterpreterPath))
            {
                throw new NotSupportedException();
            }

            _factory = factory;

            _cache = PipPackageCache.GetCache(new Uri("https://pypi.python.org/pypi/"));

            if (_libWatchers != null)
            {
                CreateLibraryWatchers().DoNotWait();
            }
            _refreshIsCurrentTrigger?.Change(1000, Timeout.Infinite);
        }