1 // PythonLanguageBinding.cs
3 // This file was derived from a file from #Develop.
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 using System
.Diagnostics
;
24 using System
.Collections
;
25 using System
.Reflection
;
26 using System
.Resources
;
28 using System
.CodeDom
.Compiler
;
29 using System
.Threading
;
32 using MonoDevelop
.Projects
;
33 using MonoDevelop
.Core
.Gui
;
35 namespace PythonBinding
37 public class PythonLanguageBinding
: IDotNetLanguageBinding
39 public const string LanguageName
= "Python";
41 PythonExecutionManager executionManager
= new PythonExecutionManager();
42 PythonCompilerManager compilerManager
= new PythonCompilerManager();
44 public string Language
{
50 public void Execute(string filename
)
52 Execute (filename
, false);
55 public void Execute(string filename
, bool debug
)
57 Debug
.Assert(executionManager
!= null);
58 executionManager
.Execute(filename
, debug
);
61 public void Execute (IProject project
)
63 Execute (project
, false);
66 public void DebugProject (IProject project
)
68 Execute (project
, true);
71 public void Execute(IProject project
, bool debug
)
73 Debug
.Assert(executionManager
!= null);
74 executionManager
.Execute(project
, debug
);
77 public string GetCompiledOutputName(string fileName
)
79 Debug
.Assert(compilerManager
!= null);
80 return compilerManager
.GetCompiledOutputName(fileName
);
83 public string GetCompiledOutputName(IProject project
)
85 Debug
.Assert(compilerManager
!= null);
86 return compilerManager
.GetCompiledOutputName(project
);
89 public bool IsSourceCodeFile (string fileName
)
91 Debug
.Assert(compilerManager
!= null);
92 return compilerManager
.CanCompile(fileName
);
95 public BuildResult
CompileFile(string fileName
)
97 Debug
.Assert(compilerManager
!= null);
98 PythonCompilerParameters param
= new PythonCompilerParameters();
99 param
.OutputAssembly
= Path
.ChangeExtension(fileName
, ".exe");
100 return compilerManager
.CompileFile(fileName
, param
);
103 public BuildResult
CompileProject(IProject project
)
105 Debug
.Assert(compilerManager
!= null);
106 return compilerManager
.CompileProject(project
);
109 public BuildResult
RecompileProject(IProject project
)
111 return CompileProject(project
);
114 public IProject
CreateProject(ProjectCreateInformation info
, XmlElement projectOptions
)
116 return new PythonProject(info
, projectOptions
);
119 public void GenerateMakefile (IProject project
, Combine parentCombine
)
121 throw new NotImplementedException ();
124 public string CommentTag