diff options
author | Jose.Torres <Jose@RampageRobotics.com> | 2011-01-20 15:46:11 +0300 |
---|---|---|
committer | Lluis Sanchez <slluis.devel@gmail.com> | 2011-01-21 14:33:55 +0300 |
commit | f484495072eccd5b3ad57f3e89020c01f4726423 (patch) | |
tree | ccf161a1d49c8980d502fafdcf35e7ff40ac4e31 /extras/PyBinding | |
parent | af3e3120bd03fa3b35b6eb24ab947d4cdc264293 (diff) |
Added Python 2.7 Runtime Functionality
Diffstat (limited to 'extras/PyBinding')
5 files changed, 137 insertions, 12 deletions
diff --git a/extras/PyBinding/PyBinding/Makefile b/extras/PyBinding/PyBinding/Makefile index e1a2e54e3f..c5cb211b90 100644 --- a/extras/PyBinding/PyBinding/Makefile +++ b/extras/PyBinding/PyBinding/Makefile @@ -90,6 +90,7 @@ FILES = \ PyBinding.Runtime/IPythonRuntime.cs \ PyBinding.Runtime/Python25Runtime.cs \ PyBinding.Runtime/Python26Runtime.cs \ + PyBinding.Runtime/Python27Runtime.cs \ PyBinding/PythonConfiguration.cs \ PyBinding/PythonExecutionCommand.cs \ PyBinding/PythonExecutionHandler.cs \ @@ -122,6 +123,7 @@ EXTRAS = \ REFERENCES = \ Mono.Data.Sqlite \ Mono.Posix \ + -pkg:gdk-sharp-2.0 \ -pkg:glib-sharp-2.0 \ -pkg:gtk-sharp-2.0 \ -pkg:mono-addins \ diff --git a/extras/PyBinding/PyBinding/PyBinding.Gui/PythonOptionsWidget.cs b/extras/PyBinding/PyBinding/PyBinding.Gui/PythonOptionsWidget.cs index b23ce94228..5739f1261c 100644 --- a/extras/PyBinding/PyBinding/PyBinding.Gui/PythonOptionsWidget.cs +++ b/extras/PyBinding/PyBinding/PyBinding.Gui/PythonOptionsWidget.cs @@ -59,6 +59,7 @@ namespace PyBinding.Gui m_RuntimeCombo.Model = this.m_RuntimeListStore; m_RuntimeListStore.AppendValues ("Python 2.5", typeof (Python25Runtime)); m_RuntimeListStore.AppendValues ("Python 2.6", typeof (Python26Runtime)); + m_RuntimeListStore.AppendValues ("Python 2.7", typeof (Python27Runtime)); } public string DefaultModule { diff --git a/extras/PyBinding/PyBinding/PyBinding.Runtime/Python27Runtime.cs b/extras/PyBinding/PyBinding/PyBinding.Runtime/Python27Runtime.cs new file mode 100644 index 0000000000..27260a34e7 --- /dev/null +++ b/extras/PyBinding/PyBinding/PyBinding.Runtime/Python27Runtime.cs @@ -0,0 +1,118 @@ +// Python27Runtime.cs +// +// Copyright (c) 2009 Christian Hergert <chris@dronelabs.com> +// Python 2.7 Runtime Support by Jose.Torres <Jose@RampageRobotics.com> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.IO; + +using MonoDevelop.Core; +using MonoDevelop.Projects; +using MonoDevelop.Core.Serialization; +using MonoDevelop.Projects.CodeGeneration; + +using PyBinding.Compiler; + +namespace PyBinding.Runtime +{ + public class Python27Runtime : AbstractPythonRuntime + { + static readonly string m_Name = "Python27"; + static readonly string m_DefaultPath = "python2.7"; + + [ItemProperty("path")] + string m_Path = String.Empty; + + [ItemProperty("compiler", ValueType = typeof (IPythonCompiler))] + IPythonCompiler m_Compiler = null; + + public override IPythonCompiler Compiler { + get { + if (this.m_Compiler == null) + this.m_Compiler = new Python25Compiler (); + + // Give compiler a reference to this instance + // Reusing 2.5 compiler for now + (this.m_Compiler as Python25Compiler).Runtime = this; + + return this.m_Compiler; + } + } + + public override string Name { + get { + return m_Name; + } + } + + public override string Path { + get { + if (String.IsNullOrEmpty (this.m_Path)) + this.m_Path = this.Resolve (m_DefaultPath); + + return this.m_Path; + } + set { + this.m_Path = value; + } + } + + public override object Clone () + { + return new Python27Runtime () { + Path = this.Path + }; + } + + public override string[] GetArguments (PythonConfiguration config) + { + List<string> args = new List<string> (); + + if (config.Optimize) + args.Add ("-O"); + + if (config.DebugMode) + args.Add ("-d"); + + // Make sure python uses unbuffered files for stdin and stdout + // so that we can get updates to the console immediately. + args.Add ("-u"); + + // Add custom configuration arguments + if (!String.IsNullOrEmpty (config.PythonOptions)) + args.Add (config.PythonOptions); + + // The -m argument prevents any more argument passing to + // python. Therefore, it must be at the end of the list. + if (!String.IsNullOrEmpty (config.Module)) { + args.Add ("-m"); + args.Add (config.Module); + } + + // Append the user runtime options + if (!String.IsNullOrEmpty (config.CommandLineParameters)) + args.Add (config.CommandLineParameters); + + return args.ToArray (); + } + } +} diff --git a/extras/PyBinding/PyBinding/PyBinding.addin.xml b/extras/PyBinding/PyBinding/PyBinding.addin.xml index 08635694a1..389244acd4 100644 --- a/extras/PyBinding/PyBinding/PyBinding.addin.xml +++ b/extras/PyBinding/PyBinding/PyBinding.addin.xml @@ -6,7 +6,7 @@ url = "http://www.monodevelop.com" description = "Python Language binding" category = "Language bindings" - version = "2.6"> + version = "2.7"> <Runtime> <Import assembly = "PyBinding.dll"/> @@ -98,6 +98,7 @@ <DataType class = "PyBinding.PythonConfiguration"/> <DataType class = "PyBinding.Runtime.Python25Runtime"/> <DataType class = "PyBinding.Runtime.Python26Runtime"/> + <DataType class = "PyBinding.Runtime.Python27Runtime"/> <DataType class = "PyBinding.Compiler.Python25Compiler"/> </Extension> diff --git a/extras/PyBinding/PyBinding/PyBinding.csproj b/extras/PyBinding/PyBinding/PyBinding.csproj index 460c401311..9247758215 100644 --- a/extras/PyBinding/PyBinding/PyBinding.csproj +++ b/extras/PyBinding/PyBinding/PyBinding.csproj @@ -42,6 +42,7 @@ <Reference Include="System.Xml" /> <Reference Include="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"> <SpecificVersion>False</SpecificVersion> + <Package>mono-addins</Package> </Reference> <Reference Include="Mono.Posix" /> <Reference Include="Mono.Cecil, Version=0.6.8.8607, Culture=neutral"> @@ -65,10 +66,9 @@ <Reference Include="MonoDevelop.Autotools, Version=1.9.2.0, Culture=neutral"> <Package>monodevelop-core-addins</Package> </Reference> - <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> + <Package>gtk-sharp-2.0</Package> + </Reference> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> @@ -116,22 +116,24 @@ <Package>monodevelop-core-addins</Package> </Reference> <Reference Include="System.Data" /> - <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> + <Package>glib-sharp-2.0</Package> + </Reference> <Reference Include="MonoDevelop.Moonlight, Version=2.2.0.0, Culture=neutral"> <Package>monodevelop-core-addins</Package> </Reference> <Reference Include="MonoDevelop.Debugger.Soft, Version=2.2.0.0, Culture=neutral"> <Package>monodevelop-core-addins</Package> </Reference> - <Reference Include="Mono.Debugging.Soft, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1968fe265398bfbb"> - <Package>monodevelop-core-addins</Package> - </Reference> - <Reference Include="Mono.Debugging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=43ec5927c50c544e"> + <Reference Include="Mono.Debugging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=5e9ce85b0923c84f"> <Package>monodevelop</Package> </Reference> - <Reference Include="Mono.Debugger.Soft, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"> + <Reference Include="Mono.Debugging.Soft, Version=0.0.0.0, Culture=neutral, PublicKeyToken=5e9ce85b0923c84f"> <Package>monodevelop-core-addins</Package> </Reference> + <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> + <Package>gdk-sharp-2.0</Package> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="AssemblyInfo.cs" /> @@ -180,6 +182,7 @@ <Compile Include="PyBinding.Parser\ParserManager.cs" /> <Compile Include="PyBinding.Parser\PythonResolver.cs" /> <Compile Include="PyBinding.Parser\PythonExpressionFinder.cs" /> + <Compile Include="PyBinding.Runtime\Python27Runtime.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\EmptyPyProject.xpt.xml"> @@ -227,7 +230,7 @@ <MonoDevelop> <Properties> <Policies> - <StandardHeader Text="${FileName}

Copyright (c) ${Year} ${CopyrightHolder}

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE." inheritsSet="Apache2License" /> + <StandardHeader Text="${FileName}

Copyright (c) ${Year} ${CopyrightHolder}

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE." IncludeInNewFiles="True" /> <TextStylePolicy NoTabsAfterNonTabs="True" RemoveTrailingWhitespace="True" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-python" /> </Policies> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile" CleanTargetName="" SyncReferences="true"> |