Exemple #1
0
        private static ProjectItemElement AddVirtualEnvironment(
            ProjectRootElement project,
            string sourcePath,
            string id,
            InterpreterConfiguration config
            )
        {
            var prefixPath      = config.GetPrefixPath() ?? string.Empty;
            var interpreterPath = string.IsNullOrEmpty(config.InterpreterPath) ?
                                  string.Empty :
                                  PathUtils.GetRelativeFilePath(prefixPath, config.InterpreterPath);
            var windowInterpreterPath = string.IsNullOrEmpty(config.GetWindowsInterpreterPath()) ?
                                        string.Empty :
                                        PathUtils.GetRelativeFilePath(prefixPath, config.GetWindowsInterpreterPath());

            prefixPath = PathUtils.GetRelativeDirectoryPath(sourcePath, prefixPath);

            return(project.AddItem(
                       MSBuildConstants.InterpreterItem,
                       prefixPath,
                       new Dictionary <string, string> {
                { MSBuildConstants.IdKey, id },
                { MSBuildConstants.DescriptionKey, config.Description },
                { MSBuildConstants.InterpreterPathKey, interpreterPath },
                { MSBuildConstants.WindowsPathKey, windowInterpreterPath },
                { MSBuildConstants.VersionKey, config.Version.ToString() },
                { MSBuildConstants.ArchitectureKey, config.Architecture.ToString("X") },
                { MSBuildConstants.PathEnvVarKey, config.PathEnvironmentVariable }
            }
                       ));
        }
 private void SetCustomVariables(InterpreterConfiguration config)
 {
     Description             = config.Description;
     InterpreterPath         = config.InterpreterPath;
     WindowsInterpreterPath  = config.GetWindowsInterpreterPath();
     ArchitectureName        = config.ArchitectureString;
     VersionName             = config.Version.ToString();
     PathEnvironmentVariable = config.PathEnvironmentVariable;
 }
        public string GetInterpreterPath()
        {
            if (!string.IsNullOrEmpty(InterpreterPath))
            {
                return(InterpreterPath);
            }

            if (_config == null)
            {
                return(null);
            }

            if (PreferWindowedInterpreter && !string.IsNullOrEmpty(_config.GetWindowsInterpreterPath()))
            {
                return(_config.GetWindowsInterpreterPath());
            }

            return(_config.InterpreterPath);
        }
Exemple #4
0
 private void UpdateResultFromConfiguration(InterpreterConfiguration config, string projectHome)
 {
     PrefixPath = PathUtils.EnsureEndSeparator(config.GetPrefixPath());
     if (PathUtils.IsSubpathOf(projectHome, PrefixPath))
     {
         ProjectRelativePrefixPath = PathUtils.GetRelativeDirectoryPath(projectHome, PrefixPath);
     }
     else
     {
         ProjectRelativePrefixPath = string.Empty;
     }
     InterpreterPath         = config.InterpreterPath;
     WindowsInterpreterPath  = config.GetWindowsInterpreterPath();
     Architecture            = config.Architecture.ToString("X");
     PathEnvironmentVariable = config.PathEnvironmentVariable;
     Description             = config.Description;
     MajorVersion            = config.Version.Major.ToString();
     MinorVersion            = config.Version.Minor.ToString();
 }