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 + 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/Python.Runtime.csproj b/src/runtime/Python.Runtime.csproj index 75f5e2fab..1f6837011 100644 --- a/src/runtime/Python.Runtime.csproj +++ b/src/runtime/Python.Runtime.csproj @@ -1,186 +1,32 @@ - - + - 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 + pyRevitLabs.PythonNet true - false - ..\pythonnet.snk + Debug;ReleasePY37;ReleasePY38 - - - - - 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 + + + Properties\AssemblyInfo.cs - - true - PYTHON2;PYTHON27;UCS2;TRACE;DEBUG - false - full + + + $(DefineConstants);PYTHON3;PYTHON37;UCS2 + CPY378 - - true - PYTHON3;PYTHON38;UCS2;TRACE;DEBUG - false - full + + + $(DefineConstants);PYTHON3;PYTHON38;UCS2 + CPY385 - - - - - - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + clr.py - - - $(TargetPath) - $(TargetDir)$(TargetName).pdb - - - - + + + - \ No newline at end of file + 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);