From 993ad8d35756676f62586948042139a86e69b43d Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Thu, 6 Aug 2020 18:06:41 -0700 Subject: [PATCH 1/7] project configs --- src/runtime/Python.Runtime.csproj | 52 ++++--------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index 75f5e2fab..479721434 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -5,7 +5,7 @@ AnyCPU {097B4AC0-74E9-4C58-BCF8-C69746EC8271} Library - Python.Runtime + pyRevitLabs.PythonNet Python.Runtime bin\Python.Runtime.xml bin\ @@ -20,57 +20,17 @@ false ..\pythonnet.snk - - - - - PYTHON2;PYTHON27;UCS4 - true - pdbonly - - - PYTHON3;PYTHON38;UCS4 + + PYTHON3;PYTHON37;UCS2 true pdbonly + bin\pyRevitLabs.PythonNet.xml - - 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 + bin\pyRevitLabs.PythonNet.xml From 881d2d0d203dd2c2c86f8a38a68d01e07a2c30fb Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Thu, 6 Aug 2020 18:07:37 -0700 Subject: [PATCH 2/7] made some internal apis public --- src/runtime/BorrowedReference.cs | 2 +- src/runtime/runtime.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 src/runtime/BorrowedReference.cs mode change 100644 => 100755 src/runtime/runtime.cs diff --git a/src/runtime/BorrowedReference.cs b/src/runtime/BorrowedReference.cs old mode 100644 new mode 100755 index a3bf29056..ff84bac69 --- a/src/runtime/BorrowedReference.cs +++ b/src/runtime/BorrowedReference.cs @@ -5,7 +5,7 @@ namespace Python.Runtime /// Represents a reference to a Python object, that is being lent, and /// can only be safely used until execution returns to the caller. /// - readonly ref struct BorrowedReference + public readonly ref struct BorrowedReference { readonly IntPtr pointer; public bool IsNull => this.pointer == IntPtr.Zero; diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs old mode 100644 new mode 100755 index 8cf24ba70..c29af2f5d --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -794,7 +794,7 @@ public static extern int Py_Main( internal static extern void PyEval_RestoreThread(IntPtr tstate); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr PyEval_GetBuiltins(); + public static extern IntPtr PyEval_GetBuiltins(); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyEval_GetGlobals(); @@ -1559,7 +1559,7 @@ internal static IntPtr PyUnicode_FromString(string s) return PyUnicode_FromUnicode(s, s.Length); } - internal static string GetManagedString(in BorrowedReference borrowedReference) + public static string GetManagedString(in BorrowedReference borrowedReference) => GetManagedString(borrowedReference.DangerousGetAddress()); /// /// Function to access the internal PyUnicode/PyString object and @@ -1625,7 +1625,7 @@ internal static bool PyDict_Check(IntPtr ob) internal static extern int PyDict_SetItem(IntPtr pointer, IntPtr key, IntPtr value); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] - internal static extern int PyDict_SetItemString(IntPtr pointer, string key, IntPtr value); + public static extern int PyDict_SetItemString(IntPtr pointer, string key, IntPtr value); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern int PyDict_DelItem(IntPtr pointer, IntPtr key); @@ -1683,13 +1683,13 @@ internal static IntPtr PyList_New(long size) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr PyList_AsTuple(IntPtr pointer); - internal static BorrowedReference PyList_GetItem(IntPtr pointer, long index) + public static BorrowedReference PyList_GetItem(IntPtr pointer, long index) { return PyList_GetItem(pointer, new IntPtr(index)); } [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] - private static extern BorrowedReference PyList_GetItem(IntPtr pointer, IntPtr index); + public static extern BorrowedReference PyList_GetItem(IntPtr pointer, IntPtr index); internal static int PyList_SetItem(IntPtr pointer, long index, IntPtr value) { @@ -1699,7 +1699,7 @@ internal static int PyList_SetItem(IntPtr pointer, long index, IntPtr value) [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] private static extern int PyList_SetItem(IntPtr pointer, IntPtr index, IntPtr value); - internal static int PyList_Insert(BorrowedReference pointer, long index, IntPtr value) + public static int PyList_Insert(BorrowedReference pointer, long index, IntPtr value) { return PyList_Insert(pointer, new IntPtr(index), value); } @@ -1708,7 +1708,7 @@ internal static int PyList_Insert(BorrowedReference pointer, long index, IntPtr private static extern int PyList_Insert(BorrowedReference pointer, IntPtr index, IntPtr value); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] - internal static extern int PyList_Append(BorrowedReference pointer, IntPtr value); + public static extern int PyList_Append(BorrowedReference pointer, IntPtr value); [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] internal static extern int PyList_Reverse(BorrowedReference pointer); From 291d8822b81952a1fdb52a30863d6836906e733d Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Mon, 10 Aug 2020 20:18:54 -0700 Subject: [PATCH 3/7] updated post build scripts --- src/runtime/Python.Runtime.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index 479721434..1ba171430 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -25,12 +25,14 @@ true pdbonly bin\pyRevitLabs.PythonNet.xml + copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\378" PYTHON3;PYTHON38;UCS2 true pdbonly bin\pyRevitLabs.PythonNet.xml + copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\385" From 41c175ef4d26aa0e1807d35b238177d641c65d67 Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Fri, 22 Jan 2021 15:52:25 -0800 Subject: [PATCH 4/7] updated build paths --- src/runtime/Python.Runtime.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index 1ba171430..0d80c741c 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -25,14 +25,14 @@ true pdbonly bin\pyRevitLabs.PythonNet.xml - copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\378" + copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\CPY378" PYTHON3;PYTHON38;UCS2 true pdbonly bin\pyRevitLabs.PythonNet.xml - copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\385" + copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\CPY385" From 86e3b3b6ed131c04a6c712ad338725e8bf09be3a Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Sun, 17 Oct 2021 10:01:28 -0700 Subject: [PATCH 5/7] updated pythonnet to use modern dotnet sdk --- src/runtime/Python.Runtime.csproj | 148 ++++-------------------------- 1 file changed, 16 insertions(+), 132 deletions(-) diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index 0d80c741c..b820eb790 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -1,148 +1,32 @@ - - + - Debug - AnyCPU - {097B4AC0-74E9-4C58-BCF8-C69746EC8271} Library pyRevitLabs.PythonNet - Python.Runtime - bin\Python.Runtime.xml - bin\ - v4.0 - - 1591 - ..\..\ - $(SolutionDir)\bin\ - Properties - 7.3 true - false - ..\pythonnet.snk + Debug;ReleasePY37;ReleasePY38 + - PYTHON3;PYTHON37;UCS2 - true - pdbonly - bin\pyRevitLabs.PythonNet.xml - copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\CPY378" + $(DefineConstants);PYTHON3;PYTHON37;UCS2 + CPY378 - - PYTHON3;PYTHON38;UCS2 - true - pdbonly - bin\pyRevitLabs.PythonNet.xml - copy "$(TargetDir)pyRevitLabs.PythonNet.dll" "$(TargetDir)..\..\..\..\..\..\bin\engines\CPY385" + + + $(DefineConstants);PYTHON3;PYTHON38;UCS2 + CPY385 + - - - - - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Properties\AssemblyInfo.cs + clr.py - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - + + + - \ No newline at end of file + From 5214f72f10fb6ab26256e3f575630dc513234dea Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Sun, 17 Oct 2021 10:02:27 -0700 Subject: [PATCH 6/7] excluded assminfo --- src/runtime/Python.Runtime.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index b820eb790..1f6837011 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -6,6 +6,10 @@ Debug;ReleasePY37;ReleasePY38 + + Properties\AssemblyInfo.cs + + $(DefineConstants);PYTHON3;PYTHON37;UCS2 CPY378 @@ -16,10 +20,6 @@ CPY385 - - Properties\AssemblyInfo.cs - - clr.py From bbc74f2fcd64a6fc6d261aca9d9826f0b3acfe50 Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Wed, 22 Nov 2023 04:36:57 -0800 Subject: [PATCH 7/7] attempt to fix nuget pull issue --- NuGet.config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 5210cd6c9..726e088b7 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,6 @@ - - \ No newline at end of file +