Esempio n. 1
0
        private static PythonVersion GetIronPythonVersion(bool x64)
        {
            var exeName = x64 ? "ipy64.exe" : "ipy.exe";

            var installPath = IronPythonResolver.GetPythonInstallDir();

            if (Directory.Exists(installPath))
            {
                // IronPython changed to Any CPU for ipy.exe and ipy32.exe for 32-bit in 2.7.8
                if (File.Exists(Path.Combine(installPath, "ipy32.exe")))
                {
                    exeName = x64 ? "ipy.exe" : "ipy32.exe";
                }

                return(new PythonVersion(
                           new InterpreterConfiguration(
                               x64 ? "IronPython|2.7-64" : "IronPython|2.7-32",
                               string.Format("IronPython {0} 2.7", x64 ? "64-bit" : "32-bit"),
                               installPath,
                               Path.Combine(installPath, exeName),
                               arch: x64?InterpreterArchitecture.x64: InterpreterArchitecture.x86,
                               version: new Version(2, 7),
                               pathVar: "IRONPYTHONPATH"
                               ),
                           ironPython: true
                           ));
            }

            return(null);
        }
Esempio n. 2
0
        internal static VisualStudioInterpreterConfiguration GetConfiguration(InterpreterArchitecture arch)
        {
            var prefixPath = IronPythonResolver.GetPythonInstallDir();

            if (string.IsNullOrEmpty(prefixPath))
            {
                return(null);
            }

            // IronPython 2.7.8 changed the executable names for 64-bit vs 32-bit
            var ipyExe  = arch == InterpreterArchitecture.x64 ? "ipy64.exe" : "ipy.exe";
            var ipywExe = arch == InterpreterArchitecture.x64 ? "ipyw64.exe" : "ipyw.exe";

            if (File.Exists(Path.Combine(prefixPath, "ipy32.exe")))
            {
                ipyExe  = arch == InterpreterArchitecture.x64 ? "ipy.exe" : "ipy32.exe";
                ipywExe = arch == InterpreterArchitecture.x64 ? "ipyw.exe" : "ipyw32.exe";
            }

            return(new VisualStudioInterpreterConfiguration(
                       GetInterpreterId(arch),
                       string.Format("IronPython 2.7{0: ()}", arch),
                       prefixPath,
                       Path.Combine(prefixPath, ipyExe),
                       Path.Combine(prefixPath, ipywExe),
                       "IRONPYTHONPATH",
                       arch,
                       new Version(2, 7),
                       InterpreterUIMode.SupportsDatabase
                       ));
        }
Esempio n. 3
0
 internal static void Initialize(string[] args)
 {
     if (args.Length > 0 && Directory.Exists(args[0]))
     {
         IronPythonResolver resolver = new IronPythonResolver(args[0]);
         AppDomain.CurrentDomain.AssemblyResolve += resolver.domain_AssemblyResolve;
     }
 }
Esempio n. 4
0
 private void DiscoverInterpreterFactories()
 {
     if (_config == null && IronPythonResolver.GetPythonInstallDir() != null)
     {
         _config = GetConfiguration(InterpreterArchitecture.x86);
         if (Environment.Is64BitOperatingSystem)
         {
             _configX64 = GetConfiguration(InterpreterArchitecture.x64);
         }
         InterpreterFactoriesChanged?.Invoke(this, EventArgs.Empty);
     }
 }