diff --git a/.gitignore b/.gitignore index 1e494b12d..cc12c36c4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.dll *.exe *.pdb +pythonnet/dlls/ ### JetBrains ### .idea/ diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 5210cd6c9..000000000 --- a/NuGet.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Python.Loader/InternalDllImportResolver.cs b/Python.Loader/InternalDllImportResolver.cs new file mode 100644 index 000000000..be2b4dce9 --- /dev/null +++ b/Python.Loader/InternalDllImportResolver.cs @@ -0,0 +1,16 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +namespace Python.Loader +{ + public static class InternalDllImportResolver + { + public static IntPtr Resolve(string libraryName, Assembly assembly, int? flags) { + if (libraryName == "__Internal") { + + } + } + + } +} diff --git a/Python.Loader/Loader.cs b/Python.Loader/Loader.cs new file mode 100644 index 000000000..a35bfbdb1 --- /dev/null +++ b/Python.Loader/Loader.cs @@ -0,0 +1,109 @@ +using System.Runtime.InteropServices; +using System.Text; +using System; +using System.IO; +using System.Reflection; +using Mono.Cecil; + +namespace Python.Loader +{ + public class RuntimeLoader + { + AssemblyDefinition assembly; + + static public RuntimeLoader FromFile(string filename) + { + return new RuntimeLoader(File.OpenRead(filename)); + } + + public RuntimeLoader(Stream stream) + { + assembly = AssemblyDefinition.ReadAssembly(stream, new ReaderParameters + { + InMemory = true, + }); + } + + public void Remap(string pythonDll) + { + var moduleRef = new ModuleReference(pythonDll); + + var module = assembly.MainModule; + module.ModuleReferences.Add(moduleRef); + + foreach (var type in module.Types) + { + foreach (var func in type.Methods) + { + if (func.HasPInvokeInfo) + { + var info = func.PInvokeInfo; + if (info.Module.Name == "__Internal") + { + info.Module = moduleRef; + } + } + } + } + } + + public Assembly LoadAssembly() + { + using (var stream = new MemoryStream()) + { + assembly.Write(stream); + return Assembly.Load(stream.ToArray()); + } + } + } + + static class Internal + { + static Type PythonEngine = null; + + public static int Initialize(IntPtr data, int size) + { + try + { + var buf = new byte[size]; + Marshal.Copy(data, buf, 0, size); + var str = UTF8Encoding.Default.GetString(buf); + + var splitted = str.Split(';'); + + var dllPath = splitted[0]; + var pythonDll = splitted[1]; + + var loader = RuntimeLoader.FromFile(dllPath); + loader.Remap(pythonDll); + var assembly = loader.LoadAssembly(); + + PythonEngine = assembly.GetType("Python.Runtime.PythonEngine"); + var method = PythonEngine.GetMethod("InternalInitialize"); + return (int)method.Invoke(null, new object[] { data, size }); + } + catch (Exception exc) + { + Console.WriteLine($"{exc}\n{exc.StackTrace}"); + return -1; + } + } + + public static int Shutdown(IntPtr data, int size) + { + if (PythonEngine == null) + return -2; + + try + { + var method = PythonEngine.GetMethod("InternalShutdown"); + return (int)method.Invoke(null, new object[] { data, size }); + } + catch (Exception exc) + { + Console.WriteLine($"{exc}\n{exc.StackTrace}"); + return -1; + } + } + } +} diff --git a/Python.Loader/Python.Loader.csproj b/Python.Loader/Python.Loader.csproj new file mode 100644 index 000000000..2a875c498 --- /dev/null +++ b/Python.Loader/Python.Loader.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp3.1 + true + + + + + + + + diff --git a/Python.Runtime/AssemblyInfo.cs b/Python.Runtime/AssemblyInfo.cs new file mode 100644 index 000000000..a369d6c8e --- /dev/null +++ b/Python.Runtime/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Python.Test.Embed")] diff --git a/src/runtime/BorrowedReference.cs b/Python.Runtime/BorrowedReference.cs similarity index 100% rename from src/runtime/BorrowedReference.cs rename to Python.Runtime/BorrowedReference.cs diff --git a/src/runtime/Codecs/TupleCodecs.cs b/Python.Runtime/Codecs/TupleCodecs.cs similarity index 100% rename from src/runtime/Codecs/TupleCodecs.cs rename to Python.Runtime/Codecs/TupleCodecs.cs diff --git a/src/runtime/CustomMarshaler.cs b/Python.Runtime/CustomMarshaler.cs similarity index 94% rename from src/runtime/CustomMarshaler.cs rename to Python.Runtime/CustomMarshaler.cs index b51911816..ec6898c53 100644 --- a/src/runtime/CustomMarshaler.cs +++ b/Python.Runtime/CustomMarshaler.cs @@ -91,9 +91,11 @@ public static int GetUnicodeByteLength(IntPtr p) var len = 0; while (true) { - int c = Runtime._UCS == 2 - ? Marshal.ReadInt16(p, len * 2) - : Marshal.ReadInt32(p, len * 4); +#if UCS2 + int c = Marshal.ReadInt16(p, len * 2); +#else + int c = Marshal.ReadInt32(p, len * 4); +#endif if (c == 0) { @@ -120,9 +122,11 @@ public static int GetUnicodeByteLength(IntPtr p) /// public static IntPtr Py3UnicodePy2StringtoPtr(string s) { - return Runtime.IsPython3 - ? Instance.MarshalManagedToNative(s) - : Marshal.StringToHGlobalAnsi(s); +#if PYTHON2 + return Marshal.StringToHGlobalAnsi(s); +#else + return Instance.MarshalManagedToNative(s); +#endif } /// @@ -137,9 +141,11 @@ public static IntPtr Py3UnicodePy2StringtoPtr(string s) /// public static string PtrToPy3UnicodePy2String(IntPtr p) { - return Runtime.IsPython3 - ? PtrToStringUni(p) - : Marshal.PtrToStringAnsi(p); +#if PYTHON2 + return Marshal.PtrToStringAnsi(p); +#else + return PtrToStringUni(p); +#endif } } diff --git a/src/runtime/NewReference.cs b/Python.Runtime/NewReference.cs similarity index 100% rename from src/runtime/NewReference.cs rename to Python.Runtime/NewReference.cs diff --git a/src/runtime/NonCopyableAttribute.cs b/Python.Runtime/NonCopyableAttribute.cs similarity index 100% rename from src/runtime/NonCopyableAttribute.cs rename to Python.Runtime/NonCopyableAttribute.cs diff --git a/Python.Runtime/Python.Runtime.csproj b/Python.Runtime/Python.Runtime.csproj new file mode 100644 index 000000000..7b0a9e07d --- /dev/null +++ b/Python.Runtime/Python.Runtime.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + true + + + + + clr.py + + + + + + + + diff --git a/src/runtime/ReferenceExtensions.cs b/Python.Runtime/ReferenceExtensions.cs similarity index 100% rename from src/runtime/ReferenceExtensions.cs rename to Python.Runtime/ReferenceExtensions.cs diff --git a/src/runtime/Util.cs b/Python.Runtime/Util.cs similarity index 100% rename from src/runtime/Util.cs rename to Python.Runtime/Util.cs diff --git a/src/runtime/arrayobject.cs b/Python.Runtime/arrayobject.cs similarity index 100% rename from src/runtime/arrayobject.cs rename to Python.Runtime/arrayobject.cs diff --git a/src/runtime/assemblymanager.cs b/Python.Runtime/assemblymanager.cs similarity index 100% rename from src/runtime/assemblymanager.cs rename to Python.Runtime/assemblymanager.cs diff --git a/src/runtime/classbase.cs b/Python.Runtime/classbase.cs similarity index 100% rename from src/runtime/classbase.cs rename to Python.Runtime/classbase.cs diff --git a/src/runtime/classderived.cs b/Python.Runtime/classderived.cs similarity index 100% rename from src/runtime/classderived.cs rename to Python.Runtime/classderived.cs diff --git a/src/runtime/classmanager.cs b/Python.Runtime/classmanager.cs similarity index 100% rename from src/runtime/classmanager.cs rename to Python.Runtime/classmanager.cs diff --git a/src/runtime/classobject.cs b/Python.Runtime/classobject.cs similarity index 100% rename from src/runtime/classobject.cs rename to Python.Runtime/classobject.cs diff --git a/src/runtime/clrobject.cs b/Python.Runtime/clrobject.cs similarity index 100% rename from src/runtime/clrobject.cs rename to Python.Runtime/clrobject.cs diff --git a/src/runtime/codegenerator.cs b/Python.Runtime/codegenerator.cs similarity index 57% rename from src/runtime/codegenerator.cs rename to Python.Runtime/codegenerator.cs index dc466bafb..d5c03aa18 100644 --- a/src/runtime/codegenerator.cs +++ b/Python.Runtime/codegenerator.cs @@ -13,16 +13,40 @@ namespace Python.Runtime /// internal class CodeGenerator { - private AssemblyBuilder aBuilder; - private ModuleBuilder mBuilder; + private AssemblyBuilder _aBuilder = null; - internal CodeGenerator() + private AssemblyBuilder aBuilder + { + get + { + if (_aBuilder == null) + { + var aname = new AssemblyName { Name = "__CodeGenerator_Assembly" }; + var aa = AssemblyBuilderAccess.Run; + + _aBuilder = Thread.GetDomain().DefineDynamicAssembly(aname, aa); + } + + return _aBuilder; + } + } + + private ModuleBuilder _mBuilder = null; + private ModuleBuilder mBuilder { - var aname = new AssemblyName { Name = "__CodeGenerator_Assembly" }; - var aa = AssemblyBuilderAccess.Run; + get + { + if (_mBuilder == null) + { + _mBuilder = aBuilder.DefineDynamicModule("__CodeGenerator_Module"); + } + + return _mBuilder; + } + } - aBuilder = Thread.GetDomain().DefineDynamicAssembly(aname, aa); - mBuilder = aBuilder.DefineDynamicModule("__CodeGenerator_Module"); + internal CodeGenerator() + { } /// diff --git a/src/runtime/constructorbinder.cs b/Python.Runtime/constructorbinder.cs similarity index 100% rename from src/runtime/constructorbinder.cs rename to Python.Runtime/constructorbinder.cs diff --git a/src/runtime/constructorbinding.cs b/Python.Runtime/constructorbinding.cs similarity index 100% rename from src/runtime/constructorbinding.cs rename to Python.Runtime/constructorbinding.cs diff --git a/src/runtime/converter.cs b/Python.Runtime/converter.cs similarity index 97% rename from src/runtime/converter.cs rename to Python.Runtime/converter.cs index a7b7b5c48..736183c2c 100644 --- a/src/runtime/converter.cs +++ b/Python.Runtime/converter.cs @@ -86,8 +86,10 @@ internal static IntPtr GetPythonTypeByAlias(Type op) if (op == int32Type) return Runtime.PyIntType; - if (op == int64Type && Runtime.IsPython2) +#if PYTHON2 + if (op == int64Type) return Runtime.PyLongType; +#endif if (op == int64Type) return Runtime.PyIntType; @@ -165,15 +167,7 @@ internal static IntPtr ToPython(object value, Type type) var pyderived = value as IPythonDerivedType; if (null != pyderived) { - #if NETSTANDARD return ClassDerivedObject.ToPython(pyderived); - #else - // if object is remote don't do this - if (!System.Runtime.Remoting.RemotingServices.IsTransparentProxy(pyderived)) - { - return ClassDerivedObject.ToPython(pyderived); - } - #endif } // hmm - from Python, we almost never care what the declared @@ -488,8 +482,9 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo return true; case TypeCode.Int32: +#if PYTHON2 // Trickery to support 64-bit platforms. - if (Runtime.IsPython2 && Runtime.Is32Bit) + if (Runtime.Is32Bit) { op = Runtime.PyNumber_Int(value); @@ -513,7 +508,8 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo result = ival; return true; } - else // Python3 always use PyLong API +#else + // Python3 always use PyLong API { op = Runtime.PyNumber_Long(value); if (op == IntPtr.Zero) @@ -538,13 +534,14 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo result = (int)ll; return true; } +#endif case TypeCode.Boolean: result = Runtime.PyObject_IsTrue(value) != 0; return true; case TypeCode.Byte: -#if PYTHON3 +#if !PYTHON2 if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) @@ -555,7 +552,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo } goto type_error; } -#elif PYTHON2 +#else if (Runtime.PyObject_TypeCheck(value, Runtime.PyStringType)) { if (Runtime.PyString_Size(value) == 1) @@ -589,7 +586,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo return true; case TypeCode.SByte: -#if PYTHON3 +#if !PYTHON2 if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) @@ -600,7 +597,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo } goto type_error; } -#elif PYTHON2 +#else if (Runtime.PyObject_TypeCheck(value, Runtime.PyStringType)) { if (Runtime.PyString_Size(value) == 1) @@ -634,7 +631,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo return true; case TypeCode.Char: -#if PYTHON3 +#if !PYTHON2 if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) @@ -645,7 +642,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo } goto type_error; } -#elif PYTHON2 +#else if (Runtime.PyObject_TypeCheck(value, Runtime.PyStringType)) { if (Runtime.PyString_Size(value) == 1) @@ -753,20 +750,20 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo } goto type_error; } - + uint ui; - try + try { ui = Convert.ToUInt32(Runtime.PyLong_AsUnsignedLong(op)); } catch (OverflowException) { // Probably wasn't an overflow in python but was in C# (e.g. if cpython - // longs are 64 bit then 0xFFFFFFFF + 1 will not overflow in + // longs are 64 bit then 0xFFFFFFFF + 1 will not overflow in // PyLong_AsUnsignedLong) Runtime.XDecref(op); goto overflow; } - + if (Exceptions.ErrorOccurred()) { @@ -900,7 +897,7 @@ private static bool ToArray(IntPtr value, Type obType, out object result, bool s var listType = typeof(List<>); var constructedListType = listType.MakeGenericType(elementType); - IList list = IsSeqObj ? (IList) Activator.CreateInstance(constructedListType, new Object[] {(int) len}) : + IList list = IsSeqObj ? (IList) Activator.CreateInstance(constructedListType, new Object[] {(int) len}) : (IList) Activator.CreateInstance(constructedListType); IntPtr item; @@ -921,7 +918,7 @@ private static bool ToArray(IntPtr value, Type obType, out object result, bool s items = Array.CreateInstance(elementType, list.Count); list.CopyTo(items, 0); - + result = items; return true; } diff --git a/src/runtime/converterextensions.cs b/Python.Runtime/converterextensions.cs similarity index 100% rename from src/runtime/converterextensions.cs rename to Python.Runtime/converterextensions.cs diff --git a/src/runtime/debughelper.cs b/Python.Runtime/debughelper.cs similarity index 100% rename from src/runtime/debughelper.cs rename to Python.Runtime/debughelper.cs diff --git a/src/runtime/delegatemanager.cs b/Python.Runtime/delegatemanager.cs similarity index 100% rename from src/runtime/delegatemanager.cs rename to Python.Runtime/delegatemanager.cs diff --git a/src/runtime/delegateobject.cs b/Python.Runtime/delegateobject.cs similarity index 93% rename from src/runtime/delegateobject.cs rename to Python.Runtime/delegateobject.cs index e1103cbc7..c9aad9898 100644 --- a/src/runtime/delegateobject.cs +++ b/Python.Runtime/delegateobject.cs @@ -96,7 +96,6 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) /// /// Implements __cmp__ for reflected delegate types. /// -#if PYTHON3 // TODO: Doesn't PY2 implement tp_richcompare too? public new static IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) { if (op != Runtime.Py_EQ && op != Runtime.Py_NE) @@ -126,13 +125,5 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) Runtime.XIncref(pyfalse); return pyfalse; } -#elif PYTHON2 - public static int tp_compare(IntPtr ob, IntPtr other) - { - Delegate d1 = GetTrueDelegate(ob); - Delegate d2 = GetTrueDelegate(other); - return d1 == d2 ? 0 : -1; - } -#endif } } diff --git a/src/runtime/eventbinding.cs b/Python.Runtime/eventbinding.cs similarity index 100% rename from src/runtime/eventbinding.cs rename to Python.Runtime/eventbinding.cs diff --git a/src/runtime/eventobject.cs b/Python.Runtime/eventobject.cs similarity index 100% rename from src/runtime/eventobject.cs rename to Python.Runtime/eventobject.cs diff --git a/src/runtime/exceptions.cs b/Python.Runtime/exceptions.cs similarity index 99% rename from src/runtime/exceptions.cs rename to Python.Runtime/exceptions.cs index 31c367eb2..e4e823a9a 100644 --- a/src/runtime/exceptions.cs +++ b/Python.Runtime/exceptions.cs @@ -103,7 +103,12 @@ private Exceptions() /// internal static void Initialize() { - string exceptionsModuleName = Runtime.IsPython3 ? "builtins" : "exceptions"; + string exceptionsModuleName = +#if PYTHON2 + "exceptions"; +#else + "builtins"; +#endif exceptions_module = Runtime.PyImport_ImportModule(exceptionsModuleName); Exceptions.ErrorCheck(exceptions_module); @@ -180,7 +185,7 @@ internal static void SetArgsAndCause(IntPtr ob) Marshal.WriteIntPtr(ob, ExceptionOffset.args, args); -#if PYTHON3 +#if !PYTHON2 if (e.InnerException != null) { IntPtr cause = CLRObject.GetInstHandle(e.InnerException); diff --git a/src/runtime/extensiontype.cs b/Python.Runtime/extensiontype.cs similarity index 100% rename from src/runtime/extensiontype.cs rename to Python.Runtime/extensiontype.cs diff --git a/src/runtime/fieldobject.cs b/Python.Runtime/fieldobject.cs similarity index 100% rename from src/runtime/fieldobject.cs rename to Python.Runtime/fieldobject.cs diff --git a/src/runtime/finalizer.cs b/Python.Runtime/finalizer.cs similarity index 100% rename from src/runtime/finalizer.cs rename to Python.Runtime/finalizer.cs diff --git a/src/runtime/generictype.cs b/Python.Runtime/generictype.cs similarity index 100% rename from src/runtime/generictype.cs rename to Python.Runtime/generictype.cs diff --git a/src/runtime/genericutil.cs b/Python.Runtime/genericutil.cs similarity index 100% rename from src/runtime/genericutil.cs rename to Python.Runtime/genericutil.cs diff --git a/src/runtime/importhook.cs b/Python.Runtime/importhook.cs similarity index 98% rename from src/runtime/importhook.cs rename to Python.Runtime/importhook.cs index aa3bbab6d..58069eb24 100644 --- a/src/runtime/importhook.cs +++ b/Python.Runtime/importhook.cs @@ -13,7 +13,6 @@ internal class ImportHook private static MethodWrapper hook; private static IntPtr py_clr_module; -#if PYTHON3 private static IntPtr module_def = IntPtr.Zero; internal static void InitializeModuleDef() @@ -33,7 +32,6 @@ internal static void ReleaseModuleDef() ModuleDefOffset.FreeModuleDef(module_def); module_def = IntPtr.Zero; } -#endif /// /// Initialize just the __import__ hook itself. @@ -82,7 +80,7 @@ internal static void Initialize() // Initialize the clr module and tell Python about it. root = new CLRModule(); -#if PYTHON3 +#if !PYTHON2 // create a python module with the same methods as the clr module-like object InitializeModuleDef(); py_clr_module = Runtime.PyModule_Create2(module_def, 3); @@ -93,7 +91,7 @@ internal static void Initialize() clr_dict = (IntPtr)Marshal.PtrToStructure(clr_dict, typeof(IntPtr)); Runtime.PyDict_Update(mod_dict, clr_dict); -#elif PYTHON2 +#else Runtime.XIncref(root.pyHandle); // we are using the module two times py_clr_module = root.pyHandle; // Alias handle for PY2/PY3 #endif @@ -118,7 +116,7 @@ internal static void Shutdown() bool shouldFreeDef = Runtime.Refcount(py_clr_module) == 1; Runtime.XDecref(py_clr_module); py_clr_module = IntPtr.Zero; -#if PYTHON3 +#if !PYTHON2 if (shouldFreeDef) { ReleaseModuleDef(); @@ -137,11 +135,10 @@ public static IntPtr GetCLRModule(IntPtr? fromList = null) { root.InitializePreload(); - if (Runtime.IsPython2) - { - Runtime.XIncref(py_clr_module); - return py_clr_module; - } +#if PYTHON2 + Runtime.XIncref(py_clr_module); + return py_clr_module; +#endif // Python 3 // update the module dictionary with the contents of the root dictionary diff --git a/src/runtime/indexer.cs b/Python.Runtime/indexer.cs similarity index 100% rename from src/runtime/indexer.cs rename to Python.Runtime/indexer.cs diff --git a/src/runtime/interfaceobject.cs b/Python.Runtime/interfaceobject.cs similarity index 100% rename from src/runtime/interfaceobject.cs rename to Python.Runtime/interfaceobject.cs diff --git a/src/runtime/interfaces.cs b/Python.Runtime/interfaces.cs similarity index 100% rename from src/runtime/interfaces.cs rename to Python.Runtime/interfaces.cs diff --git a/src/runtime/interop.cs b/Python.Runtime/interop.cs similarity index 99% rename from src/runtime/interop.cs rename to Python.Runtime/interop.cs index ca3c35bfd..135b35ba0 100644 --- a/src/runtime/interop.cs +++ b/Python.Runtime/interop.cs @@ -156,7 +156,7 @@ public static int Size() public static int args = 0; #if PYTHON2 public static int message = 0; -#elif PYTHON3 +#else public static int traceback = 0; public static int context = 0; public static int cause = 0; @@ -169,7 +169,6 @@ public static int Size() } -#if PYTHON3 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal class BytesOffset { @@ -260,7 +259,6 @@ public static void FreeModuleDef(IntPtr ptr) public static int name = 0; } -#endif // PYTHON3 /// /// TypeFlags(): The actual bit values for the Type Flags stored @@ -270,17 +268,6 @@ public static void FreeModuleDef(IntPtr ptr) /// internal class TypeFlags { -#if PYTHON2 // these flags were removed in Python 3 - public static int HaveGetCharBuffer = (1 << 0); - public static int HaveSequenceIn = (1 << 1); - public static int GC = 0; - public static int HaveInPlaceOps = (1 << 3); - public static int CheckTypes = (1 << 4); - public static int HaveRichCompare = (1 << 5); - public static int HaveWeakRefs = (1 << 6); - public static int HaveIter = (1 << 7); - public static int HaveClass = (1 << 8); -#endif public static int HeapType = (1 << 9); public static int BaseType = (1 << 10); public static int Ready = (1 << 12); @@ -309,6 +296,15 @@ internal class TypeFlags public static int TypeSubclass = (1 << 31); #if PYTHON2 // Default flags for Python 2 + public static int HaveGetCharBuffer = (1 << 0); + public static int HaveSequenceIn = (1 << 1); + public static int GC = 0; + public static int HaveInPlaceOps = (1 << 3); + public static int CheckTypes = (1 << 4); + public static int HaveRichCompare = (1 << 5); + public static int HaveWeakRefs = (1 << 6); + public static int HaveIter = (1 << 7); + public static int HaveClass = (1 << 8); public static int Default = ( HaveGetCharBuffer | HaveSequenceIn | @@ -320,7 +316,7 @@ internal class TypeFlags HaveStacklessExtension | HaveIndex | 0); -#elif PYTHON3 // Default flags for Python 3 +#else // Default flags for Python 3 public static int Default = ( HaveStacklessExtension | HaveVersionTag); diff --git a/src/runtime/interop27.cs b/Python.Runtime/interop/interop2.cs similarity index 100% rename from src/runtime/interop27.cs rename to Python.Runtime/interop/interop2.cs diff --git a/src/runtime/interop36.cs b/Python.Runtime/interop/interop3.cs similarity index 99% rename from src/runtime/interop36.cs rename to Python.Runtime/interop/interop3.cs index c46bcc2f5..668d7a8e5 100644 --- a/src/runtime/interop36.cs +++ b/Python.Runtime/interop/interop3.cs @@ -1,8 +1,9 @@ + // Auto-generated by geninterop.py. -// DO NOT MODIFIY BY HAND. +// DO NOT MODIFY BY HAND. -#if PYTHON36 +#if !PYTHON2 using System; using System.Collections; using System.Collections.Specialized; diff --git a/src/runtime/iterator.cs b/Python.Runtime/iterator.cs similarity index 100% rename from src/runtime/iterator.cs rename to Python.Runtime/iterator.cs diff --git a/src/runtime/managedtype.cs b/Python.Runtime/managedtype.cs similarity index 100% rename from src/runtime/managedtype.cs rename to Python.Runtime/managedtype.cs diff --git a/src/runtime/metatype.cs b/Python.Runtime/metatype.cs similarity index 100% rename from src/runtime/metatype.cs rename to Python.Runtime/metatype.cs diff --git a/src/runtime/methodbinder.cs b/Python.Runtime/methodbinder.cs similarity index 100% rename from src/runtime/methodbinder.cs rename to Python.Runtime/methodbinder.cs diff --git a/src/runtime/methodbinding.cs b/Python.Runtime/methodbinding.cs similarity index 100% rename from src/runtime/methodbinding.cs rename to Python.Runtime/methodbinding.cs diff --git a/src/runtime/methodobject.cs b/Python.Runtime/methodobject.cs similarity index 100% rename from src/runtime/methodobject.cs rename to Python.Runtime/methodobject.cs diff --git a/src/runtime/methodwrapper.cs b/Python.Runtime/methodwrapper.cs similarity index 100% rename from src/runtime/methodwrapper.cs rename to Python.Runtime/methodwrapper.cs diff --git a/src/runtime/modulefunctionobject.cs b/Python.Runtime/modulefunctionobject.cs similarity index 100% rename from src/runtime/modulefunctionobject.cs rename to Python.Runtime/modulefunctionobject.cs diff --git a/src/runtime/moduleobject.cs b/Python.Runtime/moduleobject.cs similarity index 99% rename from src/runtime/moduleobject.cs rename to Python.Runtime/moduleobject.cs index 0a3933005..294636e70 100644 --- a/src/runtime/moduleobject.cs +++ b/Python.Runtime/moduleobject.cs @@ -284,7 +284,7 @@ public static IntPtr tp_getattro(IntPtr ob, IntPtr key) Exceptions.SetError(e); return IntPtr.Zero; } - + if (attr == null) { @@ -435,7 +435,7 @@ public static Assembly AddReference(string name) /// clr.GetClrType(IComparable) gives you the Type for IComparable, /// that you can e.g. perform reflection on. Similar to typeof(IComparable) in C# /// or clr.GetClrType(IComparable) in IronPython. - /// + /// /// /// /// The Type object diff --git a/src/runtime/modulepropertyobject.cs b/Python.Runtime/modulepropertyobject.cs similarity index 100% rename from src/runtime/modulepropertyobject.cs rename to Python.Runtime/modulepropertyobject.cs diff --git a/Python.Runtime/nativecall.cs b/Python.Runtime/nativecall.cs new file mode 100644 index 000000000..eea4b6fae --- /dev/null +++ b/Python.Runtime/nativecall.cs @@ -0,0 +1,51 @@ +using System; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.InteropServices; +using System.Threading; + +namespace Python.Runtime +{ + /// + /// Provides support for calling native code indirectly through + /// function pointers. Most of the important parts of the Python + /// C API can just be wrapped with p/invoke, but there are some + /// situations (specifically, calling functions through Python + /// type structures) where we need to call functions indirectly. + /// This class uses Reflection.Emit to generate IJW thunks that + /// support indirect calls to native code using various common + /// call signatures. This is mainly a workaround for the fact + /// that you can't spell an indirect call in C# (but can in IL). + /// Another approach that would work is for this to be turned + /// into a separate utility program that could be run during the + /// build process to generate the thunks as a separate assembly + /// that could then be referenced by the main Python runtime. + /// + internal class NativeCall + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate void Void_1_Delegate(IntPtr a1); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate int Int_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3); + + public static void Void_Call_1(IntPtr fp, IntPtr a1) + { + var d = Marshal.GetDelegateForFunctionPointer(fp); + d(a1); + } + + public static IntPtr Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) + { + var d = Marshal.GetDelegateForFunctionPointer(fp); + return d(a1, a2, a3); + } + + + public static int Int_Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) + { + var d = Marshal.GetDelegateForFunctionPointer(fp); + return d(a1, a2, a3); + } + } +} diff --git a/src/runtime/overload.cs b/Python.Runtime/overload.cs similarity index 100% rename from src/runtime/overload.cs rename to Python.Runtime/overload.cs diff --git a/src/runtime/platform/LibraryLoader.cs b/Python.Runtime/platform/LibraryLoader.cs similarity index 100% rename from src/runtime/platform/LibraryLoader.cs rename to Python.Runtime/platform/LibraryLoader.cs diff --git a/src/runtime/platform/Types.cs b/Python.Runtime/platform/Types.cs similarity index 100% rename from src/runtime/platform/Types.cs rename to Python.Runtime/platform/Types.cs diff --git a/src/runtime/polyfill/ReflectionPolifills.cs b/Python.Runtime/polyfill/ReflectionPolyfills.cs similarity index 88% rename from src/runtime/polyfill/ReflectionPolifills.cs rename to Python.Runtime/polyfill/ReflectionPolyfills.cs index a7e9c879a..a44a15f72 100644 --- a/src/runtime/polyfill/ReflectionPolifills.cs +++ b/Python.Runtime/polyfill/ReflectionPolyfills.cs @@ -4,8 +4,7 @@ namespace Python.Runtime { -#if NETSTANDARD - public static class ReflectionPolifills + public static class ReflectionPolyfills { public static AssemblyBuilder DefineDynamicAssembly(this AppDomain appDomain, AssemblyName assemblyName, AssemblyBuilderAccess assemblyBuilderAccess) { @@ -17,5 +16,4 @@ public static Type CreateType(this TypeBuilder typeBuilder) return typeBuilder.GetTypeInfo().GetType(); } } -#endif } diff --git a/src/runtime/propertyobject.cs b/Python.Runtime/propertyobject.cs similarity index 98% rename from src/runtime/propertyobject.cs rename to Python.Runtime/propertyobject.cs index f2c97f163..893fbe54b 100644 --- a/src/runtime/propertyobject.cs +++ b/Python.Runtime/propertyobject.cs @@ -13,7 +13,6 @@ internal class PropertyObject : ExtensionType private MethodInfo getter; private MethodInfo setter; - [StrongNameIdentityPermission(SecurityAction.Assert)] public PropertyObject(PropertyInfo md) { getter = md.GetGetMethod(true); diff --git a/src/runtime/pyansistring.cs b/Python.Runtime/pyansistring.cs similarity index 100% rename from src/runtime/pyansistring.cs rename to Python.Runtime/pyansistring.cs diff --git a/src/runtime/pydict.cs b/Python.Runtime/pydict.cs similarity index 100% rename from src/runtime/pydict.cs rename to Python.Runtime/pydict.cs diff --git a/src/runtime/pyfloat.cs b/Python.Runtime/pyfloat.cs similarity index 100% rename from src/runtime/pyfloat.cs rename to Python.Runtime/pyfloat.cs diff --git a/src/runtime/pyint.cs b/Python.Runtime/pyint.cs similarity index 100% rename from src/runtime/pyint.cs rename to Python.Runtime/pyint.cs diff --git a/src/runtime/pyiter.cs b/Python.Runtime/pyiter.cs similarity index 100% rename from src/runtime/pyiter.cs rename to Python.Runtime/pyiter.cs diff --git a/src/runtime/pylist.cs b/Python.Runtime/pylist.cs similarity index 100% rename from src/runtime/pylist.cs rename to Python.Runtime/pylist.cs diff --git a/src/runtime/pylong.cs b/Python.Runtime/pylong.cs similarity index 100% rename from src/runtime/pylong.cs rename to Python.Runtime/pylong.cs diff --git a/src/runtime/pynumber.cs b/Python.Runtime/pynumber.cs similarity index 100% rename from src/runtime/pynumber.cs rename to Python.Runtime/pynumber.cs diff --git a/src/runtime/pyobject.cs b/Python.Runtime/pyobject.cs similarity index 100% rename from src/runtime/pyobject.cs rename to Python.Runtime/pyobject.cs diff --git a/src/runtime/pyscope.cs b/Python.Runtime/pyscope.cs similarity index 100% rename from src/runtime/pyscope.cs rename to Python.Runtime/pyscope.cs diff --git a/src/runtime/pysequence.cs b/Python.Runtime/pysequence.cs similarity index 100% rename from src/runtime/pysequence.cs rename to Python.Runtime/pysequence.cs diff --git a/src/runtime/pystring.cs b/Python.Runtime/pystring.cs similarity index 100% rename from src/runtime/pystring.cs rename to Python.Runtime/pystring.cs diff --git a/src/runtime/pythonengine.cs b/Python.Runtime/pythonengine.cs similarity index 94% rename from src/runtime/pythonengine.cs rename to Python.Runtime/pythonengine.cs index df2d98641..969296da5 100644 --- a/src/runtime/pythonengine.cs +++ b/Python.Runtime/pythonengine.cs @@ -95,13 +95,13 @@ public static string PythonPath } set { - if (Runtime.IsPython2) - { - throw new NotSupportedException("Set PythonPath not supported on Python 2"); - } +#if PYTHON2 + throw new NotSupportedException("Set PythonPath not supported on Python 2"); +#else Marshal.FreeHGlobal(_pythonPath); _pythonPath = UcsMarshaler.Py3UnicodePy2StringtoPtr(value); Runtime.Py_SetPath(_pythonPath); +#endif } } @@ -254,14 +254,12 @@ static void OnDomainUnload(object _, EventArgs __) /// CPython interpreter process - this bootstraps the managed runtime /// when it is imported by the CLR extension module. /// -#if PYTHON3 - public static IntPtr InitExt() -#elif PYTHON2 - public static void InitExt() -#endif + public static int InternalInitialize(IntPtr data, int size) { + IntPtr gilState = IntPtr.Zero; try { + gilState = Runtime.PyGILState_Ensure(); Initialize(setSysArgv: false); // Trickery - when the import hook is installed into an already @@ -294,18 +292,52 @@ public static void InitExt() " break\n"; PythonEngine.Exec(code); + return 0; } - catch (PythonException e) + catch (PythonException exc) { - e.Restore(); -#if PYTHON3 - return IntPtr.Zero; -#endif + exc.Restore(); + Console.WriteLine($"{exc.Message}\n{exc.Format()}"); + return -1; + } + catch (Exception exc) + { + Console.WriteLine($"{exc}\n{exc.StackTrace}"); + return -1; + } + finally + { + if (gilState != IntPtr.Zero) + Runtime.PyGILState_Release(gilState); } + } -#if PYTHON3 - return Python.Runtime.ImportHook.GetCLRModule(); -#endif + public static int InternalShutdown(IntPtr data, int size) + { + IntPtr gilState = IntPtr.Zero; + try + { + gilState = Runtime.PyGILState_Ensure(); + Shutdown(); + + return 0; + } + catch (PythonException exc) + { + exc.Restore(); + Console.WriteLine($"{exc.Message}\n{exc.Format()}"); + return -1; + } + catch (Exception exc) + { + Console.WriteLine($"{exc}\n{exc.StackTrace}"); + return -1; + } + finally + { + if (gilState != IntPtr.Zero) + Runtime.PyGILState_Release(gilState); + } } /// @@ -321,7 +353,7 @@ public static void Shutdown() if (initialized) { PyScopeManager.Global.Clear(); - + // If the shutdown handlers trigger a domain unload, // don't call shutdown again. AppDomain.CurrentDomain.DomainUnload -= OnDomainUnload; @@ -587,7 +619,7 @@ internal static PyObject RunString(string code, IntPtr? globals, IntPtr? locals, borrowedGlobals = false; } } - + if (locals == null) { locals = globals; @@ -650,7 +682,7 @@ public static PyScope CreateScope(string name) var scope = PyScopeManager.Global.Create(name); return scope; } - + public class GILState : IDisposable { private readonly IntPtr state; @@ -751,7 +783,7 @@ public static void SetArgv(IEnumerable argv) public static void With(PyObject obj, Action Body) { - // Behavior described here: + // Behavior described here: // https://docs.python.org/2/reference/datamodel.html#with-statement-context-managers IntPtr type = Runtime.PyNone; diff --git a/src/runtime/pythonexception.cs b/Python.Runtime/pythonexception.cs similarity index 100% rename from src/runtime/pythonexception.cs rename to Python.Runtime/pythonexception.cs diff --git a/src/runtime/pytuple.cs b/Python.Runtime/pytuple.cs similarity index 100% rename from src/runtime/pytuple.cs rename to Python.Runtime/pytuple.cs diff --git a/src/runtime/resources/clr.py b/Python.Runtime/resources/clr.py similarity index 100% rename from src/runtime/resources/clr.py rename to Python.Runtime/resources/clr.py diff --git a/src/runtime/runtime.cs b/Python.Runtime/runtime.cs similarity index 94% rename from src/runtime/runtime.cs rename to Python.Runtime/runtime.cs index bae3daa15..8b23d5624 100644 --- a/src/runtime/runtime.cs +++ b/Python.Runtime/runtime.cs @@ -1,3 +1,4 @@ +using System.Runtime.CompilerServices; using System; using System.Runtime.InteropServices; using System.Security; @@ -22,7 +23,7 @@ public class Runtime public static int UCS => _UCS; -#if UCS4 +#if !UCS2 internal const int _UCS = 4; /// @@ -30,7 +31,7 @@ public class Runtime /// methods prior to PEP393. Only used for PY27. /// private const string PyUnicodeEntryPoint = "PyUnicodeUCS4_"; -#elif UCS2 +#else internal const int _UCS = 2; /// @@ -38,69 +39,9 @@ public class Runtime /// methods prior to PEP393. Only used for PY27. /// private const string PyUnicodeEntryPoint = "PyUnicodeUCS2_"; -#else -#error You must define either UCS2 or UCS4! #endif - // C# compiler copies constants to the assemblies that references this library. - // We needs to replace all public constants to static readonly fields to allow - // binary substitution of different Python.Runtime.dll builds in a target application. - - public static string pyversion => _pyversion; - public static string pyver => _pyver; - -#if PYTHON27 - internal const string _pyversion = "2.7"; - internal const string _pyver = "27"; -#elif PYTHON34 - internal const string _pyversion = "3.4"; - internal const string _pyver = "34"; -#elif PYTHON35 - internal const string _pyversion = "3.5"; - internal const string _pyver = "35"; -#elif PYTHON36 - internal const string _pyversion = "3.6"; - internal const string _pyver = "36"; -#elif PYTHON37 - internal const string _pyversion = "3.7"; - internal const string _pyver = "37"; -#elif PYTHON38 - internal const string _pyversion = "3.8"; - internal const string _pyver = "38"; -#else -#error You must define one of PYTHON34 to PYTHON38 or PYTHON27 -#endif - -#if MONO_LINUX || MONO_OSX // Linux/macOS use dotted version string - internal const string dllBase = "python" + _pyversion; -#else // Windows - internal const string dllBase = "python" + _pyver; -#endif - -#if PYTHON_WITH_PYDEBUG - internal const string dllWithPyDebug = "d"; -#else - internal const string dllWithPyDebug = ""; -#endif -#if PYTHON_WITH_PYMALLOC - internal const string dllWithPyMalloc = "m"; -#else - internal const string dllWithPyMalloc = ""; -#endif - - // C# compiler copies constants to the assemblies that references this library. - // We needs to replace all public constants to static readonly fields to allow - // binary substitution of different Python.Runtime.dll builds in a target application. - - public static readonly string PythonDLL = _PythonDll; - -#if PYTHON_WITHOUT_ENABLE_SHARED && !NETSTANDARD internal const string _PythonDll = "__Internal"; -#else - internal const string _PythonDll = dllBase + dllWithPyDebug + dllWithPyMalloc; -#endif - - public static readonly int pyversionnumber = Convert.ToInt32(_pyver); // set to true when python is finalizing internal static object IsFinalizingLock = new object(); @@ -159,8 +100,13 @@ public class Runtime /// public static string MachineName { get; private set; } - internal static bool IsPython2 = pyversionnumber < 30; - internal static bool IsPython3 = pyversionnumber >= 30; +#if PYTHON2 + internal static bool IsPython2 = true; +#else + internal static bool IsPython2 = false; +#endif + + internal static bool IsPython3 = !IsPython2; public static int MainManagedThreadId { get; private set; } @@ -248,7 +194,7 @@ internal static void Initialize(bool initSigs = false) () => PyUnicodeType = IntPtr.Zero); XDecref(op); -#if PYTHON3 +#if !PYTHON2 op = PyBytes_FromString("bytes"); SetPyMember(ref PyBytesType, PyObject_Type(op), () => PyBytesType = IntPtr.Zero); @@ -270,16 +216,22 @@ internal static void Initialize(bool initSigs = false) () => PyDictType = IntPtr.Zero); XDecref(op); - op = PyInt_FromInt32(0); - SetPyMember(ref PyIntType, PyObject_Type(op), - () => PyIntType = IntPtr.Zero); - XDecref(op); + // Choose a number >1000 st. we get a real PyObject + op = PyLong_FromLong(1000); - op = PyLong_FromLong(0); SetPyMember(ref PyLongType, PyObject_Type(op), () => PyLongType = IntPtr.Zero); XDecref(op); +#if !PYTHON2 + PyIntType = PyLongType; +#else + op = PyInt_FromInt32(1000); + SetPyMember(ref PyIntType, PyObject_Type(op), + () => PyIntType = IntPtr.Zero); + XDecref(op); +#endif + op = PyFloat_FromDouble(0); SetPyMember(ref PyFloatType, PyObject_Type(op), () => PyFloatType = IntPtr.Zero); @@ -402,7 +354,6 @@ internal static void Shutdown() // TOOD: PyCLRMetaType's release operation still in #958 PyCLRMetaType = IntPtr.Zero; ResetPyMembers(); - Py_Finalize(); } // called *without* the GIL acquired by clr._AtExit @@ -415,7 +366,7 @@ internal static int AtExit() return 0; } - private static void SetPyMember(ref IntPtr obj, IntPtr value, Action onRelease) + private static void SetPyMember(ref IntPtr obj, IntPtr value, Action onRelease, [CallerLineNumber]int lineNumber = 0) { // XXX: For current usages, value should not be null. PythonException.ThrowIfIsNull(value); @@ -455,9 +406,7 @@ private static void ResetPyMembers() internal static IntPtr Py_NoSiteFlag; -#if PYTHON3 internal static IntPtr PyBytesType; -#endif internal static IntPtr _PyObject_NextNotImplemented; internal static IntPtr PyNotImplemented; @@ -584,23 +533,8 @@ internal static Type[] PythonArgsToTypeArray(IntPtr arg, bool mangleObjects) /// internal static unsafe void XIncref(IntPtr op) { -#if PYTHON_WITH_PYDEBUG || NETSTANDARD Py_IncRef(op); return; -#else - var p = (void*)op; - if ((void*)0 != p) - { - if (Is32Bit) - { - (*(int*)p)++; - } - else - { - (*(long*)p)++; - } - } -#endif } /// @@ -614,39 +548,8 @@ internal static IntPtr SelfIncRef(IntPtr op) internal static unsafe void XDecref(IntPtr op) { -#if PYTHON_WITH_PYDEBUG || NETSTANDARD Py_DecRef(op); return; -#else - var p = (void*)op; - if ((void*)0 != p) - { - if (Is32Bit) - { - --(*(int*)p); - } - else - { - --(*(long*)p); - } - if ((*(int*)p) == 0) - { - // PyObject_HEAD: struct _typeobject *ob_type - void* t = Is32Bit - ? (void*)(*((uint*)p + 1)) - : (void*)(*((ulong*)p + 1)); - // PyTypeObject: destructor tp_dealloc - void* f = Is32Bit - ? (void*)(*((uint*)t + 6)) - : (void*)(*((ulong*)t + 6)); - if ((void*)0 == f) - { - return; - } - NativeCall.Impl.Void_Call_1(new IntPtr(f), op); - } - } -#endif } internal static unsafe long Refcount(IntPtr op) @@ -721,13 +624,13 @@ internal static unsafe long Refcount(IntPtr op) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyGILState_GetThisThreadState(); -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Py_Main( int argc, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StrArrayMarshaler))] string[] argv ); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Py_Main(int argc, string[] argv); #endif @@ -958,7 +861,6 @@ internal static bool PyObject_IsIterable(IntPtr pointer) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyObject_CallObject(IntPtr pointer, IntPtr args); -#if PYTHON3 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern int PyObject_RichCompareBool(IntPtr value1, IntPtr value2, int opid); @@ -986,10 +888,6 @@ internal static int PyObject_Compare(IntPtr value1, IntPtr value2) Exceptions.SetError(Exceptions.SystemError, "Error comparing objects"); return -1; } -#elif PYTHON2 - [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] - internal static extern int PyObject_Compare(IntPtr value1, IntPtr value2); -#endif [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern int PyObject_IsInstance(IntPtr ob, IntPtr type); @@ -1023,11 +921,11 @@ internal static long PyObject_Size(IntPtr pointer) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyObject_Str(IntPtr pointer); -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyObject_Str")] internal static extern IntPtr PyObject_Unicode(IntPtr pointer); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyObject_Unicode(IntPtr pointer); #endif @@ -1040,11 +938,11 @@ internal static long PyObject_Size(IntPtr pointer) // Python number API //==================================================================== -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyNumber_Long")] internal static extern IntPtr PyNumber_Int(IntPtr ob); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyNumber_Int(IntPtr ob); #endif @@ -1080,7 +978,7 @@ internal static IntPtr PyInt_FromInt64(long value) return PyInt_FromLong(v); } -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyLong_FromLong")] private static extern IntPtr PyInt_FromLong(IntPtr value); @@ -1092,7 +990,7 @@ internal static IntPtr PyInt_FromInt64(long value) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyLong_FromString")] internal static extern IntPtr PyInt_FromString(string value, IntPtr end, int radix); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr PyInt_FromLong(IntPtr value); @@ -1369,14 +1267,14 @@ internal static bool PyString_Check(IntPtr ob) internal static IntPtr PyString_FromString(string value) { -#if PYTHON3 +#if !PYTHON2 return PyUnicode_FromKindAndData(_UCS, value, value.Length); -#elif PYTHON2 +#else return PyString_FromStringAndSize(value, value.Length); #endif } -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyBytes_FromString(string op); @@ -1416,7 +1314,7 @@ internal static IntPtr PyUnicode_FromStringAndSize(IntPtr value, long size) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyUnicode_AsUTF8(IntPtr unicode); -#elif PYTHON2 +#else internal static IntPtr PyString_FromStringAndSize(string value, long size) { return PyString_FromStringAndSize(value, new IntPtr(size)); @@ -1437,7 +1335,7 @@ internal static bool PyUnicode_Check(IntPtr ob) return PyObject_TYPE(ob) == PyUnicodeType; } -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyUnicode_FromObject(IntPtr ob); @@ -1474,7 +1372,7 @@ internal static long PyUnicode_GetSize(IntPtr ob) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyUnicode_FromOrdinal(int c); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = PyUnicodeEntryPoint + "FromObject")] internal static extern IntPtr PyUnicode_FromObject(IntPtr ob); @@ -1552,6 +1450,7 @@ internal static string GetManagedString(IntPtr op) int size = length * _UCS; var buffer = new byte[size]; Marshal.Copy(p, buffer, 0, size); + return PyEncoding.GetString(buffer, 0, size); } @@ -1785,7 +1684,7 @@ internal static bool PyIter_Check(IntPtr pointer) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern string PyModule_GetFilename(IntPtr module); -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyModule_Create2(IntPtr module, int apiver); #endif @@ -1808,14 +1707,14 @@ internal static bool PyIter_Check(IntPtr pointer) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyImport_GetModuleDict(); -#if PYTHON3 +#if !PYTHON2 [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern void PySys_SetArgvEx( int argc, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StrArrayMarshaler))] string[] argv, int updatepath ); -#elif PYTHON2 +#else [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern void PySys_SetArgvEx( int argc, @@ -1976,24 +1875,8 @@ internal static void SetNoSiteFlag() { var loader = LibraryLoader.Get(OperatingSystem); - IntPtr dllLocal; - if (_PythonDll != "__Internal") - { - dllLocal = loader.Load(_PythonDll); - } - - try - { - Py_NoSiteFlag = loader.GetFunction(dllLocal, "Py_NoSiteFlag"); - Marshal.WriteInt32(Py_NoSiteFlag, 1); - } - finally - { - if (dllLocal != IntPtr.Zero) - { - loader.Free(dllLocal); - } - } + Py_NoSiteFlag = loader.GetFunction(IntPtr.Zero, "Py_NoSiteFlag"); + Marshal.WriteInt32(Py_NoSiteFlag, 1); } /// @@ -2001,8 +1884,12 @@ internal static void SetNoSiteFlag() /// internal static IntPtr GetBuiltins() { - return IsPython3 ? PyImport_ImportModule("builtins") - : PyImport_ImportModule("__builtin__"); +#if !PYTHON2 + const string modName = "builtins"; +#else + const string modName = "__builtin__"; +#endif + return PyImport_ImportModule(modName); } } diff --git a/src/runtime/slots/mp_length.cs b/Python.Runtime/slots/mp_length.cs similarity index 100% rename from src/runtime/slots/mp_length.cs rename to Python.Runtime/slots/mp_length.cs diff --git a/src/runtime/typemanager.cs b/Python.Runtime/typemanager.cs similarity index 99% rename from src/runtime/typemanager.cs rename to Python.Runtime/typemanager.cs index bb920b74f..d0abb694e 100644 --- a/src/runtime/typemanager.cs +++ b/Python.Runtime/typemanager.cs @@ -111,7 +111,7 @@ internal static IntPtr CreateType(Type impl) internal static IntPtr CreateType(ManagedType impl, Type clrType) { // Cleanup the type name to get rid of funny nested type names. - string name = "CLR." + clrType.FullName; + string name = "clr.types." + clrType.FullName; int i = name.LastIndexOf('+'); if (i > -1) { @@ -425,19 +425,17 @@ internal static IntPtr AllocateTypeObject(string name) // Cheat a little: we'll set tp_name to the internal char * of // the Python version of the type name - otherwise we'd have to // allocate the tp_name and would have no way to free it. -#if PYTHON3 +#if !PYTHON2 IntPtr temp = Runtime.PyUnicode_FromString(name); IntPtr raw = Runtime.PyUnicode_AsUTF8(temp); -#elif PYTHON2 +#else IntPtr temp = Runtime.PyString_FromString(name); IntPtr raw = Runtime.PyString_AsString(temp); #endif Marshal.WriteIntPtr(type, TypeOffset.tp_name, raw); Marshal.WriteIntPtr(type, TypeOffset.name, temp); - -#if PYTHON3 + Runtime.Py_IncRef(temp); Marshal.WriteIntPtr(type, TypeOffset.qualname, temp); -#endif long ptr = type.ToInt64(); // 64-bit safe @@ -450,9 +448,9 @@ internal static IntPtr AllocateTypeObject(string name) temp = new IntPtr(ptr + TypeOffset.mp_length); Marshal.WriteIntPtr(type, TypeOffset.tp_as_mapping, temp); -#if PYTHON3 +#if !PYTHON2 temp = new IntPtr(ptr + TypeOffset.bf_getbuffer); -#elif PYTHON2 +#else temp = new IntPtr(ptr + TypeOffset.bf_getreadbuffer); #endif Marshal.WriteIntPtr(type, TypeOffset.tp_as_buffer, temp); diff --git a/src/runtime/typemethod.cs b/Python.Runtime/typemethod.cs similarity index 100% rename from src/runtime/typemethod.cs rename to Python.Runtime/typemethod.cs diff --git a/src/embed_tests/Codecs.cs b/Python.Test.Embed/Codecs.cs similarity index 100% rename from src/embed_tests/Codecs.cs rename to Python.Test.Embed/Codecs.cs diff --git a/src/embed_tests/GlobalTestsSetup.cs b/Python.Test.Embed/GlobalTestsSetup.cs similarity index 100% rename from src/embed_tests/GlobalTestsSetup.cs rename to Python.Test.Embed/GlobalTestsSetup.cs diff --git a/src/embed_tests/Python.EmbeddingTest.csproj b/Python.Test.Embed/Python.Test.Embed similarity index 100% rename from src/embed_tests/Python.EmbeddingTest.csproj rename to Python.Test.Embed/Python.Test.Embed diff --git a/Python.Test.Embed/Python.Test.Embed.csproj b/Python.Test.Embed/Python.Test.Embed.csproj new file mode 100644 index 000000000..6ed446c5b --- /dev/null +++ b/Python.Test.Embed/Python.Test.Embed.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp3.0;net472 + true + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + diff --git a/src/embed_tests/References.cs b/Python.Test.Embed/References.cs similarity index 100% rename from src/embed_tests/References.cs rename to Python.Test.Embed/References.cs diff --git a/src/embed_tests/TestCallbacks.cs b/Python.Test.Embed/TestCallbacks.cs similarity index 86% rename from src/embed_tests/TestCallbacks.cs rename to Python.Test.Embed/TestCallbacks.cs index 220b0a86a..3d1946c78 100644 --- a/src/embed_tests/TestCallbacks.cs +++ b/Python.Test.Embed/TestCallbacks.cs @@ -25,9 +25,12 @@ public void TestNoOverloadException() { dynamic callWith42 = PythonEngine.Eval("lambda f: f([42])"); var error = Assert.Throws(() => callWith42(aFunctionThatCallsIntoPython.ToPython())); Assert.AreEqual("TypeError", error.PythonTypeName); - string expectedArgTypes = Runtime.IsPython2 - ? "()" - : "()"; + string expectedArgTypes = +#if PYTHON2 + "()"; +#else + "()"; +#endif StringAssert.EndsWith(expectedArgTypes, error.Message); } } diff --git a/src/embed_tests/TestConverter.cs b/Python.Test.Embed/TestConverter.cs similarity index 100% rename from src/embed_tests/TestConverter.cs rename to Python.Test.Embed/TestConverter.cs diff --git a/src/embed_tests/TestCustomMarshal.cs b/Python.Test.Embed/TestCustomMarshal.cs similarity index 100% rename from src/embed_tests/TestCustomMarshal.cs rename to Python.Test.Embed/TestCustomMarshal.cs diff --git a/src/embed_tests/TestDomainReload.cs b/Python.Test.Embed/TestDomainReload.cs similarity index 99% rename from src/embed_tests/TestDomainReload.cs rename to Python.Test.Embed/TestDomainReload.cs index b162d4eb0..e925d761b 100644 --- a/src/embed_tests/TestDomainReload.cs +++ b/Python.Test.Embed/TestDomainReload.cs @@ -11,7 +11,7 @@ // // Unfortunately this means no continuous integration testing for this case. // -#if !NETSTANDARD && !NETCOREAPP +#if NETFX namespace Python.EmbeddingTest { class TestDomainReload diff --git a/src/embed_tests/TestExample.cs b/Python.Test.Embed/TestExample.cs similarity index 100% rename from src/embed_tests/TestExample.cs rename to Python.Test.Embed/TestExample.cs diff --git a/src/embed_tests/TestFinalizer.cs b/Python.Test.Embed/TestFinalizer.cs similarity index 100% rename from src/embed_tests/TestFinalizer.cs rename to Python.Test.Embed/TestFinalizer.cs diff --git a/src/embed_tests/TestGILState.cs b/Python.Test.Embed/TestGILState.cs similarity index 100% rename from src/embed_tests/TestGILState.cs rename to Python.Test.Embed/TestGILState.cs diff --git a/src/embed_tests/TestInstanceWrapping.cs b/Python.Test.Embed/TestInstanceWrapping.cs similarity index 100% rename from src/embed_tests/TestInstanceWrapping.cs rename to Python.Test.Embed/TestInstanceWrapping.cs diff --git a/src/embed_tests/TestNamedArguments.cs b/Python.Test.Embed/TestNamedArguments.cs similarity index 100% rename from src/embed_tests/TestNamedArguments.cs rename to Python.Test.Embed/TestNamedArguments.cs diff --git a/src/embed_tests/TestPyAnsiString.cs b/Python.Test.Embed/TestPyAnsiString.cs similarity index 100% rename from src/embed_tests/TestPyAnsiString.cs rename to Python.Test.Embed/TestPyAnsiString.cs diff --git a/src/embed_tests/TestPyFloat.cs b/Python.Test.Embed/TestPyFloat.cs similarity index 100% rename from src/embed_tests/TestPyFloat.cs rename to Python.Test.Embed/TestPyFloat.cs diff --git a/src/embed_tests/TestPyInt.cs b/Python.Test.Embed/TestPyInt.cs similarity index 100% rename from src/embed_tests/TestPyInt.cs rename to Python.Test.Embed/TestPyInt.cs diff --git a/src/embed_tests/TestPyList.cs b/Python.Test.Embed/TestPyList.cs similarity index 100% rename from src/embed_tests/TestPyList.cs rename to Python.Test.Embed/TestPyList.cs diff --git a/src/embed_tests/TestPyLong.cs b/Python.Test.Embed/TestPyLong.cs similarity index 100% rename from src/embed_tests/TestPyLong.cs rename to Python.Test.Embed/TestPyLong.cs diff --git a/src/embed_tests/TestPyNumber.cs b/Python.Test.Embed/TestPyNumber.cs similarity index 100% rename from src/embed_tests/TestPyNumber.cs rename to Python.Test.Embed/TestPyNumber.cs diff --git a/src/embed_tests/TestPyObject.cs b/Python.Test.Embed/TestPyObject.cs similarity index 100% rename from src/embed_tests/TestPyObject.cs rename to Python.Test.Embed/TestPyObject.cs diff --git a/src/embed_tests/TestPyScope.cs b/Python.Test.Embed/TestPyScope.cs similarity index 100% rename from src/embed_tests/TestPyScope.cs rename to Python.Test.Embed/TestPyScope.cs diff --git a/src/embed_tests/TestPySequence.cs b/Python.Test.Embed/TestPySequence.cs similarity index 100% rename from src/embed_tests/TestPySequence.cs rename to Python.Test.Embed/TestPySequence.cs diff --git a/src/embed_tests/TestPyString.cs b/Python.Test.Embed/TestPyString.cs similarity index 100% rename from src/embed_tests/TestPyString.cs rename to Python.Test.Embed/TestPyString.cs diff --git a/src/embed_tests/TestPyTuple.cs b/Python.Test.Embed/TestPyTuple.cs similarity index 100% rename from src/embed_tests/TestPyTuple.cs rename to Python.Test.Embed/TestPyTuple.cs diff --git a/src/embed_tests/TestPyWith.cs b/Python.Test.Embed/TestPyWith.cs similarity index 100% rename from src/embed_tests/TestPyWith.cs rename to Python.Test.Embed/TestPyWith.cs diff --git a/src/embed_tests/TestPythonEngineProperties.cs b/Python.Test.Embed/TestPythonEngineProperties.cs similarity index 100% rename from src/embed_tests/TestPythonEngineProperties.cs rename to Python.Test.Embed/TestPythonEngineProperties.cs diff --git a/src/embed_tests/TestPythonException.cs b/Python.Test.Embed/TestPythonException.cs similarity index 100% rename from src/embed_tests/TestPythonException.cs rename to Python.Test.Embed/TestPythonException.cs diff --git a/src/embed_tests/TestRuntime.cs b/Python.Test.Embed/TestRuntime.cs similarity index 100% rename from src/embed_tests/TestRuntime.cs rename to Python.Test.Embed/TestRuntime.cs diff --git a/src/embed_tests/TestTypeManager.cs b/Python.Test.Embed/TestTypeManager.cs similarity index 100% rename from src/embed_tests/TestTypeManager.cs rename to Python.Test.Embed/TestTypeManager.cs diff --git a/src/embed_tests/dynamic.cs b/Python.Test.Embed/dynamic.cs similarity index 100% rename from src/embed_tests/dynamic.cs rename to Python.Test.Embed/dynamic.cs diff --git a/src/embed_tests/fixtures/PyImportTest/__init__.py b/Python.Test.Embed/fixtures/PyImportTest/__init__.py similarity index 100% rename from src/embed_tests/fixtures/PyImportTest/__init__.py rename to Python.Test.Embed/fixtures/PyImportTest/__init__.py diff --git a/src/embed_tests/fixtures/PyImportTest/cast_global_var.py b/Python.Test.Embed/fixtures/PyImportTest/cast_global_var.py similarity index 100% rename from src/embed_tests/fixtures/PyImportTest/cast_global_var.py rename to Python.Test.Embed/fixtures/PyImportTest/cast_global_var.py diff --git a/src/embed_tests/fixtures/PyImportTest/sysargv.py b/Python.Test.Embed/fixtures/PyImportTest/sysargv.py similarity index 100% rename from src/embed_tests/fixtures/PyImportTest/sysargv.py rename to Python.Test.Embed/fixtures/PyImportTest/sysargv.py diff --git a/src/embed_tests/fixtures/PyImportTest/test/__init__.py b/Python.Test.Embed/fixtures/PyImportTest/test/__init__.py similarity index 100% rename from src/embed_tests/fixtures/PyImportTest/test/__init__.py rename to Python.Test.Embed/fixtures/PyImportTest/test/__init__.py diff --git a/src/embed_tests/fixtures/PyImportTest/test/one.py b/Python.Test.Embed/fixtures/PyImportTest/test/one.py similarity index 100% rename from src/embed_tests/fixtures/PyImportTest/test/one.py rename to Python.Test.Embed/fixtures/PyImportTest/test/one.py diff --git a/src/embed_tests/packages.config b/Python.Test.Embed/packages.config similarity index 100% rename from src/embed_tests/packages.config rename to Python.Test.Embed/packages.config diff --git a/src/embed_tests/pyimport.cs b/Python.Test.Embed/pyimport.cs similarity index 100% rename from src/embed_tests/pyimport.cs rename to Python.Test.Embed/pyimport.cs diff --git a/src/embed_tests/pyinitialize.cs b/Python.Test.Embed/pyinitialize.cs similarity index 100% rename from src/embed_tests/pyinitialize.cs rename to Python.Test.Embed/pyinitialize.cs diff --git a/src/embed_tests/pyrunstring.cs b/Python.Test.Embed/pyrunstring.cs similarity index 100% rename from src/embed_tests/pyrunstring.cs rename to Python.Test.Embed/pyrunstring.cs diff --git a/src/testing/InheritanceTest.cs b/Python.Test.Helper/InheritanceTest.cs similarity index 100% rename from src/testing/InheritanceTest.cs rename to Python.Test.Helper/InheritanceTest.cs diff --git a/Python.Test.Helper/Python.Test.Helper.csproj b/Python.Test.Helper/Python.Test.Helper.csproj new file mode 100644 index 000000000..32a5e7129 --- /dev/null +++ b/Python.Test.Helper/Python.Test.Helper.csproj @@ -0,0 +1,15 @@ + + + + + + + + + + + + netstandard2.0 + + + diff --git a/src/testing/ReprTest.cs b/Python.Test.Helper/ReprTest.cs similarity index 100% rename from src/testing/ReprTest.cs rename to Python.Test.Helper/ReprTest.cs diff --git a/src/testing/arraytest.cs b/Python.Test.Helper/arraytest.cs similarity index 100% rename from src/testing/arraytest.cs rename to Python.Test.Helper/arraytest.cs diff --git a/src/testing/callbacktest.cs b/Python.Test.Helper/callbacktest.cs similarity index 100% rename from src/testing/callbacktest.cs rename to Python.Test.Helper/callbacktest.cs diff --git a/src/testing/classtest.cs b/Python.Test.Helper/classtest.cs similarity index 100% rename from src/testing/classtest.cs rename to Python.Test.Helper/classtest.cs diff --git a/src/testing/constructortests.cs b/Python.Test.Helper/constructortests.cs similarity index 100% rename from src/testing/constructortests.cs rename to Python.Test.Helper/constructortests.cs diff --git a/src/testing/conversiontest.cs b/Python.Test.Helper/conversiontest.cs similarity index 100% rename from src/testing/conversiontest.cs rename to Python.Test.Helper/conversiontest.cs diff --git a/src/testing/delegatetest.cs b/Python.Test.Helper/delegatetest.cs similarity index 100% rename from src/testing/delegatetest.cs rename to Python.Test.Helper/delegatetest.cs diff --git a/src/testing/doctest.cs b/Python.Test.Helper/doctest.cs similarity index 100% rename from src/testing/doctest.cs rename to Python.Test.Helper/doctest.cs diff --git a/src/testing/enumtest.cs b/Python.Test.Helper/enumtest.cs similarity index 100% rename from src/testing/enumtest.cs rename to Python.Test.Helper/enumtest.cs diff --git a/src/testing/eventtest.cs b/Python.Test.Helper/eventtest.cs similarity index 100% rename from src/testing/eventtest.cs rename to Python.Test.Helper/eventtest.cs diff --git a/src/testing/exceptiontest.cs b/Python.Test.Helper/exceptiontest.cs similarity index 100% rename from src/testing/exceptiontest.cs rename to Python.Test.Helper/exceptiontest.cs diff --git a/src/testing/fieldtest.cs b/Python.Test.Helper/fieldtest.cs similarity index 100% rename from src/testing/fieldtest.cs rename to Python.Test.Helper/fieldtest.cs diff --git a/src/testing/generictest.cs b/Python.Test.Helper/generictest.cs similarity index 100% rename from src/testing/generictest.cs rename to Python.Test.Helper/generictest.cs diff --git a/src/testing/globaltest.cs b/Python.Test.Helper/globaltest.cs similarity index 100% rename from src/testing/globaltest.cs rename to Python.Test.Helper/globaltest.cs diff --git a/src/testing/indexertest.cs b/Python.Test.Helper/indexertest.cs similarity index 100% rename from src/testing/indexertest.cs rename to Python.Test.Helper/indexertest.cs diff --git a/src/testing/interfacetest.cs b/Python.Test.Helper/interfacetest.cs similarity index 100% rename from src/testing/interfacetest.cs rename to Python.Test.Helper/interfacetest.cs diff --git a/src/testing/methodtest.cs b/Python.Test.Helper/methodtest.cs similarity index 100% rename from src/testing/methodtest.cs rename to Python.Test.Helper/methodtest.cs diff --git a/src/testing/moduletest.cs b/Python.Test.Helper/moduletest.cs similarity index 100% rename from src/testing/moduletest.cs rename to Python.Test.Helper/moduletest.cs diff --git a/src/testing/mp_lengthtest.cs b/Python.Test.Helper/mp_lengthtest.cs similarity index 100% rename from src/testing/mp_lengthtest.cs rename to Python.Test.Helper/mp_lengthtest.cs diff --git a/src/testing/propertytest.cs b/Python.Test.Helper/propertytest.cs similarity index 100% rename from src/testing/propertytest.cs rename to Python.Test.Helper/propertytest.cs diff --git a/src/testing/subclasstest.cs b/Python.Test.Helper/subclasstest.cs similarity index 100% rename from src/testing/subclasstest.cs rename to Python.Test.Helper/subclasstest.cs diff --git a/src/testing/threadtest.cs b/Python.Test.Helper/threadtest.cs similarity index 100% rename from src/testing/threadtest.cs rename to Python.Test.Helper/threadtest.cs diff --git a/src/perf_tests/BaselineComparisonBenchmarkBase.cs b/Python.Test.Performance/BaselineComparisonBenchmarkBase.cs similarity index 100% rename from src/perf_tests/BaselineComparisonBenchmarkBase.cs rename to Python.Test.Performance/BaselineComparisonBenchmarkBase.cs diff --git a/src/perf_tests/BaselineComparisonConfig.cs b/Python.Test.Performance/BaselineComparisonConfig.cs similarity index 100% rename from src/perf_tests/BaselineComparisonConfig.cs rename to Python.Test.Performance/BaselineComparisonConfig.cs diff --git a/src/perf_tests/BenchmarkTests.cs b/Python.Test.Performance/BenchmarkTests.cs similarity index 100% rename from src/perf_tests/BenchmarkTests.cs rename to Python.Test.Performance/BenchmarkTests.cs diff --git a/src/perf_tests/Python.PerformanceTests.csproj b/Python.Test.Performance/Python.Test.Performance.csproj similarity index 78% rename from src/perf_tests/Python.PerformanceTests.csproj rename to Python.Test.Performance/Python.Test.Performance.csproj index 25af89db0..545123b31 100644 --- a/src/perf_tests/Python.PerformanceTests.csproj +++ b/Python.Test.Performance/Python.Test.Performance.csproj @@ -1,12 +1,9 @@ - + - net461 - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - bin\ - + net472 false - + bin\ x64;x86 @@ -28,7 +25,7 @@ - + diff --git a/src/perf_tests/PythonCallingNetBenchmark.cs b/Python.Test.Performance/PythonCallingNetBenchmark.cs similarity index 100% rename from src/perf_tests/PythonCallingNetBenchmark.cs rename to Python.Test.Performance/PythonCallingNetBenchmark.cs diff --git a/net_test.py b/net_test.py new file mode 100644 index 000000000..2884afcbe --- /dev/null +++ b/net_test.py @@ -0,0 +1,26 @@ +import os +#os.environ["MONO_LOG_LEVEL"] = "debug" +# os.environ["MONO_LOG_MASK"] = "cfg,dll" +os.environ["COREHOST_DEBUG"] = "1" +os.environ["COREHOST_TRACE"] = "1" +os.environ["COREHOST_TRACE_VERBOSITY"] = "4" + +import pythonnet, clr_loader + +import sys + +if sys.argv[1] == "mono": + mono = clr_loader.get_mono() + rt = mono +elif sys.argv[1] == "core": + core = clr_loader.get_coreclr("/home/benedikt/git/clr-loader/example/out/example.runtimeconfig.json") + rt = core + +pythonnet.set_runtime(rt) +pythonnet.load() + +print("Loaded pythonnet") + +import clr +from System import Console +Console.WriteLine("Success") diff --git a/pythonnet.15.sln b/pythonnet.15.sln deleted file mode 100644 index ce863817f..000000000 --- a/pythonnet.15.sln +++ /dev/null @@ -1,398 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29102.190 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src\runtime\Python.Runtime.15.csproj", "{2759F4FF-716B-4828-916F-50FA86613DFC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src\embed_tests\Python.EmbeddingTest.15.csproj", "{66B8D01A-9906-452A-B09E-BF75EA76468F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clrmodule.15", "src\clrmodule\clrmodule.15.csproj", "{E08678D4-9A52-4AD5-B63D-8EBC7399981B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console.15", "src\console\Console.15.csproj", "{CDAD305F-8E72-492C-A314-64CF58D472A0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test.15", "src\testing\Python.Test.15.csproj", "{F94B547A-E97E-4500-8D53-B4D64D076E5F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.PerformanceTests", "src\perf_tests\Python.PerformanceTests.csproj", "{6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repo", "Repo", "{441A0123-F4C6-4EE4-9AEE-315FD79BE2D5}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - CHANGELOG.md = CHANGELOG.md - README.rst = README.rst - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{D301657F-5EAF-4534-B280-B858D651B2E5}" - ProjectSection(SolutionItems) = preProject - .travis.yml = .travis.yml - appveyor.yml = appveyor.yml - ci\appveyor_build_recipe.ps1 = ci\appveyor_build_recipe.ps1 - ci\appveyor_run_tests.ps1 = ci\appveyor_run_tests.ps1 - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{57F5D701-F265-4736-A5A2-07249E7A4DA3}" - ProjectSection(SolutionItems) = preProject - setup.py = setup.py - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conda.recipe", "conda.recipe", "{7FD2404D-0CE8-4645-8DFB-766470E2150E}" - ProjectSection(SolutionItems) = preProject - conda.recipe\bld.bat = conda.recipe\bld.bat - conda.recipe\meta.yaml = conda.recipe\meta.yaml - conda.recipe\README.md = conda.recipe\README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - DebugMono|Any CPU = DebugMono|Any CPU - DebugMono|x64 = DebugMono|x64 - DebugMono|x86 = DebugMono|x86 - DebugMonoPY3|Any CPU = DebugMonoPY3|Any CPU - DebugMonoPY3|x64 = DebugMonoPY3|x64 - DebugMonoPY3|x86 = DebugMonoPY3|x86 - DebugWin|Any CPU = DebugWin|Any CPU - DebugWin|x64 = DebugWin|x64 - DebugWin|x86 = DebugWin|x86 - DebugWinPY3|Any CPU = DebugWinPY3|Any CPU - DebugWinPY3|x64 = DebugWinPY3|x64 - DebugWinPY3|x86 = DebugWinPY3|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - ReleaseMono|Any CPU = ReleaseMono|Any CPU - ReleaseMono|x64 = ReleaseMono|x64 - ReleaseMono|x86 = ReleaseMono|x86 - ReleaseMonoPY3|Any CPU = ReleaseMonoPY3|Any CPU - ReleaseMonoPY3|x64 = ReleaseMonoPY3|x64 - ReleaseMonoPY3|x86 = ReleaseMonoPY3|x86 - ReleaseWin|Any CPU = ReleaseWin|Any CPU - ReleaseWin|x64 = ReleaseWin|x64 - ReleaseWin|x86 = ReleaseWin|x86 - ReleaseWinPY3|Any CPU = ReleaseWinPY3|Any CPU - ReleaseWinPY3|x64 = ReleaseWinPY3|x64 - ReleaseWinPY3|x86 = ReleaseWinPY3|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|Any CPU.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|Any CPU.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|x64.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|x64.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|x86.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Debug|x86.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|Any CPU.ActiveCfg = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|Any CPU.Build.0 = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|x64.ActiveCfg = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|x64.Build.0 = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|x86.ActiveCfg = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMono|x86.Build.0 = DebugMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|Any CPU.Build.0 = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|Any CPU.ActiveCfg = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|Any CPU.Build.0 = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|x64.ActiveCfg = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|x64.Build.0 = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|x86.ActiveCfg = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWin|x86.Build.0 = DebugWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|Any CPU.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|x64.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.DebugWinPY3|x86.Build.0 = DebugWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|Any CPU.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|Any CPU.Build.0 = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|x64.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|x64.Build.0 = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|x86.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.Release|x86.Build.0 = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|Any CPU.Build.0 = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|x64.ActiveCfg = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|x64.Build.0 = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|x86.ActiveCfg = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMono|x86.Build.0 = ReleaseMono|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|Any CPU.Build.0 = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|Any CPU.Build.0 = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|x64.ActiveCfg = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|x64.Build.0 = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWin|x86.Build.0 = ReleaseWin|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|Any CPU.Build.0 = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|Any CPU - {2759F4FF-716B-4828-916F-50FA86613DFC}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|Any CPU - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|Any CPU.Build.0 = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|x64.ActiveCfg = DebugWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|x64.Build.0 = DebugWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|x86.ActiveCfg = DebugWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Debug|x86.Build.0 = DebugWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMono|Any CPU.ActiveCfg = DebugMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMono|x64.Build.0 = DebugMono|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMono|x86.Build.0 = DebugMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWin|Any CPU.ActiveCfg = DebugWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWin|x64.Build.0 = DebugWin|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWin|x86.Build.0 = DebugWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|Any CPU.Build.0 = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|x64.ActiveCfg = ReleaseWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|x64.Build.0 = ReleaseWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|x86.ActiveCfg = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.Release|x86.Build.0 = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {66B8D01A-9906-452A-B09E-BF75EA76468F}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|Any CPU.Build.0 = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|x64.ActiveCfg = DebugWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|x64.Build.0 = DebugWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|x86.ActiveCfg = DebugWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Debug|x86.Build.0 = DebugWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMono|Any CPU.ActiveCfg = DebugMono|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWin|Any CPU.ActiveCfg = DebugWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWin|x64.Build.0 = DebugWin|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWin|x86.Build.0 = DebugWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|Any CPU.Build.0 = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|x64.ActiveCfg = ReleaseWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|x64.Build.0 = ReleaseWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|x86.ActiveCfg = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.Release|x86.Build.0 = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {E08678D4-9A52-4AD5-B63D-8EBC7399981B}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|Any CPU.Build.0 = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|x64.ActiveCfg = DebugWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|x64.Build.0 = DebugWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|x86.ActiveCfg = DebugWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Debug|x86.Build.0 = DebugWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMono|Any CPU.ActiveCfg = DebugMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMono|x64.Build.0 = DebugMono|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMono|x86.Build.0 = DebugMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWin|Any CPU.ActiveCfg = DebugWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWin|x64.Build.0 = DebugWin|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWin|x86.Build.0 = DebugWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|Any CPU.Build.0 = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|x64.ActiveCfg = ReleaseWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|x64.Build.0 = ReleaseWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|x86.ActiveCfg = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.Release|x86.Build.0 = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {CDAD305F-8E72-492C-A314-64CF58D472A0}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|Any CPU.Build.0 = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|x64.ActiveCfg = DebugWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|x64.Build.0 = DebugWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|x86.ActiveCfg = DebugWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Debug|x86.Build.0 = DebugWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMono|Any CPU.ActiveCfg = DebugMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMono|x64.Build.0 = DebugMono|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMono|x86.Build.0 = DebugMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWin|Any CPU.ActiveCfg = DebugWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWin|x64.Build.0 = DebugWin|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWin|x86.Build.0 = DebugWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|Any CPU.Build.0 = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|x64.ActiveCfg = ReleaseWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|x64.Build.0 = ReleaseWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|x86.ActiveCfg = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.Release|x86.Build.0 = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {F94B547A-E97E-4500-8D53-B4D64D076E5F}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|Any CPU.ActiveCfg = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|Any CPU.Build.0 = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|x64.ActiveCfg = DebugWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|x64.Build.0 = DebugWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|x86.ActiveCfg = DebugWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Debug|x86.Build.0 = DebugWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMono|Any CPU.ActiveCfg = DebugMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMono|x64.Build.0 = DebugMono|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMono|x86.Build.0 = DebugMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMonoPY3|Any CPU.ActiveCfg = DebugMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWin|Any CPU.ActiveCfg = DebugWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWin|x64.Build.0 = DebugWin|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWin|x86.Build.0 = DebugWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWinPY3|Any CPU.ActiveCfg = DebugWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|Any CPU.ActiveCfg = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|Any CPU.Build.0 = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|x64.ActiveCfg = ReleaseWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|x64.Build.0 = ReleaseWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|x86.ActiveCfg = ReleaseWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.Release|x86.Build.0 = ReleaseWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMono|Any CPU.ActiveCfg = ReleaseMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMonoPY3|Any CPU.ActiveCfg = ReleaseMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWin|Any CPU.ActiveCfg = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWinPY3|Any CPU.ActiveCfg = ReleaseWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {6FB0D091-9CEC-4DCC-8701-C40F9BFC9EDE}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A6347B90-BBE6-4E45-90BF-1BD8B76069E3} - EndGlobalSection -EndGlobal diff --git a/pythonnet.sln b/pythonnet.sln index c5afd66c3..602bb4dd7 100644 --- a/pythonnet.sln +++ b/pythonnet.sln @@ -1,202 +1,76 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Runtime", "src\runtime\Python.Runtime.csproj", "{097B4AC0-74E9-4C58-BCF8-C69746EC8271}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Test", "src\testing\Python.Test.csproj", "{6F401A34-273B-450F-9A4C-13550BE0767B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.EmbeddingTest", "src\embed_tests\Python.EmbeddingTest.csproj", "{4165C59D-2822-499F-A6DB-EACA4C331EB5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "src\console\Console.csproj", "{E29DCF0A-5114-4A98-B1DD-71264B6EA349}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "clrmodule", "src\clrmodule\clrmodule.csproj", "{86E834DE-1139-4511-96CC-69636A56E7AC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - DebugMono|x64 = DebugMono|x64 - DebugMono|x86 = DebugMono|x86 - DebugMonoPY3|x64 = DebugMonoPY3|x64 - DebugMonoPY3|x86 = DebugMonoPY3|x86 - DebugWin|x64 = DebugWin|x64 - DebugWin|x86 = DebugWin|x86 - DebugWinPY3|x64 = DebugWinPY3|x64 - DebugWinPY3|x86 = DebugWinPY3|x86 - ReleaseMono|x64 = ReleaseMono|x64 - ReleaseMono|x86 = ReleaseMono|x86 - ReleaseMonoPY3|x64 = ReleaseMonoPY3|x64 - ReleaseMonoPY3|x86 = ReleaseMonoPY3|x86 - ReleaseWin|x64 = ReleaseWin|x64 - ReleaseWin|x86 = ReleaseWin|x86 - ReleaseWinPY3|x64 = ReleaseWinPY3|x64 - ReleaseWinPY3|x86 = ReleaseWinPY3|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMono|x64.Build.0 = DebugMono|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMono|x86.Build.0 = DebugMono|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWin|x64.Build.0 = DebugWin|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWin|x86.Build.0 = DebugWin|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {097B4AC0-74E9-4C58-BCF8-C69746EC8271}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMono|x64.Build.0 = DebugMono|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMono|x86.Build.0 = DebugMono|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWin|x64.Build.0 = DebugWin|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWin|x86.Build.0 = DebugWin|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {6F401A34-273B-450F-9A4C-13550BE0767B}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMono|x64.Build.0 = DebugMono|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMono|x86.Build.0 = DebugMono|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWin|x64.Build.0 = DebugWin|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWin|x86.Build.0 = DebugWin|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {4165C59D-2822-499F-A6DB-EACA4C331EB5}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMono|x64.Build.0 = DebugMono|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMono|x86.Build.0 = DebugMono|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMonoPY3|x64.Build.0 = DebugMonoPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugMonoPY3|x86.Build.0 = DebugMonoPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWin|x64.Build.0 = DebugWin|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWin|x86.Build.0 = DebugWin|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMono|x64.Build.0 = ReleaseMono|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMono|x86.Build.0 = ReleaseMono|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMonoPY3|x64.Build.0 = ReleaseMonoPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseMonoPY3|x86.Build.0 = ReleaseMonoPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {E29DCF0A-5114-4A98-B1DD-71264B6EA349}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugMono|x64.ActiveCfg = DebugMono|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugMono|x86.ActiveCfg = DebugMono|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugMonoPY3|x64.ActiveCfg = DebugMonoPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugMonoPY3|x86.ActiveCfg = DebugMonoPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWin|x64.ActiveCfg = DebugWin|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWin|x64.Build.0 = DebugWin|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWin|x86.ActiveCfg = DebugWin|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWin|x86.Build.0 = DebugWin|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWinPY3|x64.ActiveCfg = DebugWinPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWinPY3|x64.Build.0 = DebugWinPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWinPY3|x86.ActiveCfg = DebugWinPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.DebugWinPY3|x86.Build.0 = DebugWinPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseMono|x64.ActiveCfg = ReleaseMono|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseMono|x86.ActiveCfg = ReleaseMono|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseMonoPY3|x64.ActiveCfg = ReleaseMonoPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseMonoPY3|x86.ActiveCfg = ReleaseMonoPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWin|x64.Build.0 = ReleaseWin|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWin|x86.Build.0 = ReleaseWin|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWinPY3|x64.ActiveCfg = ReleaseWinPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWinPY3|x64.Build.0 = ReleaseWinPY3|x64 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWinPY3|x86.ActiveCfg = ReleaseWinPY3|x86 - {86E834DE-1139-4511-96CC-69636A56E7AC}.ReleaseWinPY3|x86.Build.0 = ReleaseWinPY3|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = src\console\Console.csproj - Policies = $0 - $0.VersionControlPolicy = $1 - $1.inheritsSet = Mono - $0.ChangeLogPolicy = $2 - $2.UpdateMode = None - $2.MessageStyle = $3 - $3.LineAlign = 0 - $2.inheritsSet = Mono - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Runtime", "Python.Runtime\Python.Runtime.csproj", "{C9E02762-3DD2-4669-81DA-6A64C80D07E0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Test.Embed", "Python.Test.Embed\Python.Test.Embed.csproj", "{298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Test.Helper", "Python.Test.Helper\Python.Test.Helper.csproj", "{23C09493-58CD-4B50-A24E-64B56A967DCC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Test.Performance", "Python.Test.Performance\Python.Test.Performance.csproj", "{A232F9F5-3A03-431F-8863-0BA177D650BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|x64.ActiveCfg = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|x64.Build.0 = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|x86.ActiveCfg = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Debug|x86.Build.0 = Debug|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|Any CPU.Build.0 = Release|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|x64.ActiveCfg = Release|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|x64.Build.0 = Release|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|x86.ActiveCfg = Release|Any CPU + {C9E02762-3DD2-4669-81DA-6A64C80D07E0}.Release|x86.Build.0 = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|x64.ActiveCfg = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|x64.Build.0 = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|x86.ActiveCfg = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Debug|x86.Build.0 = Debug|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|Any CPU.Build.0 = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|x64.ActiveCfg = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|x64.Build.0 = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|x86.ActiveCfg = Release|Any CPU + {298D6A0A-C41B-4B6D-ABF6-1E24A1BF223C}.Release|x86.Build.0 = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|x64.ActiveCfg = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|x64.Build.0 = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|x86.ActiveCfg = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Debug|x86.Build.0 = Debug|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|Any CPU.Build.0 = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|x64.ActiveCfg = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|x64.Build.0 = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|x86.ActiveCfg = Release|Any CPU + {23C09493-58CD-4B50-A24E-64B56A967DCC}.Release|x86.Build.0 = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|x64.ActiveCfg = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|x64.Build.0 = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|x86.ActiveCfg = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Debug|x86.Build.0 = Debug|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|Any CPU.Build.0 = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|x64.ActiveCfg = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|x64.Build.0 = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|x86.ActiveCfg = Release|Any CPU + {A232F9F5-3A03-431F-8863-0BA177D650BA}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/pythonnet/__init__.py b/pythonnet/__init__.py new file mode 100644 index 000000000..cf9c95bca --- /dev/null +++ b/pythonnet/__init__.py @@ -0,0 +1,51 @@ +import os +import sys + +_RUNTIME = None +_LOADER_ASSEMBLY = None +_FFI = None + + +def set_runtime(runtime): + global _RUNTIME + _RUNTIME = runtime + + +def _find_libpython(): + v = sys.version_info + lib_name = f"libpython{v.major}.{v.minor}{sys.abiflags}.so" + lib_path = os.path.join(os.path.dirname(os.path.dirname(sys.executable)), "lib", lib_name) + # return "__Internal" + return lib_path + + +def load(): + dll_path = os.path.join(os.path.dirname(__file__), "dlls", "Python.Loader.dll") + runtime_dll_path = os.path.join(os.path.dirname(dll_path), "Python.Runtime.dll") + libpython = _find_libpython() + + global _FFI, _LOADED + if _FFI is None and libpython != "__Internal": + # Load and leak libpython handle s.t. the .NET runtime doesn't dlcloses it + import posix + + import cffi + _FFI = cffi.FFI() + _FFI.dlopen(libpython, posix.RTLD_NODELETE | posix.RTLD_LOCAL) + + global _LOADER_ASSEMBLY + _LOADER_ASSEMBLY = _RUNTIME.get_assembly(dll_path) + + func = _LOADER_ASSEMBLY["Python.Internal.Initialize"] + if func(f"{runtime_dll_path};{libpython}".encode("utf8")) != 0: + raise RuntimeError("Failed to initialize Python.Runtime.dll") + + import atexit + atexit.register(unload) + + +def unload(): + if _LOADER_ASSEMBLY is not None: + func = _LOADER_ASSEMBLY["Python.Internal.Shutdown"] + if func(b"") != 0: + raise RuntimeError("Failed to call Python.NET shutdown") diff --git a/setup.cfg b/setup.cfg index 38aa3eb3d..0c9e0fc14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,2 @@ -# [bumpversion] comments. bumpversion deleted all comments on its file. -# Don't combine `.bumpversion.cfg` with `setup.cfg`. Messes up formatting. -# Don't use `first_value = 1`. It will break `release` bump -# Keep `optional = dummy` needed to bump to release. -# See: https://github.com/peritus/bumpversion/issues/59 - -[tool:pytest] -xfail_strict = True -# -r fsxX: show extra summary info for: (f)ailed, (s)kip, (x)failed, (X)passed -addopts = -r fsxX --color=yes --durations=5 +[metadata] +license_file = LICENSE diff --git a/setup.py b/setup.py index cabb176af..5527f6f2f 100644 --- a/setup.py +++ b/setup.py @@ -1,650 +1,68 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Setup script for building clr.pyd and dependencies using mono and into -an egg or wheel. -""" +from setuptools import setup, find_packages, Command, Extension +from wheel.bdist_wheel import bdist_wheel -import collections -import fnmatch -import glob -import os -import subprocess -import sys -import sysconfig -from distutils import spawn -from distutils.command import install, build, build_ext, install_data, install_lib -from setuptools import Extension, setup +class DotnetLib(Extension): + def __init__(self, name, path, **kwargs): + self.path = path + self.args = kwargs + super().__init__(name, sources=[]) -try: - from wheel import bdist_wheel -except ImportError: - bdist_wheel = None -# Allow config/verbosity to be set from cli -# http://stackoverflow.com/a/4792601/5208670 -CONFIG = "Release" # Release or Debug -VERBOSITY = "normal" # quiet, minimal, normal, detailed, diagnostic +class BuildDotnet(Command): + """Build command for dotnet-cli based builds""" -is_64bits = sys.maxsize > 2 ** 32 -DEVTOOLS = "MsDev" if sys.platform == "win32" else "Mono" -ARCH = "x64" if is_64bits else "x86" -PY_MAJOR = sys.version_info[0] -PY_MINOR = sys.version_info[1] - -############################################################################### -# Windows Keys Constants for MSBUILD tools -RegKey = collections.namedtuple("RegKey", "sdk_name key value_name suffix") -vs_python = "Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\WinSDK" -vs_root = "SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\{0}" -sdks_root = "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v{0}Win32Tools" -kits_root = "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots" -kits_suffix = os.path.join("bin", ARCH) - -WIN_SDK_KEYS = [ - RegKey( - sdk_name="Windows Kit 10.0", - key=kits_root, - value_name="KitsRoot10", - suffix=os.path.join("bin", "10.0.16299.0", ARCH), - ), - RegKey( - sdk_name="Windows Kit 10.0", - key=kits_root, - value_name="KitsRoot10", - suffix=os.path.join("bin", "10.0.15063.0", ARCH), - ), - RegKey( - sdk_name="Windows Kit 10.0", - key=kits_root, - value_name="KitsRoot10", - suffix=kits_suffix, - ), - RegKey( - sdk_name="Windows Kit 8.1", - key=kits_root, - value_name="KitsRoot81", - suffix=kits_suffix, - ), - RegKey( - sdk_name="Windows Kit 8.0", - key=kits_root, - value_name="KitsRoot", - suffix=kits_suffix, - ), - RegKey( - sdk_name="Windows SDK 7.1A", - key=sdks_root.format("7.1A\\WinSDK-"), - value_name="InstallationFolder", - suffix="", - ), - RegKey( - sdk_name="Windows SDK 7.1", - key=sdks_root.format("7.1\\WinSDK"), - value_name="InstallationFolder", - suffix="", - ), - RegKey( - sdk_name="Windows SDK 7.0A", - key=sdks_root.format("7.0A\\WinSDK-"), - value_name="InstallationFolder", - suffix="", - ), - RegKey( - sdk_name="Windows SDK 7.0", - key=sdks_root.format("7.0\\WinSDK"), - value_name="InstallationFolder", - suffix="", - ), - RegKey( - sdk_name="Windows SDK 6.0A", - key=sdks_root.format("6.0A\\WinSDK"), - value_name="InstallationFolder", - suffix="", - ), -] - -VS_KEYS = ( - RegKey( - sdk_name="MSBuild 15", - key=vs_root.format("15.0"), - value_name="MSBuildToolsPath", - suffix="", - ), - RegKey( - sdk_name="MSBuild 14", - key=vs_root.format("14.0"), - value_name="MSBuildToolsPath", - suffix="", - ), - RegKey( - sdk_name="MSBuild 12", - key=vs_root.format("12.0"), - value_name="MSBuildToolsPath", - suffix="", - ), - RegKey( - sdk_name="MSBuild 4", - key=vs_root.format("4.0"), - value_name="MSBuildToolsPath", - suffix="", - ), - RegKey( - sdk_name="MSBuild 3.5", - key=vs_root.format("3.5"), - value_name="MSBuildToolsPath", - suffix="", - ), - RegKey( - sdk_name="MSBuild 2.0", - key=vs_root.format("2.0"), - value_name="MSBuildToolsPath", - suffix="", - ), -) - - -############################################################################### -def _check_output(*args, **kwargs): - """Check output wrapper for py2/py3 compatibility""" - output = subprocess.check_output(*args, **kwargs) - if PY_MAJOR == 2: - return output - return output.decode("ascii") - - -def _get_interop_filename(): - """interopXX.cs is auto-generated as part of the build. - For common windows platforms pre-generated files are included - as most windows users won't have Clang installed, which is - required to generate the file. - """ - interop_filename = "interop{0}{1}{2}.cs".format( - PY_MAJOR, PY_MINOR, getattr(sys, "abiflags", "") - ) - return os.path.join("src", "runtime", interop_filename) - - -def _get_source_files(): - """Walk project and collect the files needed for ext_module""" - for ext in (".sln",): - for path in glob.glob("*" + ext): - yield path - - for root, dirnames, filenames in os.walk("src"): - for ext in (".cs", ".csproj", ".snk", ".config", ".py", ".c", ".h", ".ico"): - for filename in fnmatch.filter(filenames, "*" + ext): - yield os.path.join(root, filename) - - for root, dirnames, filenames in os.walk("tools"): - for ext in (".exe", ".py", ".c", ".h"): - for filename in fnmatch.filter(filenames, "*" + ext): - yield os.path.join(root, filename) - - -def _get_long_description(): - """Helper to populate long_description for pypi releases""" - return open("README.rst").read() - - -def _update_xlat_devtools(): - global DEVTOOLS - if DEVTOOLS == "MsDev": - DEVTOOLS = "MsDev15" - elif DEVTOOLS == "Mono": - DEVTOOLS = "dotnet" - - -def _collect_installed_windows_kits_v10(winreg): - """Adds the installed Windows 10 kits to WIN_SDK_KEYS """ - global WIN_SDK_KEYS - installed_kits = [] - - with winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, kits_root, 0, winreg.KEY_READ - ) as key: - i = 0 - while True: - try: - installed_kits.append(winreg.EnumKey(key, i)) - i += 1 - except WindowsError: - break - - def make_reg_key(version): - return RegKey( - sdk_name="Windows Kit 10.0", - key=kits_root, - value_name="KitsRoot10", - suffix=os.path.join("bin", version, ARCH), - ) - - WIN_SDK_KEYS += [make_reg_key(e) for e in installed_kits if e.startswith("10.")] - - # Make sure this function won't be called again - _collect_installed_windows_kits_v10 = lambda: None - - -class BuildExtPythonnet(build_ext.build_ext): - user_options = build_ext.build_ext.user_options + [("xplat", None, None)] + description = "Build DLLs with dotnet-cli" + user_options = [("dotnet-config", None, "dotnet build configuration")] def initialize_options(self): - build_ext.build_ext.initialize_options(self) - self.xplat = None + self.dotnet_config = "release" def finalize_options(self): - build_ext.build_ext.finalize_options(self) - - def build_extension(self, ext): - if self.xplat: - _update_xlat_devtools() - - """Builds the .pyd file using msbuild or xbuild""" - if ext.name != "clr": - return build_ext.build_ext.build_extension(self, ext) - - # install packages using nuget - self._install_packages() - - dest_file = self.get_ext_fullpath(ext.name) - dest_dir = os.path.dirname(dest_file) - if not os.path.exists(dest_dir): - os.makedirs(dest_dir) - - # Up to Python 3.2 sys.maxunicode is used to determine the size of - # Py_UNICODE, but from 3.3 onwards Py_UNICODE is a typedef of wchar_t. - # TODO: Is this doing the right check for Py27? - if sys.version_info[:2] <= (3, 2): - unicode_width = 2 if sys.maxunicode < 0x10FFFF else 4 - else: - import ctypes - - unicode_width = ctypes.sizeof(ctypes.c_wchar) - - defines = [ - "PYTHON{0}{1}".format(PY_MAJOR, PY_MINOR), - "PYTHON{0}".format(PY_MAJOR), # Python Major Version - "UCS{0}".format(unicode_width), - ] - - if CONFIG == "Debug": - defines.extend(["DEBUG", "TRACE"]) - - if sys.platform != "win32" and (DEVTOOLS == "Mono" or DEVTOOLS == "dotnet"): - on_darwin = sys.platform == "darwin" - defines.append("MONO_OSX" if on_darwin else "MONO_LINUX") - - # Check if --enable-shared was set when Python was built - enable_shared = sysconfig.get_config_var("Py_ENABLE_SHARED") - if enable_shared: - # Double-check if libpython is linked dynamically with python - ldd_cmd = ["otool", "-L"] if on_darwin else ["ldd"] - lddout = _check_output(ldd_cmd + [sys.executable]) - if "libpython" not in lddout: - enable_shared = False - - if not enable_shared: - defines.append("PYTHON_WITHOUT_ENABLE_SHARED") - - if hasattr(sys, "abiflags"): - if "d" in sys.abiflags: - defines.append("PYTHON_WITH_PYDEBUG") - if "m" in sys.abiflags: - defines.append("PYTHON_WITH_PYMALLOC") - - # check the interop file exists, and create it if it doesn't - interop_file = _get_interop_filename() - if not os.path.exists(interop_file): - self.debug_print("Creating {0}".format(interop_file)) - geninterop = os.path.join("tools", "geninterop", "geninterop.py") - subprocess.check_call([sys.executable, geninterop, interop_file]) - - if DEVTOOLS == "MsDev": - _xbuild = '"{0}"'.format(self._find_msbuild_tool("msbuild.exe")) - _config = "{0}Win".format(CONFIG) - _solution_file = "pythonnet.sln" - _custom_define_constants = False - elif DEVTOOLS == "MsDev15": - _xbuild = '"{0}"'.format(self._find_msbuild_tool_15()) - _config = "{0}Win".format(CONFIG) - _solution_file = "pythonnet.15.sln" - _custom_define_constants = True - elif DEVTOOLS == "Mono": - _xbuild = "xbuild" - _config = "{0}Mono".format(CONFIG) - _solution_file = "pythonnet.sln" - _custom_define_constants = False - elif DEVTOOLS == "dotnet": - _xbuild = "dotnet msbuild" - _config = "{0}Mono".format(CONFIG) - _solution_file = "pythonnet.15.sln" - _custom_define_constants = True - else: - raise NotImplementedError( - "DevTool {0} not supported (use MsDev/MsDev15/Mono/dotnet)".format( - DEVTOOLS - ) - ) - - cmd = [ - _xbuild, - _solution_file, - "/p:Configuration={}".format(_config), - "/p:Platform={}".format(ARCH), - '/p:{}DefineConstants="{}"'.format( - "Custom" if _custom_define_constants else "", "%3B".join(defines) - ), - '/p:PythonBuildDir="{}"'.format(os.path.abspath(dest_dir)), - '/p:PythonInteropFile="{}"'.format(os.path.basename(interop_file)), - "/p:PackageId=pythonnet_py{0}{1}_{2}".format(PY_MAJOR, PY_MINOR, ARCH), - "/verbosity:{}".format(VERBOSITY), - ] - - manifest = self._get_manifest(dest_dir) - if manifest: - cmd.append('/p:PythonManifest="{0}"'.format(manifest)) - - self.debug_print("Building: {0}".format(" ".join(cmd))) - use_shell = True if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" else False - - subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell) - subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell) - if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet": - subprocess.check_call( - " ".join( - cmd - + [ - '"/t:Console_15:publish;Python_EmbeddingTest_15:publish"', - "/p:TargetFramework=netcoreapp2.0", - ] - ), - shell=use_shell, - ) - subprocess.check_call( - " ".join( - cmd - + [ - '"/t:Python_PerformanceTests:publish"', - "/p:TargetFramework=net461", - ] - ), - shell=use_shell, - ) - if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet": - self._build_monoclr() - - def _get_manifest(self, build_dir): - if DEVTOOLS != "MsDev" and DEVTOOLS != "MsDev15": - return - mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True) - manifest = os.path.abspath(os.path.join(build_dir, "app.manifest")) - cmd = [ - mt, - '-inputresource:"{0}"'.format(sys.executable), - '-out:"{0}"'.format(manifest), - ] - self.debug_print("Extracting manifest from {}".format(sys.executable)) - subprocess.check_call(" ".join(cmd), shell=False) - return manifest - - def _build_monoclr(self): - try: - mono_libs = _check_output("pkg-config --libs mono-2", shell=True) - except: - if DEVTOOLS == "dotnet": - print("Skipping building monoclr module...") - return - raise - mono_cflags = _check_output("pkg-config --cflags mono-2", shell=True) - glib_libs = _check_output("pkg-config --libs glib-2.0", shell=True) - glib_cflags = _check_output("pkg-config --cflags glib-2.0", shell=True) - cflags = mono_cflags.strip() + " " + glib_cflags.strip() - libs = mono_libs.strip() + " " + glib_libs.strip() - - # build the clr python module - clr_ext = Extension( - "clr", - sources=["src/monoclr/pynetinit.c", "src/monoclr/clrmod.c"], - extra_compile_args=cflags.split(" "), - extra_link_args=libs.split(" "), - ) - - build_ext.build_ext.build_extension(self, clr_ext) - - def _install_packages(self): - """install packages using nuget""" - use_shell = DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" - - if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet": - if DEVTOOLS == "MsDev15": - _config = "{0}Win".format(CONFIG) - elif DEVTOOLS == "dotnet": - _config = "{0}Mono".format(CONFIG) - - cmd = "dotnet msbuild /t:Restore pythonnet.15.sln /p:Configuration={0} /p:Platform={1}".format( - _config, ARCH - ) - self.debug_print("Updating packages with xplat: {0}".format(cmd)) - subprocess.check_call(cmd, shell=use_shell) - else: - nuget = os.path.join("tools", "nuget", "nuget.exe") - - if DEVTOOLS == "Mono": - nuget = "mono {0}".format(nuget) - - cmd = "{0} update -self".format(nuget) - self.debug_print("Updating NuGet: {0}".format(cmd)) - subprocess.check_call(cmd, shell=use_shell) + pass - try: - # msbuild=14 is mainly for Mono issues - cmd = "{0} restore pythonnet.sln -MSBuildVersion 14 -o packages".format( - nuget - ) - self.debug_print("Installing packages: {0}".format(cmd)) - subprocess.check_call(cmd, shell=use_shell) - except: - # when only VS 2017 is installed do not specify msbuild version - cmd = "{0} restore pythonnet.sln -o packages".format(nuget) - self.debug_print("Installing packages: {0}".format(cmd)) - subprocess.check_call(cmd, shell=use_shell) + def get_source_files(self): + return [] - def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): - """Return full path to one of the Microsoft build tools""" - - # trying to search path with help of vswhere when MSBuild 15.0 and higher installed. - if tool == "msbuild.exe" and use_windows_sdk == False: - try: - basePaths = subprocess.check_output( - [ - "tools\\vswhere\\vswhere.exe", - "-latest", - "-version", - "[15.0,)", - "-requires", - "Microsoft.Component.MSBuild", - "-find", - "MSBuild\**\Bin\MSBuild.exe", - ] - ).splitlines() - if len(basePaths): - return basePaths[0].decode(sys.stdout.encoding or "utf-8") - except: - pass # keep trying to search by old method. - - # Search in PATH first - path = spawn.find_executable(tool) - if path: - return path - - # Search within registry to find build tools - try: # PY2 - import _winreg as winreg - except ImportError: # PY3 - import winreg - - _collect_installed_windows_kits_v10(winreg) - - keys_to_check = WIN_SDK_KEYS if use_windows_sdk else VS_KEYS - hklm = winreg.HKEY_LOCAL_MACHINE - for rkey in keys_to_check: - try: - with winreg.OpenKey(hklm, rkey.key) as hkey: - val, type_ = winreg.QueryValueEx(hkey, rkey.value_name) - if type_ != winreg.REG_SZ: - continue - path = os.path.join(val, rkey.suffix, tool) - if os.path.exists(path): - self.debug_print( - "Using {0} from {1}".format(tool, rkey.sdk_name) - ) - return path - except WindowsError: - # Key doesn't exist - pass - - # Add Visual C++ for Python as a fall-back in case one - # of the other Windows SDKs isn't installed. - # TODO: Extend checking by using setuptools/msvc.py? - if use_windows_sdk: - sdk_name = "Visual C++ for Python" - localappdata = os.environ["LOCALAPPDATA"] - suffix = "Bin\\x64" if ARCH == "x64" else "Bin" - path = os.path.join(localappdata, vs_python, suffix, tool) - if os.path.exists(path): - self.debug_print("Using {0} from {1}".format(tool, sdk_name)) - return path - - raise RuntimeError("{0} could not be found".format(tool)) - - def _find_msbuild_tool_15(self): - """Return full path to one of the Microsoft build tools""" - try: - basePaths = subprocess.check_output( + def run(self): + for lib in self.distribution.ext_modules: + opts = sum( [ - "tools\\vswhere\\vswhere.exe", - "-latest", - "-version", - "[15.0,)", - "-requires", - "Microsoft.Component.MSBuild", - "-find", - "MSBuild\**\Bin\MSBuild.exe", - ] - ).splitlines() - if len(basePaths): - return basePaths[0].decode(sys.stdout.encoding or "utf-8") - else: - raise RuntimeError("MSBuild >=15.0 could not be found.") - except subprocess.CalledProcessError as e: - raise RuntimeError( - "MSBuild >=15.0 could not be found. {0}".format(e.output) - ) - - -class InstallLibPythonnet(install_lib.install_lib): - def install(self): - if not os.path.isdir(self.build_dir): - self.warn( - "'{0}' does not exist -- no Python modules" - " to install".format(self.build_dir) + ["--" + name.replace("_", "-"), value] + for name, value in lib.args.items() + ], + [], ) - return - - if not os.path.exists(self.install_dir): - self.mkpath(self.install_dir) - - # only copy clr.pyd/.so - for srcfile in glob.glob(os.path.join(self.build_dir, "clr.*")): - destfile = os.path.join(self.install_dir, os.path.basename(srcfile)) - self.copy_file(srcfile, destfile) - - -class InstallDataPythonnet(install_data.install_data): - def run(self): - build_cmd = self.get_finalized_command("build_ext") - install_cmd = self.get_finalized_command("install") - build_lib = os.path.abspath(build_cmd.build_lib) - install_platlib = os.path.relpath(install_cmd.install_platlib, self.install_dir) - for i, data_files in enumerate(self.data_files): - if isinstance(data_files, str): - self.data_files[i] = data_files[i].format(build_lib=build_lib) - else: - for j, filename in enumerate(data_files[1]): - data_files[1][j] = filename.format(build_lib=build_lib) - dest = data_files[0].format(install_platlib=install_platlib) - self.data_files[i] = dest, data_files[1] + opts.append("--configuration") + opts.append(self.dotnet_config) - return install_data.install_data.run(self) + self.spawn(["dotnet", "publish", lib.path] + opts) -class InstallPythonnet(install.install): - user_options = install.install.user_options + [("xplat", None, None)] - - def initialize_options(self): - install.install.initialize_options(self) - self.xplat = None - +class bdist_wheel_patched(bdist_wheel): def finalize_options(self): - install.install.finalize_options(self) - - def run(self): - if self.xplat: - _update_xlat_devtools() - return install.install.run(self) + # Monkey patch bdist_wheel to think the package is pure even though we + # include DLLs + super().finalize_options() + self.root_is_pure = True -if bdist_wheel: - class BDistWheelPythonnet(bdist_wheel.bdist_wheel): - user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)] - def initialize_options(self): - bdist_wheel.bdist_wheel.initialize_options(self) - self.xplat = None - - def finalize_options(self): - bdist_wheel.bdist_wheel.finalize_options(self) - - def run(self): - if self.xplat: - _update_xlat_devtools() - return bdist_wheel.bdist_wheel.run(self) - - ############################################################################### - - -setupdir = os.path.dirname(__file__) -if setupdir: - os.chdir(setupdir) - -setup_requires = [] -if not os.path.exists(_get_interop_filename()): - setup_requires.append("pycparser") - -cmdclass={ - "install": InstallPythonnet, - "build_ext": BuildExtPythonnet, - "install_lib": InstallLibPythonnet, - "install_data": InstallDataPythonnet, -} -if bdist_wheel: - cmdclass["bdist_wheel"] = BDistWheelPythonnet +with open("README.rst", "r") as f: + long_description = f.read() setup( name="pythonnet", - version="2.4.1-dev", - description=".Net and Mono integration for Python", - url="https://pythonnet.github.io/", - license="MIT", - author="The Python for .Net developers", + version="2.5.0", + description=".NET and Mono integration for Python", + author="The Python for .NET developers", author_email="pythondotnet@python.org", - setup_requires=setup_requires, - long_description=_get_long_description(), - ext_modules=[Extension("clr", sources=list(_get_source_files()))], - data_files=[("{install_platlib}", ["{build_lib}/Python.Runtime.dll"])], - cmdclass=cmdclass, + long_description=long_description, + license="MIT", + install_requires=["clr-loader"], + zip_safe=False, classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -656,9 +74,24 @@ def run(self): "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Operating System :: MacOS :: MacOS X", ], - zip_safe=False, + package_data={"pythonnet": ["dlls/*.dll"]}, + packages=find_packages(), + cmdclass={"build_ext": BuildDotnet, "bdist_wheel": bdist_wheel_patched}, + ext_modules={ + DotnetLib( + "python-runtime", + "Python.Runtime/", + output="pythonnet/dlls", + ), + DotnetLib( + "python-loader", + "Python.Loader/", + output="pythonnet/dlls", + ), + }, ) diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs deleted file mode 100644 index dc72b0bdf..000000000 --- a/src/SharedAssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("pythonnet")] -[assembly: AssemblyProduct("Python for .NET")] -[assembly: AssemblyCopyright("Copyright (c) 2006-2019 the contributors of the 'Python for .NET' project")] -[assembly: AssemblyTrademark("")] - -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("")] - -[assembly: CLSCompliant(true)] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// Version Information. Keeping it simple. May need to revisit for Nuget -// See: https://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/ -// AssemblyVersion can only be numeric -[assembly: AssemblyVersion("2.4.1")] diff --git a/src/clrmodule/ClrModule.cs b/src/clrmodule/ClrModule.cs deleted file mode 100644 index 7fc654fd6..000000000 --- a/src/clrmodule/ClrModule.cs +++ /dev/null @@ -1,126 +0,0 @@ -//============================================================================ -// This file replaces the hand-maintained stub that used to implement clr.dll. -// This is a line-by-line port from IL back to C#. -// We now use RGiesecke.DllExport on the required static init method so it can be -// loaded by a standard CPython interpreter as an extension module. When it -// is loaded, it bootstraps the managed runtime integration layer and defers -// to it to do initialization and put the clr module into sys.modules, etc. - -// The "USE_PYTHON_RUNTIME_*" defines control what extra evidence is used -// to help the CLR find the appropriate Python.Runtime assembly. - -// If defined, the "pythonRuntimeVersionString" variable must be set to -// Python.Runtime's current version. -#define USE_PYTHON_RUNTIME_VERSION - -// If defined, the "PythonRuntimePublicKeyTokenData" data array must be -// set to Python.Runtime's public key token. (sn -T Python.Runtin.dll) -#define USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN - -// If DEBUG is defined in the Build Properties, a few Console.WriteLine -// calls are made to indicate what's going on during the load... -//============================================================================ -using System; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using RGiesecke.DllExport; - -public class clrModule -{ -#if PYTHON3 - [DllExport("PyInit_clr", CallingConvention.StdCall)] - public static IntPtr PyInit_clr() -#elif PYTHON2 - [DllExport("initclr", CallingConvention.StdCall)] - public static void initclr() -#endif - { - DebugPrint("Attempting to load 'Python.Runtime' using standard binding rules."); -#if USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN - var pythonRuntimePublicKeyTokenData = new byte[] { 0x50, 0x00, 0xfe, 0xa6, 0xcb, 0xa7, 0x02, 0xdd }; -#endif - - // Attempt to find and load Python.Runtime using standard assembly binding rules. - // This roughly translates into looking in order: - // - GAC - // - ApplicationBase - // - A PrivateBinPath under ApplicationBase - // With an unsigned assembly, the GAC is skipped. - var pythonRuntimeName = new AssemblyName("Python.Runtime") - { -#if USE_PYTHON_RUNTIME_VERSION - // Has no effect until SNK works. Keep updated anyways. - Version = new Version("2.4.1"), -#endif - CultureInfo = CultureInfo.InvariantCulture - }; -#if USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN - pythonRuntimeName.SetPublicKeyToken(pythonRuntimePublicKeyTokenData); -#endif - // We've got the AssemblyName with optional features; try to load it. - Assembly pythonRuntime; - try - { - pythonRuntime = Assembly.Load(pythonRuntimeName); - DebugPrint("Success loading 'Python.Runtime' using standard binding rules."); - } - catch (IOException) - { - DebugPrint("'Python.Runtime' not found using standard binding rules."); - try - { - // If the above fails for any reason, we fallback to attempting to load "Python.Runtime.dll" - // from the directory this assembly is running in. "This assembly" is probably "clr.pyd", - // sitting somewhere in PYTHONPATH. This is using Assembly.LoadFrom, and inherits all the - // caveats of that call. See MSDN docs for details. - // Suzanne Cook's blog is also an excellent source of info on this: - // http://blogs.msdn.com/suzcook/ - // http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx - // http://blogs.msdn.com/suzcook/archive/2003/06/13/57180.aspx - - Assembly executingAssembly = Assembly.GetExecutingAssembly(); - string assemblyDirectory = Path.GetDirectoryName(executingAssembly.Location); - if (assemblyDirectory == null) - { - throw new InvalidOperationException(executingAssembly.Location); - } - string pythonRuntimeDllPath = Path.Combine(assemblyDirectory, "Python.Runtime.dll"); - DebugPrint($"Attempting to load Python.Runtime from: '{pythonRuntimeDllPath}'."); - pythonRuntime = Assembly.LoadFrom(pythonRuntimeDllPath); - DebugPrint($"Success loading 'Python.Runtime' from: '{pythonRuntimeDllPath}'."); - } - catch (InvalidOperationException) - { - DebugPrint("Could not load 'Python.Runtime'."); -#if PYTHON3 - return IntPtr.Zero; -#elif PYTHON2 - return; -#endif - } - } - - // Once here, we've successfully loaded SOME version of Python.Runtime - // So now we get the PythonEngine and execute the InitExt method on it. - Type pythonEngineType = pythonRuntime.GetType("Python.Runtime.PythonEngine"); - -#if PYTHON3 - return (IntPtr)pythonEngineType.InvokeMember("InitExt", BindingFlags.InvokeMethod, null, null, null); -#elif PYTHON2 - pythonEngineType.InvokeMember("InitExt", BindingFlags.InvokeMethod, null, null, null); -#endif - } - - /// - /// Substitute for Debug.Writeline(...). Ideally we would use Debug.Writeline - /// but haven't been able to configure the TRACE from within Python. - /// - [Conditional("DEBUG")] - private static void DebugPrint(string str) - { - Console.WriteLine(str); - } -} diff --git a/src/clrmodule/Properties/AssemblyInfo.cs b/src/clrmodule/Properties/AssemblyInfo.cs deleted file mode 100644 index 939f4171f..000000000 --- a/src/clrmodule/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("clrmodule")] -[assembly: AssemblyDescription("")] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ae10d6a4-55c2-482f-9716-9988e6c169e3")] diff --git a/src/clrmodule/clrmodule.15.csproj b/src/clrmodule/clrmodule.15.csproj deleted file mode 100644 index 326620c00..000000000 --- a/src/clrmodule/clrmodule.15.csproj +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - net40 - x64;x86 - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - clrmodule - clrmodule - clrmodule - 2.4.1 - false - false - false - false - false - false - bin\clrmodule.xml - bin\ - false - 1591 - ..\..\ - $(SolutionDir)\bin\ - $(PythonBuildDir)\$(TargetFramework)\ - 6 - prompt - $(PYTHONNET_DEFINE_CONSTANTS) - XPLAT - $(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants); - $(DefineConstants);TRACE;DEBUG - - - - x86 - - - x64 - - - - false - full - - - true - pdbonly - - - - $(DefineConstants);PYTHON2;TRACE;DEBUG - - - $(DefineConstants);PYTHON2 - - - $(DefineConstants);PYTHON2;TRACE;DEBUG - - - $(DefineConstants);PYTHON2 - - - $(DefineConstants);PYTHON3;TRACE;DEBUG - - - $(DefineConstants);PYTHON3 - - - $(DefineConstants);PYTHON3;TRACE;DEBUG - - - $(DefineConstants);PYTHON3 - - - - - - - - - - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - - - diff --git a/src/clrmodule/clrmodule.csproj b/src/clrmodule/clrmodule.csproj deleted file mode 100644 index 6e5ff4966..000000000 --- a/src/clrmodule/clrmodule.csproj +++ /dev/null @@ -1,95 +0,0 @@ - - - - Debug - AnyCPU - {86E834DE-1139-4511-96CC-69636A56E7AC} - Library - clrmodule - clrmodule - bin\clrmodule.xml - bin\ - v4.0 - - 1591 - ..\..\ - $(SolutionDir)\bin\ - Properties - 6 - true - prompt - - - x86 - - - x64 - - - true - PYTHON2;TRACE;DEBUG - full - - - PYTHON2 - true - pdbonly - - - true - PYTHON2;TRACE;DEBUG - full - - - PYTHON2 - true - pdbonly - - - true - PYTHON3;TRACE;DEBUG - full - - - PYTHON3 - true - pdbonly - - - true - PYTHON3;TRACE;DEBUG - full - - - PYTHON3 - true - pdbonly - - - - ..\..\packages\UnmanagedExports.1.2.7\lib\net\RGiesecke.DllExport.Metadata.dll - False - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - - diff --git a/src/clrmodule/packages.config b/src/clrmodule/packages.config deleted file mode 100644 index 2a95dc54d..000000000 --- a/src/clrmodule/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/console/Console.15.csproj b/src/console/Console.15.csproj deleted file mode 100644 index 4e765fea4..000000000 --- a/src/console/Console.15.csproj +++ /dev/null @@ -1,94 +0,0 @@ - - - - net40;netcoreapp2.0 - x64;x86 - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - Exe - nPython - Python.Runtime - nPython - 2.4.1 - false - false - false - false - false - false - bin\ - false - $(OutputPath)\$(AssemblyName).xml - $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml - 1591 - ..\..\ - $(SolutionDir)\bin\ - $(PythonBuildDir)\$(TargetFramework)\ - 6 - python-clear.ico - prompt - $(PYTHONNET_DEFINE_CONSTANTS) - XPLAT - $(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants); - $(DefineConstants);TRACE;DEBUG - $(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\ - - - x86 - - - x64 - - - - false - full - - - true - pdbonly - - - true - false - full - - - true - true - portable - - - - $(DefineConstants);DEBUG;TRACE - - - $(DefineConstants) - - - - $(PythonManifest) - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - Python.Runtime.dll - - - - - - - - - - - - diff --git a/src/console/Console.csproj b/src/console/Console.csproj deleted file mode 100644 index ea88b6356..000000000 --- a/src/console/Console.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - Debug - AnyCPU - {E29DCF0A-5114-4A98-B1DD-71264B6EA349} - Exe - nPython - Python.Runtime - bin\nPython.xml - bin\ - v4.0 - - 1591 - ..\..\ - $(SolutionDir)\bin\ - Properties - 6 - python-clear.ico - prompt - - - x86 - - - x64 - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - $(PythonManifest) - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - Python.Runtime.dll - - - - - {097b4ac0-74e9-4c58-bcf8-c69746ec8271} - Python.Runtime - - - - - - - diff --git a/src/console/Properties/AssemblyInfo.cs b/src/console/Properties/AssemblyInfo.cs deleted file mode 100644 index 081ae0c94..000000000 --- a/src/console/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Reflection; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Python Console")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyDefaultAlias("python.exe")] diff --git a/src/console/python-clear.ico b/src/console/python-clear.ico deleted file mode 100644 index b37050cce..000000000 Binary files a/src/console/python-clear.ico and /dev/null differ diff --git a/src/console/pythonconsole.cs b/src/console/pythonconsole.cs deleted file mode 100644 index 912e9bb0d..000000000 --- a/src/console/pythonconsole.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Python.Runtime; - -namespace Python.Runtime -{ - /// - /// Example of Embedding Python inside of a .NET program. - /// - /// - /// It has similar functionality to doing `import clr` from within Python, but this does it - /// the other way around; That is, it loads Python inside of .NET program. - /// See https://github.com/pythonnet/pythonnet/issues/358 for more info. - /// - public sealed class PythonConsole - { -#if NET40 - private static AssemblyLoader assemblyLoader = new AssemblyLoader(); -#endif - private PythonConsole() - { - } - - [STAThread] - public static int Main(string[] args) - { - // Only net40 is capable to safely inject python.runtime.dll into resources. -#if NET40 - // reference the static assemblyLoader to stop it being optimized away - AssemblyLoader a = assemblyLoader; -#endif - string[] cmd = Environment.GetCommandLineArgs(); - PythonEngine.Initialize(); - - int i = Runtime.Py_Main(cmd.Length, cmd); - PythonEngine.Shutdown(); - - return i; - } - -#if NET40 - // Register a callback function to load embedded assemblies. - // (Python.Runtime.dll is included as a resource) - private sealed class AssemblyLoader - { - private Dictionary loadedAssemblies; - - public AssemblyLoader() - { - loadedAssemblies = new Dictionary(); - - AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => - { - string shortName = args.Name.Split(',')[0]; - string resourceName = $"{shortName}.dll"; - - if (loadedAssemblies.ContainsKey(resourceName)) - { - return loadedAssemblies[resourceName]; - } - - // looks for the assembly from the resources and load it - using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) - { - if (stream != null) - { - var assemblyData = new byte[stream.Length]; - stream.Read(assemblyData, 0, assemblyData.Length); - Assembly assembly = Assembly.Load(assemblyData); - loadedAssemblies[resourceName] = assembly; - return assembly; - } - } - return null; - }; - } - } -#endif - } -} diff --git a/src/embed_tests/Program.cs b/src/embed_tests/Program.cs deleted file mode 100644 index b4439e3e4..000000000 --- a/src/embed_tests/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -using NUnit.Common; - -using NUnitLite; - -namespace Python.EmbeddingTest -{ - public class Program - { - public static int Main(string[] args) - { - return new AutoRun(typeof(Program).Assembly).Execute( - args, - new ExtendedTextWrapper(Console.Out), - Console.In); - } - } -} diff --git a/src/embed_tests/Python.EmbeddingTest.15.csproj b/src/embed_tests/Python.EmbeddingTest.15.csproj deleted file mode 100644 index d8952a3a9..000000000 --- a/src/embed_tests/Python.EmbeddingTest.15.csproj +++ /dev/null @@ -1,120 +0,0 @@ - - - - - net40;netcoreapp2.0 - x64;x86 - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - Exe - false - Python.EmbeddingTest - Python.EmbeddingTest - Python.EmbeddingTest - 2.4.1 - false - false - false - false - bin\ - false - $(OutputPath)\$(AssemblyName).xml - $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml - 1591 - ..\..\ - $(SolutionDir)\bin\ - $(OutputPath)\$(TargetFramework)_publish - 7.3 - prompt - $(PYTHONNET_DEFINE_CONSTANTS) - XPLAT - $(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants); - $(DefineConstants);NETCOREAPP - $(DefineConstants);NETSTANDARD - $(DefineConstants);TRACE;DEBUG - $(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\ - - - x86 - - - x64 - - - - false - full - - - true - pdbonly - - - true - false - full - - - true - true - portable - - - - $(DefineConstants);DEBUG;TRACE - - - $(DefineConstants) - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - - - diff --git a/src/monoclr/clrmod.c b/src/monoclr/clrmod.c deleted file mode 100644 index 4e8027e3a..000000000 --- a/src/monoclr/clrmod.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "pynetclr.h" - -/* List of functions defined in the module */ -static PyMethodDef clr_methods[] = { - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(clr_module_doc, - "clr facade module to initialize the CLR. It's later " - "replaced by the real clr module. This module has a facade " - "attribute to make it distinguishable from the real clr module." -); - -static PyNet_Args *pn_args; -char **environ = NULL; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef clrdef = { - PyModuleDef_HEAD_INIT, - "clr", /* m_name */ - clr_module_doc, /* m_doc */ - -1, /* m_size */ - clr_methods, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ -}; -#endif - -static PyObject *_initclr() -{ - PyObject *m; - - /* Create the module and add the functions */ -#if PY_MAJOR_VERSION >= 3 - m = PyModule_Create(&clrdef); -#else - m = Py_InitModule3("clr", clr_methods, clr_module_doc); -#endif - if (m == NULL) - return NULL; - PyModule_AddObject(m, "facade", Py_True); - Py_INCREF(Py_True); - - pn_args = PyNet_Init(1); - if (pn_args->error) - { - return NULL; - } - - if (NULL != pn_args->module) - return pn_args->module; - - return m; -} - -#if PY_MAJOR_VERSION >= 3 -PyMODINIT_FUNC -PyInit_clr(void) -{ - return _initclr(); -} -#else -PyMODINIT_FUNC -initclr(void) -{ - _initclr(); -} -#endif diff --git a/src/monoclr/pynetclr.h b/src/monoclr/pynetclr.h deleted file mode 100644 index c5e181156..000000000 --- a/src/monoclr/pynetclr.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef PYNET_CLR_H -#define PYNET_CLR_H - -#include -#include -#include -#include -#include -#include -#include - -#define MONO_VERSION "v4.0.30319.1" -#define MONO_DOMAIN "Python.Runtime" -#define PR_ASSEMBLY "Python.Runtime.dll" - -typedef struct -{ - MonoDomain *domain; - MonoAssembly *pr_assm; - MonoMethod *shutdown; - char *pr_file; - char *error; - char *init_name; - char *shutdown_name; - PyObject *module; -} PyNet_Args; - -PyNet_Args *PyNet_Init(int); -void PyNet_Finalize(PyNet_Args *); -void main_thread_handler(gpointer user_data); -char *PyNet_ExceptionToString(MonoObject *); - -#endif // PYNET_CLR_H diff --git a/src/monoclr/pynetinit.c b/src/monoclr/pynetinit.c deleted file mode 100644 index 8b49ddae3..000000000 --- a/src/monoclr/pynetinit.c +++ /dev/null @@ -1,252 +0,0 @@ -#include "pynetclr.h" -#include "stdlib.h" - -#ifndef _WIN32 -#include "dirent.h" -#include "dlfcn.h" -#include "libgen.h" -#include "alloca.h" -#endif - - -// initialize Mono and PythonNet -PyNet_Args *PyNet_Init(int ext) -{ - PyNet_Args *pn_args; - pn_args = (PyNet_Args *)malloc(sizeof(PyNet_Args)); - pn_args->pr_file = PR_ASSEMBLY; - pn_args->error = NULL; - pn_args->shutdown = NULL; - pn_args->module = NULL; - - if (ext == 0) - { - pn_args->init_name = "Python.Runtime:Initialize()"; - } - else - { - pn_args->init_name = "Python.Runtime:InitExt()"; - } - pn_args->shutdown_name = "Python.Runtime:Shutdown()"; - - pn_args->domain = mono_jit_init_version(MONO_DOMAIN, MONO_VERSION); - mono_domain_set_config(pn_args->domain, ".", "Python.Runtime.dll.config"); - - /* - * Load the default Mono configuration file, this is needed - * if you are planning on using the dllmaps defined on the - * system configuration - */ - mono_config_parse(NULL); - - /* I can't use this call to run the main_thread_handler. The function - * runs it in another thread but *this* thread holds the Python - * import lock -> DEAD LOCK. - * - * mono_runtime_exec_managed_code(pn_args->domain, main_thread_handler, - * pn_args); - */ - - main_thread_handler(pn_args); - - if (pn_args->error != NULL) - { - PyErr_SetString(PyExc_ImportError, pn_args->error); - } - return pn_args; -} - -// Shuts down PythonNet and cleans up Mono -void PyNet_Finalize(PyNet_Args *pn_args) -{ - MonoObject *exception = NULL; - - if (pn_args->shutdown) - { - mono_runtime_invoke(pn_args->shutdown, NULL, NULL, &exception); - if (exception) - { - pn_args->error = PyNet_ExceptionToString(exception); - } - pn_args->shutdown = NULL; - } - - if (pn_args->domain) - { - mono_jit_cleanup(pn_args->domain); - pn_args->domain = NULL; - } - free(pn_args); -} - -MonoMethod *getMethodFromClass(MonoClass *cls, char *name) -{ - MonoMethodDesc *mdesc; - MonoMethod *method; - - mdesc = mono_method_desc_new(name, 1); - method = mono_method_desc_search_in_class(mdesc, cls); - mono_method_desc_free(mdesc); - - return method; -} - -void main_thread_handler(gpointer user_data) -{ - PyNet_Args *pn_args = (PyNet_Args *)user_data; - MonoMethod *init; - MonoImage *pr_image; - MonoClass *pythonengine; - MonoObject *exception = NULL; - MonoObject *init_result; - -#ifndef _WIN32 - // Get the filename of the python shared object and set - // LD_LIBRARY_PATH so Mono can find it. - Dl_info dlinfo = {0}; - if (0 != dladdr(&Py_Initialize, &dlinfo)) - { - char *fname = alloca(strlen(dlinfo.dli_fname) + 1); - strcpy(fname, dlinfo.dli_fname); - char *py_libdir = dirname(fname); - char *ld_library_path = getenv("LD_LIBRARY_PATH"); - if (NULL == ld_library_path) - { - setenv("LD_LIBRARY_PATH", py_libdir, 1); - } - else - { - char *new_ld_library_path = alloca(strlen(py_libdir) - + strlen(ld_library_path) - + 2); - strcpy(new_ld_library_path, py_libdir); - strcat(new_ld_library_path, ":"); - strcat(new_ld_library_path, ld_library_path); - setenv("LD_LIBRARY_PATH", py_libdir, 1); - } - } - - //get python path system variable - PyObject *syspath = PySys_GetObject("path"); - char *runtime_full_path = (char*) malloc(1024); - const char *slash = "/"; - int found = 0; - - int ii = 0; - for (ii = 0; ii < PyList_Size(syspath); ++ii) - { -#if PY_MAJOR_VERSION >= 3 - Py_ssize_t wlen; - wchar_t *wstr = PyUnicode_AsWideCharString(PyList_GetItem(syspath, ii), &wlen); - char *pydir = (char*)malloc(wlen + 1); - size_t mblen = wcstombs(pydir, wstr, wlen + 1); - if (mblen > wlen) - pydir[wlen] = '\0'; - PyMem_Free(wstr); -#else - const char *pydir = PyString_AsString(PyList_GetItem(syspath, ii)); -#endif - char *curdir = (char*) malloc(1024); - strncpy(curdir, strlen(pydir) > 0 ? pydir : ".", 1024); - strncat(curdir, slash, 1024); - -#if PY_MAJOR_VERSION >= 3 - free(pydir); -#endif - - //look in this directory for the pn_args->pr_file - DIR *dirp = opendir(curdir); - if (dirp != NULL) - { - struct dirent *dp; - while ((dp = readdir(dirp)) != NULL) - { - if (strcmp(dp->d_name, pn_args->pr_file) == 0) - { - strcpy(runtime_full_path, curdir); - strcat(runtime_full_path, pn_args->pr_file); - found = 1; - break; - } - } - closedir(dirp); - } - free(curdir); - - if (found) - { - pn_args->pr_file = runtime_full_path; - break; - } - } - - if (!found) - { - fprintf(stderr, "Could not find assembly %s. \n", pn_args->pr_file); - return; - } -#endif - - pn_args->pr_assm = mono_domain_assembly_open(pn_args->domain, pn_args->pr_file); - if (!pn_args->pr_assm) - { - pn_args->error = "Unable to load assembly"; - return; - } -#ifndef _WIN32 - free(runtime_full_path); -#endif - - pr_image = mono_assembly_get_image(pn_args->pr_assm); - if (!pr_image) - { - pn_args->error = "Unable to get image"; - return; - } - - pythonengine = mono_class_from_name(pr_image, "Python.Runtime", "PythonEngine"); - if (!pythonengine) - { - pn_args->error = "Unable to load class PythonEngine from Python.Runtime"; - return; - } - - init = getMethodFromClass(pythonengine, pn_args->init_name); - if (!init) - { - pn_args->error = "Unable to fetch Init method from PythonEngine"; - return; - } - - pn_args->shutdown = getMethodFromClass(pythonengine, pn_args->shutdown_name); - if (!pn_args->shutdown) - { - pn_args->error = "Unable to fetch shutdown method from PythonEngine"; - return; - } - - init_result = mono_runtime_invoke(init, NULL, NULL, &exception); - if (exception) - { - pn_args->error = PyNet_ExceptionToString(exception); - return; - } - -#if PY_MAJOR_VERSION >= 3 - if (NULL != init_result) - pn_args->module = *(PyObject**)mono_object_unbox(init_result); -#endif -} - -// Get string from a Mono exception -char *PyNet_ExceptionToString(MonoObject *e) -{ - MonoMethodDesc *mdesc = mono_method_desc_new(":ToString()", FALSE); - MonoMethod *mmethod = mono_method_desc_search_in_class(mdesc, mono_get_object_class()); - mono_method_desc_free(mdesc); - - mmethod = mono_object_get_virtual_method(e, mmethod); - MonoString *monoString = (MonoString*) mono_runtime_invoke(mmethod, e, NULL, NULL); - mono_runtime_invoke(mmethod, e, NULL, NULL); - return mono_string_to_utf8(monoString); -} diff --git a/src/pythonnet.snk b/src/pythonnet.snk deleted file mode 100644 index 90e3d6f41..000000000 Binary files a/src/pythonnet.snk and /dev/null differ diff --git a/src/runtime/Properties/AssemblyInfo.cs b/src/runtime/Properties/AssemblyInfo.cs deleted file mode 100644 index a5d33c7ab..000000000 --- a/src/runtime/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Python for .NET")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyDefaultAlias("Python.Runtime.dll")] - -[assembly: InternalsVisibleTo("Python.EmbeddingTest")] diff --git a/src/runtime/Python.Runtime.15.csproj b/src/runtime/Python.Runtime.15.csproj deleted file mode 100644 index fd4f3416a..000000000 --- a/src/runtime/Python.Runtime.15.csproj +++ /dev/null @@ -1,154 +0,0 @@ - - - - net40;netstandard2.0 - AnyCPU - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - net45 - Python.Runtime - Python.Runtime - pythonnet - 2.4.1 - true - false - Codestin Search App - Copyright (c) 2006-2019 the contributors of the 'Python for .NET' project - Python and CLR (.NET and Mono) cross-platform language interop - pythonnet - https://github.com/pythonnet/pythonnet/blob/master/LICENSE - https://github.com/pythonnet/pythonnet - git - - python interop dynamic dlr Mono pinvoke - https://raw.githubusercontent.com/pythonnet/pythonnet/master/src/console/python-clear.ico - https://pythonnet.github.io/ - bin\ - false - $(OutputPath)\$(AssemblyName).xml - $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml - 1591;NU1701 - ..\..\ - $(SolutionDir)\bin\ - $(PythonBuildDir)\$(TargetFramework)\ - 7.3 - True - ..\pythonnet.snk - $(PYTHONNET_DEFINE_CONSTANTS) - XPLAT - $(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants); - $(DefineConstants);NETSTANDARD - $(DefineConstants);TRACE;DEBUG - $(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\ - $(PYTHONNET_PY2_VERSION) - PYTHON27 - $(PYTHONNET_PY3_VERSION) - PYTHON38 - $(PYTHONNET_WIN_DEFINE_CONSTANTS) - UCS2 - $(PYTHONNET_MONO_DEFINE_CONSTANTS) - UCS4;MONO_LINUX;PYTHON_WITH_PYMALLOC - $(PYTHONNET_INTEROP_FILE) - - - false - full - - - true - pdbonly - - - true - false - full - - - true - true - portable - - - - $(DefineConstants);PYTHON2;$(Python2Version);$(PythonMonoDefineConstants) - - - $(DefineConstants);PYTHON3;$(Python3Version);$(PythonMonoDefineConstants) - - - $(DefineConstants);PYTHON2;$(Python2Version);$(PythonMonoDefineConstants);FINALIZER_CHECK;TRACE;DEBUG - - - $(DefineConstants);PYTHON3;$(Python3Version);$(PythonMonoDefineConstants);FINALIZER_CHECK;TRACE;DEBUG - - - $(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants) - - - $(DefineConstants);PYTHON3;$(Python3Version);$(PythonWinDefineConstants) - - - $(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants);FINALIZER_CHECK;TRACE;DEBUG - - - $(DefineConstants);PYTHON3;$(Python3Version);$(PythonWinDefineConstants);FINALIZER_CHECK;TRACE;DEBUG - - - - - - - - - - - - - - - - - - - - - - clr.py - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - - - - - - diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj deleted file mode 100644 index fd2d35bde..000000000 --- a/src/runtime/Python.Runtime.csproj +++ /dev/null @@ -1,181 +0,0 @@ - - - - Debug - AnyCPU - {097B4AC0-74E9-4C58-BCF8-C69746EC8271} - Library - Python.Runtime - Python.Runtime - bin\Python.Runtime.xml - bin\ - v4.0 - - 1591 - ..\..\ - $(SolutionDir)\bin\ - Properties - 7.3 - true - false - ..\pythonnet.snk - - - - - - PYTHON2;PYTHON27;UCS4 - true - pdbonly - - - PYTHON3;PYTHON38;UCS4 - true - pdbonly - - - true - PYTHON2;PYTHON27;UCS4;TRACE;DEBUG - false - full - - - true - PYTHON3;PYTHON38;UCS4;TRACE;DEBUG - false - full - - - PYTHON2;PYTHON27;UCS2 - true - pdbonly - - - PYTHON3;PYTHON38;UCS2 - true - pdbonly - - - true - PYTHON2;PYTHON27;UCS2;TRACE;DEBUG - false - full - - - true - PYTHON3;PYTHON38;UCS2;TRACE;DEBUG - false - full - - - - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clr.py - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - \ No newline at end of file diff --git a/src/runtime/interop34.cs b/src/runtime/interop34.cs deleted file mode 100644 index 6857ff2d0..000000000 --- a/src/runtime/interop34.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Auto-generated by geninterop.py. -// DO NOT MODIFIY BY HAND. - - -#if PYTHON34 -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Text; - -namespace Python.Runtime -{ - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - internal class TypeOffset - { - static TypeOffset() - { - Type type = typeof(TypeOffset); - FieldInfo[] fi = type.GetFields(); - int size = IntPtr.Size; - for (int i = 0; i < fi.Length; i++) - { - fi[i].SetValue(null, i * size); - } - } - - public static int magic() - { - return ob_size; - } - - // Auto-generated from PyHeapTypeObject in Python.h - public static int ob_refcnt = 0; - public static int ob_type = 0; - public static int ob_size = 0; - public static int tp_name = 0; - public static int tp_basicsize = 0; - public static int tp_itemsize = 0; - public static int tp_dealloc = 0; - public static int tp_print = 0; - public static int tp_getattr = 0; - public static int tp_setattr = 0; - public static int tp_reserved = 0; - public static int tp_repr = 0; - public static int tp_as_number = 0; - public static int tp_as_sequence = 0; - public static int tp_as_mapping = 0; - public static int tp_hash = 0; - public static int tp_call = 0; - public static int tp_str = 0; - public static int tp_getattro = 0; - public static int tp_setattro = 0; - public static int tp_as_buffer = 0; - public static int tp_flags = 0; - public static int tp_doc = 0; - public static int tp_traverse = 0; - public static int tp_clear = 0; - public static int tp_richcompare = 0; - public static int tp_weaklistoffset = 0; - public static int tp_iter = 0; - public static int tp_iternext = 0; - public static int tp_methods = 0; - public static int tp_members = 0; - public static int tp_getset = 0; - public static int tp_base = 0; - public static int tp_dict = 0; - public static int tp_descr_get = 0; - public static int tp_descr_set = 0; - public static int tp_dictoffset = 0; - public static int tp_init = 0; - public static int tp_alloc = 0; - public static int tp_new = 0; - public static int tp_free = 0; - public static int tp_is_gc = 0; - public static int tp_bases = 0; - public static int tp_mro = 0; - public static int tp_cache = 0; - public static int tp_subclasses = 0; - public static int tp_weaklist = 0; - public static int tp_del = 0; - public static int tp_version_tag = 0; - public static int tp_finalize = 0; - public static int nb_add = 0; - public static int nb_subtract = 0; - public static int nb_multiply = 0; - public static int nb_remainder = 0; - public static int nb_divmod = 0; - public static int nb_power = 0; - public static int nb_negative = 0; - public static int nb_positive = 0; - public static int nb_absolute = 0; - public static int nb_bool = 0; - public static int nb_invert = 0; - public static int nb_lshift = 0; - public static int nb_rshift = 0; - public static int nb_and = 0; - public static int nb_xor = 0; - public static int nb_or = 0; - public static int nb_int = 0; - public static int nb_reserved = 0; - public static int nb_float = 0; - public static int nb_inplace_add = 0; - public static int nb_inplace_subtract = 0; - public static int nb_inplace_multiply = 0; - public static int nb_inplace_remainder = 0; - public static int nb_inplace_power = 0; - public static int nb_inplace_lshift = 0; - public static int nb_inplace_rshift = 0; - public static int nb_inplace_and = 0; - public static int nb_inplace_xor = 0; - public static int nb_inplace_or = 0; - public static int nb_floor_divide = 0; - public static int nb_true_divide = 0; - public static int nb_inplace_floor_divide = 0; - public static int nb_inplace_true_divide = 0; - public static int nb_index = 0; - public static int mp_length = 0; - public static int mp_subscript = 0; - public static int mp_ass_subscript = 0; - public static int sq_length = 0; - public static int sq_concat = 0; - public static int sq_repeat = 0; - public static int sq_item = 0; - public static int was_sq_slice = 0; - public static int sq_ass_item = 0; - public static int was_sq_ass_slice = 0; - public static int sq_contains = 0; - public static int sq_inplace_concat = 0; - public static int sq_inplace_repeat = 0; - public static int bf_getbuffer = 0; - public static int bf_releasebuffer = 0; - public static int name = 0; - public static int ht_slots = 0; - public static int qualname = 0; - public static int ht_cached_keys = 0; - - /* here are optional user slots, followed by the members. */ - public static int members = 0; - } -} - -#endif diff --git a/src/runtime/interop35.cs b/src/runtime/interop35.cs deleted file mode 100644 index a30bfa4fd..000000000 --- a/src/runtime/interop35.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Auto-generated by geninterop.py. -// DO NOT MODIFIY BY HAND. - - -#if PYTHON35 -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Text; - -namespace Python.Runtime -{ - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - internal class TypeOffset - { - static TypeOffset() - { - Type type = typeof(TypeOffset); - FieldInfo[] fi = type.GetFields(); - int size = IntPtr.Size; - for (int i = 0; i < fi.Length; i++) - { - fi[i].SetValue(null, i * size); - } - } - - public static int magic() - { - return ob_size; - } - - // Auto-generated from PyHeapTypeObject in Python.h - public static int ob_refcnt = 0; - public static int ob_type = 0; - public static int ob_size = 0; - public static int tp_name = 0; - public static int tp_basicsize = 0; - public static int tp_itemsize = 0; - public static int tp_dealloc = 0; - public static int tp_print = 0; - public static int tp_getattr = 0; - public static int tp_setattr = 0; - public static int tp_as_async = 0; - public static int tp_repr = 0; - public static int tp_as_number = 0; - public static int tp_as_sequence = 0; - public static int tp_as_mapping = 0; - public static int tp_hash = 0; - public static int tp_call = 0; - public static int tp_str = 0; - public static int tp_getattro = 0; - public static int tp_setattro = 0; - public static int tp_as_buffer = 0; - public static int tp_flags = 0; - public static int tp_doc = 0; - public static int tp_traverse = 0; - public static int tp_clear = 0; - public static int tp_richcompare = 0; - public static int tp_weaklistoffset = 0; - public static int tp_iter = 0; - public static int tp_iternext = 0; - public static int tp_methods = 0; - public static int tp_members = 0; - public static int tp_getset = 0; - public static int tp_base = 0; - public static int tp_dict = 0; - public static int tp_descr_get = 0; - public static int tp_descr_set = 0; - public static int tp_dictoffset = 0; - public static int tp_init = 0; - public static int tp_alloc = 0; - public static int tp_new = 0; - public static int tp_free = 0; - public static int tp_is_gc = 0; - public static int tp_bases = 0; - public static int tp_mro = 0; - public static int tp_cache = 0; - public static int tp_subclasses = 0; - public static int tp_weaklist = 0; - public static int tp_del = 0; - public static int tp_version_tag = 0; - public static int tp_finalize = 0; - public static int am_await = 0; - public static int am_aiter = 0; - public static int am_anext = 0; - public static int nb_add = 0; - public static int nb_subtract = 0; - public static int nb_multiply = 0; - public static int nb_remainder = 0; - public static int nb_divmod = 0; - public static int nb_power = 0; - public static int nb_negative = 0; - public static int nb_positive = 0; - public static int nb_absolute = 0; - public static int nb_bool = 0; - public static int nb_invert = 0; - public static int nb_lshift = 0; - public static int nb_rshift = 0; - public static int nb_and = 0; - public static int nb_xor = 0; - public static int nb_or = 0; - public static int nb_int = 0; - public static int nb_reserved = 0; - public static int nb_float = 0; - public static int nb_inplace_add = 0; - public static int nb_inplace_subtract = 0; - public static int nb_inplace_multiply = 0; - public static int nb_inplace_remainder = 0; - public static int nb_inplace_power = 0; - public static int nb_inplace_lshift = 0; - public static int nb_inplace_rshift = 0; - public static int nb_inplace_and = 0; - public static int nb_inplace_xor = 0; - public static int nb_inplace_or = 0; - public static int nb_floor_divide = 0; - public static int nb_true_divide = 0; - public static int nb_inplace_floor_divide = 0; - public static int nb_inplace_true_divide = 0; - public static int nb_index = 0; - public static int nb_matrix_multiply = 0; - public static int nb_inplace_matrix_multiply = 0; - public static int mp_length = 0; - public static int mp_subscript = 0; - public static int mp_ass_subscript = 0; - public static int sq_length = 0; - public static int sq_concat = 0; - public static int sq_repeat = 0; - public static int sq_item = 0; - public static int was_sq_slice = 0; - public static int sq_ass_item = 0; - public static int was_sq_ass_slice = 0; - public static int sq_contains = 0; - public static int sq_inplace_concat = 0; - public static int sq_inplace_repeat = 0; - public static int bf_getbuffer = 0; - public static int bf_releasebuffer = 0; - public static int name = 0; - public static int ht_slots = 0; - public static int qualname = 0; - public static int ht_cached_keys = 0; - - /* here are optional user slots, followed by the members. */ - public static int members = 0; - } -} - -#endif diff --git a/src/runtime/interop37.cs b/src/runtime/interop37.cs deleted file mode 100644 index d5fc76ad3..000000000 --- a/src/runtime/interop37.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Auto-generated by geninterop.py. -// DO NOT MODIFIY BY HAND. - - -#if PYTHON37 -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Text; - -namespace Python.Runtime -{ - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - internal class TypeOffset - { - static TypeOffset() - { - Type type = typeof(TypeOffset); - FieldInfo[] fi = type.GetFields(); - int size = IntPtr.Size; - for (int i = 0; i < fi.Length; i++) - { - fi[i].SetValue(null, i * size); - } - } - - public static int magic() - { - return ob_size; - } - - // Auto-generated from PyHeapTypeObject in Python.h - public static int ob_refcnt = 0; - public static int ob_type = 0; - public static int ob_size = 0; - public static int tp_name = 0; - public static int tp_basicsize = 0; - public static int tp_itemsize = 0; - public static int tp_dealloc = 0; - public static int tp_print = 0; - public static int tp_getattr = 0; - public static int tp_setattr = 0; - public static int tp_as_async = 0; - public static int tp_repr = 0; - public static int tp_as_number = 0; - public static int tp_as_sequence = 0; - public static int tp_as_mapping = 0; - public static int tp_hash = 0; - public static int tp_call = 0; - public static int tp_str = 0; - public static int tp_getattro = 0; - public static int tp_setattro = 0; - public static int tp_as_buffer = 0; - public static int tp_flags = 0; - public static int tp_doc = 0; - public static int tp_traverse = 0; - public static int tp_clear = 0; - public static int tp_richcompare = 0; - public static int tp_weaklistoffset = 0; - public static int tp_iter = 0; - public static int tp_iternext = 0; - public static int tp_methods = 0; - public static int tp_members = 0; - public static int tp_getset = 0; - public static int tp_base = 0; - public static int tp_dict = 0; - public static int tp_descr_get = 0; - public static int tp_descr_set = 0; - public static int tp_dictoffset = 0; - public static int tp_init = 0; - public static int tp_alloc = 0; - public static int tp_new = 0; - public static int tp_free = 0; - public static int tp_is_gc = 0; - public static int tp_bases = 0; - public static int tp_mro = 0; - public static int tp_cache = 0; - public static int tp_subclasses = 0; - public static int tp_weaklist = 0; - public static int tp_del = 0; - public static int tp_version_tag = 0; - public static int tp_finalize = 0; - public static int am_await = 0; - public static int am_aiter = 0; - public static int am_anext = 0; - public static int nb_add = 0; - public static int nb_subtract = 0; - public static int nb_multiply = 0; - public static int nb_remainder = 0; - public static int nb_divmod = 0; - public static int nb_power = 0; - public static int nb_negative = 0; - public static int nb_positive = 0; - public static int nb_absolute = 0; - public static int nb_bool = 0; - public static int nb_invert = 0; - public static int nb_lshift = 0; - public static int nb_rshift = 0; - public static int nb_and = 0; - public static int nb_xor = 0; - public static int nb_or = 0; - public static int nb_int = 0; - public static int nb_reserved = 0; - public static int nb_float = 0; - public static int nb_inplace_add = 0; - public static int nb_inplace_subtract = 0; - public static int nb_inplace_multiply = 0; - public static int nb_inplace_remainder = 0; - public static int nb_inplace_power = 0; - public static int nb_inplace_lshift = 0; - public static int nb_inplace_rshift = 0; - public static int nb_inplace_and = 0; - public static int nb_inplace_xor = 0; - public static int nb_inplace_or = 0; - public static int nb_floor_divide = 0; - public static int nb_true_divide = 0; - public static int nb_inplace_floor_divide = 0; - public static int nb_inplace_true_divide = 0; - public static int nb_index = 0; - public static int nb_matrix_multiply = 0; - public static int nb_inplace_matrix_multiply = 0; - public static int mp_length = 0; - public static int mp_subscript = 0; - public static int mp_ass_subscript = 0; - public static int sq_length = 0; - public static int sq_concat = 0; - public static int sq_repeat = 0; - public static int sq_item = 0; - public static int was_sq_slice = 0; - public static int sq_ass_item = 0; - public static int was_sq_ass_slice = 0; - public static int sq_contains = 0; - public static int sq_inplace_concat = 0; - public static int sq_inplace_repeat = 0; - public static int bf_getbuffer = 0; - public static int bf_releasebuffer = 0; - public static int name = 0; - public static int ht_slots = 0; - public static int qualname = 0; - public static int ht_cached_keys = 0; - - /* here are optional user slots, followed by the members. */ - public static int members = 0; - } -} - -#endif diff --git a/src/runtime/interop38.cs b/src/runtime/interop38.cs deleted file mode 100644 index 9126bca6a..000000000 --- a/src/runtime/interop38.cs +++ /dev/null @@ -1,152 +0,0 @@ - -// Auto-generated by geninterop.py. -// DO NOT MODIFY BY HAND. - - -#if PYTHON38 -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Text; - -namespace Python.Runtime -{ - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - internal class TypeOffset - { - static TypeOffset() - { - Type type = typeof(TypeOffset); - FieldInfo[] fi = type.GetFields(); - int size = IntPtr.Size; - for (int i = 0; i < fi.Length; i++) - { - fi[i].SetValue(null, i * size); - } - } - - public static int magic() - { - return ob_size; - } - - // Auto-generated from PyHeapTypeObject in Python.h - public static int ob_refcnt = 0; - public static int ob_type = 0; - public static int ob_size = 0; - public static int tp_name = 0; - public static int tp_basicsize = 0; - public static int tp_itemsize = 0; - public static int tp_dealloc = 0; - public static int tp_vectorcall_offset = 0; - public static int tp_getattr = 0; - public static int tp_setattr = 0; - public static int tp_as_async = 0; - public static int tp_repr = 0; - public static int tp_as_number = 0; - public static int tp_as_sequence = 0; - public static int tp_as_mapping = 0; - public static int tp_hash = 0; - public static int tp_call = 0; - public static int tp_str = 0; - public static int tp_getattro = 0; - public static int tp_setattro = 0; - public static int tp_as_buffer = 0; - public static int tp_flags = 0; - public static int tp_doc = 0; - public static int tp_traverse = 0; - public static int tp_clear = 0; - public static int tp_richcompare = 0; - public static int tp_weaklistoffset = 0; - public static int tp_iter = 0; - public static int tp_iternext = 0; - public static int tp_methods = 0; - public static int tp_members = 0; - public static int tp_getset = 0; - public static int tp_base = 0; - public static int tp_dict = 0; - public static int tp_descr_get = 0; - public static int tp_descr_set = 0; - public static int tp_dictoffset = 0; - public static int tp_init = 0; - public static int tp_alloc = 0; - public static int tp_new = 0; - public static int tp_free = 0; - public static int tp_is_gc = 0; - public static int tp_bases = 0; - public static int tp_mro = 0; - public static int tp_cache = 0; - public static int tp_subclasses = 0; - public static int tp_weaklist = 0; - public static int tp_del = 0; - public static int tp_version_tag = 0; - public static int tp_finalize = 0; - public static int tp_vectorcall = 0; - public static int tp_print = 0; - public static int am_await = 0; - public static int am_aiter = 0; - public static int am_anext = 0; - public static int nb_add = 0; - public static int nb_subtract = 0; - public static int nb_multiply = 0; - public static int nb_remainder = 0; - public static int nb_divmod = 0; - public static int nb_power = 0; - public static int nb_negative = 0; - public static int nb_positive = 0; - public static int nb_absolute = 0; - public static int nb_bool = 0; - public static int nb_invert = 0; - public static int nb_lshift = 0; - public static int nb_rshift = 0; - public static int nb_and = 0; - public static int nb_xor = 0; - public static int nb_or = 0; - public static int nb_int = 0; - public static int nb_reserved = 0; - public static int nb_float = 0; - public static int nb_inplace_add = 0; - public static int nb_inplace_subtract = 0; - public static int nb_inplace_multiply = 0; - public static int nb_inplace_remainder = 0; - public static int nb_inplace_power = 0; - public static int nb_inplace_lshift = 0; - public static int nb_inplace_rshift = 0; - public static int nb_inplace_and = 0; - public static int nb_inplace_xor = 0; - public static int nb_inplace_or = 0; - public static int nb_floor_divide = 0; - public static int nb_true_divide = 0; - public static int nb_inplace_floor_divide = 0; - public static int nb_inplace_true_divide = 0; - public static int nb_index = 0; - public static int nb_matrix_multiply = 0; - public static int nb_inplace_matrix_multiply = 0; - public static int mp_length = 0; - public static int mp_subscript = 0; - public static int mp_ass_subscript = 0; - public static int sq_length = 0; - public static int sq_concat = 0; - public static int sq_repeat = 0; - public static int sq_item = 0; - public static int was_sq_slice = 0; - public static int sq_ass_item = 0; - public static int was_sq_ass_slice = 0; - public static int sq_contains = 0; - public static int sq_inplace_concat = 0; - public static int sq_inplace_repeat = 0; - public static int bf_getbuffer = 0; - public static int bf_releasebuffer = 0; - public static int name = 0; - public static int ht_slots = 0; - public static int qualname = 0; - public static int ht_cached_keys = 0; - - /* here are optional user slots, followed by the members. */ - public static int members = 0; - } -} - -#endif diff --git a/src/runtime/nativecall.cs b/src/runtime/nativecall.cs deleted file mode 100644 index 4a7bf05c8..000000000 --- a/src/runtime/nativecall.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.InteropServices; -using System.Threading; - -namespace Python.Runtime -{ - /// - /// Provides support for calling native code indirectly through - /// function pointers. Most of the important parts of the Python - /// C API can just be wrapped with p/invoke, but there are some - /// situations (specifically, calling functions through Python - /// type structures) where we need to call functions indirectly. - /// This class uses Reflection.Emit to generate IJW thunks that - /// support indirect calls to native code using various common - /// call signatures. This is mainly a workaround for the fact - /// that you can't spell an indirect call in C# (but can in IL). - /// Another approach that would work is for this to be turned - /// into a separate utility program that could be run during the - /// build process to generate the thunks as a separate assembly - /// that could then be referenced by the main Python runtime. - /// - internal class NativeCall - { -#if NETSTANDARD - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void Void_1_Delegate(IntPtr a1); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate int Int_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3); - - public static void Void_Call_1(IntPtr fp, IntPtr a1) - { - var d = Marshal.GetDelegateForFunctionPointer(fp); - d(a1); - } - - public static IntPtr Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) - { - var d = Marshal.GetDelegateForFunctionPointer(fp); - return d(a1, a2, a3); - } - - - public static int Int_Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) - { - var d = Marshal.GetDelegateForFunctionPointer(fp); - return d(a1, a2, a3); - } -#else - private static AssemblyBuilder aBuilder; - private static ModuleBuilder mBuilder; - - public static INativeCall Impl; - - static NativeCall() - { - // The static constructor is responsible for generating the - // assembly and the methods that implement the IJW thunks. - // - // To do this, we actually use reflection on the INativeCall - // interface (defined below) and generate the required thunk - // code based on the method signatures. - - var aname = new AssemblyName { Name = "e__NativeCall_Assembly" }; - var aa = AssemblyBuilderAccess.Run; - - aBuilder = Thread.GetDomain().DefineDynamicAssembly(aname, aa); - mBuilder = aBuilder.DefineDynamicModule("e__NativeCall_Module"); - - var ta = TypeAttributes.Public; - TypeBuilder tBuilder = mBuilder.DefineType("e__NativeCall", ta); - - Type iType = typeof(INativeCall); - tBuilder.AddInterfaceImplementation(iType); - - // Use reflection to loop over the INativeCall interface methods, - // calling GenerateThunk to create a managed thunk for each one. - - foreach (MethodInfo method in iType.GetMethods()) - { - GenerateThunk(tBuilder, method); - } - - Type theType = tBuilder.CreateType(); - - Impl = (INativeCall)Activator.CreateInstance(theType); - } - - private static void GenerateThunk(TypeBuilder tb, MethodInfo method) - { - ParameterInfo[] pi = method.GetParameters(); - int count = pi.Length; - int argc = count - 1; - - var args = new Type[count]; - for (var i = 0; i < count; i++) - { - args[i] = pi[i].ParameterType; - } - - MethodBuilder mb = tb.DefineMethod( - method.Name, - MethodAttributes.Public | - MethodAttributes.Virtual, - method.ReturnType, - args - ); - - // Build the method signature for the actual native function. - // This is essentially the signature of the wrapper method - // minus the first argument (the passed in function pointer). - - var nargs = new Type[argc]; - for (var i = 1; i < count; i++) - { - nargs[i - 1] = args[i]; - } - - // IL generation: the (implicit) first argument of the method - // is the 'this' pointer and the second is the function pointer. - // This code pushes the real args onto the stack, followed by - // the function pointer, then the calli opcode to make the call. - - ILGenerator il = mb.GetILGenerator(); - - for (var i = 0; i < argc; i++) - { - il.Emit(OpCodes.Ldarg_S, i + 2); - } - - il.Emit(OpCodes.Ldarg_1); - - il.EmitCalli(OpCodes.Calli, - CallingConvention.Cdecl, - method.ReturnType, - nargs - ); - - il.Emit(OpCodes.Ret); - - tb.DefineMethodOverride(mb, method); - } - - - public static void Void_Call_1(IntPtr fp, IntPtr a1) - { - Impl.Void_Call_1(fp, a1); - } - - public static IntPtr Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) - { - return Impl.Call_3(fp, a1, a2, a3); - } - - public static int Int_Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3) - { - return Impl.Int_Call_3(fp, a1, a2, a3); - } -#endif - } - -#if !NETSTANDARD - /// - /// Defines native call signatures to be generated by NativeCall. - /// - public interface INativeCall - { - void Void_Call_0(IntPtr funcPtr); - - void Void_Call_1(IntPtr funcPtr, IntPtr arg1); - - int Int_Call_3(IntPtr funcPtr, IntPtr t, IntPtr n, IntPtr v); - - IntPtr Call_3(IntPtr funcPtr, IntPtr a1, IntPtr a2, IntPtr a3); - } -#endif -} diff --git a/src/testing/Python.Test.15.csproj b/src/testing/Python.Test.15.csproj deleted file mode 100644 index 8c23fe4b5..000000000 --- a/src/testing/Python.Test.15.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - net40;netstandard2.0 - x64;x86 - DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3 - Python.Test - Python.Test - Python.Test - 2.4.1 - bin\ - false - $(OutputPath)\$(AssemblyName).xml - $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml - 1591,0067 - ..\..\ - $(SolutionDir)\bin\ - $(PythonBuildDir)\$(TargetFramework)\ - 6 - false - ..\pythonnet.snk - prompt - $(PYTHONNET_DEFINE_CONSTANTS) - XPLAT - $(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants); - $(DefineConstants);TRACE;DEBUG - $(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\ - - - x86 - - - x64 - - - - false - full - - - true - pdbonly - - - true - false - full - - - true - true - portable - - - - $(DefineConstants);DEBUG;TRACE - - - $(DefineConstants) - - - - - - - - - - - - - - - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - - diff --git a/src/testing/Python.Test.csproj b/src/testing/Python.Test.csproj deleted file mode 100644 index 515fd928c..000000000 --- a/src/testing/Python.Test.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - Debug - AnyCPU - {6F401A34-273B-450F-9A4C-13550BE0767B} - Library - Python.Test - Python.Test - bin\Python.Test.xml - bin\ - v4.0 - - 1591,0067 - ..\..\ - $(SolutionDir)\bin\ - 6 - false - ..\pythonnet.snk - prompt - - - x86 - - - x64 - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - true - DEBUG;TRACE - full - - - - - true - pdbonly - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {097B4AC0-74E9-4C58-BCF8-C69746EC8271} - Python.Runtime - - - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - - - diff --git a/src/tests/__init__.py b/tests/__init__.py similarity index 100% rename from src/tests/__init__.py rename to tests/__init__.py diff --git a/src/tests/_compat.py b/tests/_compat.py similarity index 100% rename from src/tests/_compat.py rename to tests/_compat.py diff --git a/src/tests/_missing_import.py b/tests/_missing_import.py similarity index 100% rename from src/tests/_missing_import.py rename to tests/_missing_import.py diff --git a/src/tests/conftest.py b/tests/conftest.py similarity index 100% rename from src/tests/conftest.py rename to tests/conftest.py diff --git a/src/tests/fixtures/.gitkeep b/tests/fixtures/.gitkeep similarity index 100% rename from src/tests/fixtures/.gitkeep rename to tests/fixtures/.gitkeep diff --git a/src/tests/fixtures/argv-fixture.py b/tests/fixtures/argv-fixture.py similarity index 100% rename from src/tests/fixtures/argv-fixture.py rename to tests/fixtures/argv-fixture.py diff --git a/src/tests/fixtures/netstandard2.0/.gitkeep b/tests/fixtures/netstandard2.0/.gitkeep similarity index 100% rename from src/tests/fixtures/netstandard2.0/.gitkeep rename to tests/fixtures/netstandard2.0/.gitkeep diff --git a/src/tests/importtest.py b/tests/importtest.py similarity index 100% rename from src/tests/importtest.py rename to tests/importtest.py diff --git a/src/tests/leaktest.py b/tests/leaktest.py similarity index 100% rename from src/tests/leaktest.py rename to tests/leaktest.py diff --git a/src/tests/profile.py b/tests/profile.py similarity index 100% rename from src/tests/profile.py rename to tests/profile.py diff --git a/src/tests/runtests.py b/tests/runtests.py similarity index 100% rename from src/tests/runtests.py rename to tests/runtests.py diff --git a/src/tests/stress.py b/tests/stress.py similarity index 100% rename from src/tests/stress.py rename to tests/stress.py diff --git a/src/tests/stresstest.py b/tests/stresstest.py similarity index 100% rename from src/tests/stresstest.py rename to tests/stresstest.py diff --git a/src/tests/test_array.py b/tests/test_array.py similarity index 100% rename from src/tests/test_array.py rename to tests/test_array.py diff --git a/src/tests/test_callback.py b/tests/test_callback.py similarity index 100% rename from src/tests/test_callback.py rename to tests/test_callback.py diff --git a/src/tests/test_class.py b/tests/test_class.py similarity index 100% rename from src/tests/test_class.py rename to tests/test_class.py diff --git a/src/tests/test_clrmethod.py b/tests/test_clrmethod.py similarity index 100% rename from src/tests/test_clrmethod.py rename to tests/test_clrmethod.py diff --git a/src/tests/test_compat.py b/tests/test_compat.py similarity index 100% rename from src/tests/test_compat.py rename to tests/test_compat.py diff --git a/src/tests/test_constructors.py b/tests/test_constructors.py similarity index 100% rename from src/tests/test_constructors.py rename to tests/test_constructors.py diff --git a/src/tests/test_conversion.py b/tests/test_conversion.py similarity index 100% rename from src/tests/test_conversion.py rename to tests/test_conversion.py diff --git a/src/tests/test_delegate.py b/tests/test_delegate.py similarity index 100% rename from src/tests/test_delegate.py rename to tests/test_delegate.py diff --git a/src/tests/test_docstring.py b/tests/test_docstring.py similarity index 100% rename from src/tests/test_docstring.py rename to tests/test_docstring.py diff --git a/src/tests/test_engine.py b/tests/test_engine.py similarity index 100% rename from src/tests/test_engine.py rename to tests/test_engine.py diff --git a/src/tests/test_enum.py b/tests/test_enum.py similarity index 100% rename from src/tests/test_enum.py rename to tests/test_enum.py diff --git a/src/tests/test_event.py b/tests/test_event.py similarity index 100% rename from src/tests/test_event.py rename to tests/test_event.py diff --git a/src/tests/test_exceptions.py b/tests/test_exceptions.py similarity index 100% rename from src/tests/test_exceptions.py rename to tests/test_exceptions.py diff --git a/src/tests/test_field.py b/tests/test_field.py similarity index 100% rename from src/tests/test_field.py rename to tests/test_field.py diff --git a/src/tests/test_generic.py b/tests/test_generic.py similarity index 100% rename from src/tests/test_generic.py rename to tests/test_generic.py diff --git a/src/tests/test_import.py b/tests/test_import.py similarity index 100% rename from src/tests/test_import.py rename to tests/test_import.py diff --git a/src/tests/test_indexer.py b/tests/test_indexer.py similarity index 100% rename from src/tests/test_indexer.py rename to tests/test_indexer.py diff --git a/src/tests/test_interface.py b/tests/test_interface.py similarity index 100% rename from src/tests/test_interface.py rename to tests/test_interface.py diff --git a/src/tests/test_method.py b/tests/test_method.py similarity index 100% rename from src/tests/test_method.py rename to tests/test_method.py diff --git a/src/tests/test_module.py b/tests/test_module.py similarity index 100% rename from src/tests/test_module.py rename to tests/test_module.py diff --git a/src/tests/test_mp_length.py b/tests/test_mp_length.py similarity index 100% rename from src/tests/test_mp_length.py rename to tests/test_mp_length.py diff --git a/src/tests/test_property.py b/tests/test_property.py similarity index 100% rename from src/tests/test_property.py rename to tests/test_property.py diff --git a/src/tests/test_recursive_types.py b/tests/test_recursive_types.py similarity index 100% rename from src/tests/test_recursive_types.py rename to tests/test_recursive_types.py diff --git a/src/tests/test_repr.py b/tests/test_repr.py similarity index 100% rename from src/tests/test_repr.py rename to tests/test_repr.py diff --git a/src/tests/test_subclass.py b/tests/test_subclass.py similarity index 100% rename from src/tests/test_subclass.py rename to tests/test_subclass.py diff --git a/src/tests/test_sysargv.py b/tests/test_sysargv.py similarity index 100% rename from src/tests/test_sysargv.py rename to tests/test_sysargv.py diff --git a/src/tests/test_thread.py b/tests/test_thread.py similarity index 100% rename from src/tests/test_thread.py rename to tests/test_thread.py diff --git a/src/tests/tests.pyproj b/tests/tests.pyproj similarity index 100% rename from src/tests/tests.pyproj rename to tests/tests.pyproj diff --git a/src/tests/utils.py b/tests/utils.py similarity index 100% rename from src/tests/utils.py rename to tests/utils.py diff --git a/tools/nuget/nuget.exe b/tools/nuget/nuget.exe deleted file mode 100644 index 463f8e137..000000000 Binary files a/tools/nuget/nuget.exe and /dev/null differ diff --git a/tools/remap_dll_target/Program.cs b/tools/remap_dll_target/Program.cs new file mode 100644 index 000000000..b6f5a721a --- /dev/null +++ b/tools/remap_dll_target/Program.cs @@ -0,0 +1,53 @@ +using System.ComponentModel; +using System.Reflection; +using System.Xml.Linq; +using System; +using System.Linq; +using Mono.Cecil; + +namespace RemapDllTarget +{ + class Program + { + static void Main(string[] args) + { + var filename = args[0]; + Console.WriteLine($"Loading existing DLL {filename}..."); + var def = AssemblyDefinition.ReadAssembly(filename, new ReaderParameters { + ReadingMode = ReadingMode.Immediate, + ReadWrite = true, + InMemory = true + }); + + var mappings = args.Skip(1) + .Select(x => x.Split('=', 2).ToArray()) + .ToDictionary(x => x[0], x => new ModuleReference(x[1])); + + Console.WriteLine($"Remapping DllImport paths in {filename}..."); + foreach (var kvp in mappings) { + Console.WriteLine($"{kvp.Key} => {kvp.Value}"); + } + + var module = def.MainModule; + foreach (var mref in mappings.Values) + module.ModuleReferences.Add(mref); + + foreach (var type in def.MainModule.Types) { + foreach (var func in type.Methods) { + if (func.HasPInvokeInfo) { + var info = func.PInvokeInfo; + if (mappings.TryGetValue(info.Module.Name, out ModuleReference newRef)) { + Console.WriteLine($"Remapping {info.EntryPoint}: {info.Module} => {newRef}"); + info.Module = newRef; + } + + func.PInvokeInfo = info; + } + } + } + + Console.WriteLine($"Writing result"); + def.Write(filename); + } + } +} diff --git a/tools/remap_dll_target/remap_dll_target.csproj b/tools/remap_dll_target/remap_dll_target.csproj new file mode 100644 index 000000000..6824a9ff6 --- /dev/null +++ b/tools/remap_dll_target/remap_dll_target.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.1 + + + + + + + diff --git a/tools/vswhere/vswhere.exe b/tools/vswhere/vswhere.exe deleted file mode 100644 index 582e82868..000000000 Binary files a/tools/vswhere/vswhere.exe and /dev/null differ diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 3c9be5c63..000000000 --- a/tox.ini +++ /dev/null @@ -1,27 +0,0 @@ -[tox] -skip_missing_interpreters=True -envlist = - py27 - py33 - py34 - py35 - py36 - py37 - check - -[testenv] -deps = - pytest -commands = - {posargs:py.test} - -[testenv:check] -ignore_errors=True -skip_install=True -basepython=python3.5 -deps = - check-manifest - flake8 -commands = - flake8 src setup.py - python setup.py check --strict --metadata