summaryrefslogtreecommitdiffstats
path: root/contrib/python/psutil/py2
diff options
context:
space:
mode:
authormaxim-yurchuk <[email protected]>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <[email protected]>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/psutil/py2
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/psutil/py2')
-rw-r--r--contrib/python/psutil/py2/.yandex_meta/yamaker.yaml12
-rw-r--r--contrib/python/psutil/py2/patches/01-arcadia.patch24
-rw-r--r--contrib/python/psutil/py2/patches/02-unaccepted-pr2064-missing-extern.patch190
-rw-r--r--contrib/python/psutil/py2/patches/99-fix-ya.make.patch106
4 files changed, 332 insertions, 0 deletions
diff --git a/contrib/python/psutil/py2/.yandex_meta/yamaker.yaml b/contrib/python/psutil/py2/.yandex_meta/yamaker.yaml
new file mode 100644
index 00000000000..ba9b20e0d4f
--- /dev/null
+++ b/contrib/python/psutil/py2/.yandex_meta/yamaker.yaml
@@ -0,0 +1,12 @@
+disable_includes:
+ - arch/aix/ifaddrs.h
+ - arch/solaris/v10/ifaddrs.h
+exclude:
+ - psutil/_psutil_aix.c
+ - psutil/_psutil_bsd.c
+ - psutil/_psutil_sunos.c
+ - psutil/arch/aix/*
+ - psutil/arch/freebsd/*
+ - psutil/arch/netbsd/*
+ - psutil/arch/openbsd/*
+ - psutil/arch/solaris/*
diff --git a/contrib/python/psutil/py2/patches/01-arcadia.patch b/contrib/python/psutil/py2/patches/01-arcadia.patch
new file mode 100644
index 00000000000..a38e5a2942a
--- /dev/null
+++ b/contrib/python/psutil/py2/patches/01-arcadia.patch
@@ -0,0 +1,24 @@
+--- contrib/python/psutil/py2/psutil/_pslinux.py (index)
++++ contrib/python/psutil/py2/psutil/_pslinux.py (working tree)
+@@ -322,7 +322,10 @@ try:
+ except ImportError:
+ import ctypes
+
+- libc = ctypes.CDLL(None, use_errno=True)
++ try:
++ libc = ctypes.CDLL(None, use_errno=True)
++ except:
++ libc = None
+
+ if hasattr(libc, "prlimit"):
+
+--- contrib/python/psutil/py2/psutil/arch/windows/disk.c (index)
++++ contrib/python/psutil/py2/psutil/arch/windows/disk.c (working tree)
+@@ -7,6 +7,7 @@
+ #include <Python.h>
+ #include <windows.h>
+ #include <tchar.h>
++#include <winioctl.h>
+
+ #include "../../_psutil_common.h"
+
diff --git a/contrib/python/psutil/py2/patches/02-unaccepted-pr2064-missing-extern.patch b/contrib/python/psutil/py2/patches/02-unaccepted-pr2064-missing-extern.patch
new file mode 100644
index 00000000000..b35935edf5c
--- /dev/null
+++ b/contrib/python/psutil/py2/patches/02-unaccepted-pr2064-missing-extern.patch
@@ -0,0 +1,190 @@
+commit a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e (HEAD -> ymake-refactoring)
+author: thegeorg
+date: 2022-01-24T14:25:44+03:00
+
+ Make psutil compile with -fno-common
+
+--- contrib/python/psutil/py2/psutil/_psutil_common.c (dd7c6db013778a31c03086c567edb72a9dfa4604)
++++ contrib/python/psutil/py2/psutil/_psutil_common.c (a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e)
+@@ -7,6 +7,7 @@
+ */
+
+ #include <Python.h>
++#define PSUTIL_MAYBE_EXTERN
+ #include "_psutil_common.h"
+
+ // ====================================================================
+--- contrib/python/psutil/py2/psutil/arch/windows/ntextapi.h (dd7c6db013778a31c03086c567edb72a9dfa4604)
++++ contrib/python/psutil/py2/psutil/arch/windows/ntextapi.h (a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e)
+@@ -10,6 +10,10 @@
+ #include <winternl.h>
+ #include <iphlpapi.h>
+
++#ifndef PSUTIL_MAYBE_EXTERN
++#define PSUTIL_MAYBE_EXTERN extern
++#endif
++
+ typedef LONG NTSTATUS;
+
+ // https://github.com/ajkhoury/TestDll/blob/master/nt_ddk.h
+@@ -550,14 +554,14 @@ typedef struct {
+ // Type defs for modules loaded at runtime.
+ // ================================================================
+
+-BOOL (WINAPI *_GetLogicalProcessorInformationEx) (
++PSUTIL_MAYBE_EXTERN BOOL (WINAPI *_GetLogicalProcessorInformationEx) (
+ LOGICAL_PROCESSOR_RELATIONSHIP relationship,
+ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer,
+ PDWORD ReturnLength);
+
+ #define GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx
+
+-BOOLEAN (WINAPI * _WinStationQueryInformationW) (
++PSUTIL_MAYBE_EXTERN BOOLEAN (WINAPI * _WinStationQueryInformationW) (
+ HANDLE ServerHandle,
+ ULONG SessionId,
+ WINSTATIONINFOCLASS WinStationInformationClass,
+@@ -567,7 +571,7 @@ BOOLEAN (WINAPI * _WinStationQueryInformationW) (
+
+ #define WinStationQueryInformationW _WinStationQueryInformationW
+
+-NTSTATUS (NTAPI *_NtQueryInformationProcess) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryInformationProcess) (
+ HANDLE ProcessHandle,
+ DWORD ProcessInformationClass,
+ PVOID ProcessInformation,
+@@ -576,7 +580,7 @@ NTSTATUS (NTAPI *_NtQueryInformationProcess) (
+
+ #define NtQueryInformationProcess _NtQueryInformationProcess
+
+-NTSTATUS (NTAPI *_NtQuerySystemInformation) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQuerySystemInformation) (
+ ULONG SystemInformationClass,
+ PVOID SystemInformation,
+ ULONG SystemInformationLength,
+@@ -584,7 +588,7 @@ NTSTATUS (NTAPI *_NtQuerySystemInformation) (
+
+ #define NtQuerySystemInformation _NtQuerySystemInformation
+
+-NTSTATUS (NTAPI *_NtSetInformationProcess) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtSetInformationProcess) (
+ HANDLE ProcessHandle,
+ DWORD ProcessInformationClass,
+ PVOID ProcessInformation,
+@@ -592,19 +596,19 @@ NTSTATUS (NTAPI *_NtSetInformationProcess) (
+
+ #define NtSetInformationProcess _NtSetInformationProcess
+
+-PSTR (NTAPI * _RtlIpv4AddressToStringA) (
++PSUTIL_MAYBE_EXTERN PSTR (NTAPI * _RtlIpv4AddressToStringA) (
+ struct in_addr *Addr,
+ PSTR S);
+
+ #define RtlIpv4AddressToStringA _RtlIpv4AddressToStringA
+
+-PSTR (NTAPI * _RtlIpv6AddressToStringA) (
++PSUTIL_MAYBE_EXTERN PSTR (NTAPI * _RtlIpv6AddressToStringA) (
+ struct in6_addr *Addr,
+ PSTR P);
+
+ #define RtlIpv6AddressToStringA _RtlIpv6AddressToStringA
+
+-DWORD (WINAPI * _GetExtendedTcpTable) (
++PSUTIL_MAYBE_EXTERN DWORD (WINAPI * _GetExtendedTcpTable) (
+ PVOID pTcpTable,
+ PDWORD pdwSize,
+ BOOL bOrder,
+@@ -614,7 +618,7 @@ DWORD (WINAPI * _GetExtendedTcpTable) (
+
+ #define GetExtendedTcpTable _GetExtendedTcpTable
+
+-DWORD (WINAPI * _GetExtendedUdpTable) (
++PSUTIL_MAYBE_EXTERN DWORD (WINAPI * _GetExtendedUdpTable) (
+ PVOID pUdpTable,
+ PDWORD pdwSize,
+ BOOL bOrder,
+@@ -624,12 +628,12 @@ DWORD (WINAPI * _GetExtendedUdpTable) (
+
+ #define GetExtendedUdpTable _GetExtendedUdpTable
+
+-DWORD (CALLBACK *_GetActiveProcessorCount) (
++PSUTIL_MAYBE_EXTERN DWORD (CALLBACK *_GetActiveProcessorCount) (
+ WORD GroupNumber);
+
+ #define GetActiveProcessorCount _GetActiveProcessorCount
+
+-BOOL(CALLBACK *_WTSQuerySessionInformationW) (
++PSUTIL_MAYBE_EXTERN BOOL(CALLBACK *_WTSQuerySessionInformationW) (
+ HANDLE hServer,
+ DWORD SessionId,
+ WTS_INFO_CLASS WTSInfoClass,
+@@ -639,7 +643,7 @@ BOOL(CALLBACK *_WTSQuerySessionInformationW) (
+
+ #define WTSQuerySessionInformationW _WTSQuerySessionInformationW
+
+-BOOL(CALLBACK *_WTSEnumerateSessionsW)(
++PSUTIL_MAYBE_EXTERN BOOL(CALLBACK *_WTSEnumerateSessionsW)(
+ HANDLE hServer,
+ DWORD Reserved,
+ DWORD Version,
+@@ -649,18 +653,18 @@ BOOL(CALLBACK *_WTSEnumerateSessionsW)(
+
+ #define WTSEnumerateSessionsW _WTSEnumerateSessionsW
+
+-VOID(CALLBACK *_WTSFreeMemory)(
++PSUTIL_MAYBE_EXTERN VOID(CALLBACK *_WTSFreeMemory)(
+ IN PVOID pMemory
+ );
+
+ #define WTSFreeMemory _WTSFreeMemory
+
+-ULONGLONG (CALLBACK *_GetTickCount64) (
++PSUTIL_MAYBE_EXTERN ULONGLONG (CALLBACK *_GetTickCount64) (
+ void);
+
+ #define GetTickCount64 _GetTickCount64
+
+-NTSTATUS (NTAPI *_NtQueryObject) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryObject) (
+ HANDLE Handle,
+ OBJECT_INFORMATION_CLASS ObjectInformationClass,
+ PVOID ObjectInformation,
+@@ -669,25 +673,25 @@ NTSTATUS (NTAPI *_NtQueryObject) (
+
+ #define NtQueryObject _NtQueryObject
+
+-NTSTATUS (WINAPI *_RtlGetVersion) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_RtlGetVersion) (
+ PRTL_OSVERSIONINFOW lpVersionInformation
+ );
+
+ #define RtlGetVersion _RtlGetVersion
+
+-NTSTATUS (WINAPI *_NtResumeProcess) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_NtResumeProcess) (
+ HANDLE hProcess
+ );
+
+ #define NtResumeProcess _NtResumeProcess
+
+-NTSTATUS (WINAPI *_NtSuspendProcess) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_NtSuspendProcess) (
+ HANDLE hProcess
+ );
+
+ #define NtSuspendProcess _NtSuspendProcess
+
+-NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
++PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
+ HANDLE ProcessHandle,
+ PVOID BaseAddress,
+ int MemoryInformationClass,
+@@ -698,7 +702,7 @@ NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
+
+ #define NtQueryVirtualMemory _NtQueryVirtualMemory
+
+-ULONG (WINAPI *_RtlNtStatusToDosErrorNoTeb) (
++PSUTIL_MAYBE_EXTERN ULONG (WINAPI *_RtlNtStatusToDosErrorNoTeb) (
+ NTSTATUS status
+ );
+
diff --git a/contrib/python/psutil/py2/patches/99-fix-ya.make.patch b/contrib/python/psutil/py2/patches/99-fix-ya.make.patch
new file mode 100644
index 00000000000..9c9f8e6df39
--- /dev/null
+++ b/contrib/python/psutil/py2/patches/99-fix-ya.make.patch
@@ -0,0 +1,106 @@
+--- contrib/python/psutil/py2/ya.make (index)
++++ contrib/python/psutil/py2/ya.make (working tree)
+@@ -1,2 +0,0 @@
+-# Generated by devtools/yamaker (pypi).
+-
+@@ -32,6 +29,0 @@ CFLAGS(
+- -DPSUTIL_POSIX=1
+- -DPSUTIL_LINUX=1
+- -DPSUTIL_POSIX=1
+- -DPSUTIL_OSX=1
+- -DPSUTIL_WINDOWS=1
+- -DPSUTIL_SIZEOF_PID_T=4
+@@ -42,15 +33,0 @@ SRCS(
+- psutil/_psutil_linux.c
+- psutil/_psutil_osx.c
+- psutil/_psutil_posix.c
+- psutil/_psutil_windows.c
+- psutil/arch/osx/process_info.c
+- psutil/arch/windows/cpu.c
+- psutil/arch/windows/disk.c
+- psutil/arch/windows/net.c
+- psutil/arch/windows/process_handles.c
+- psutil/arch/windows/process_info.c
+- psutil/arch/windows/process_utils.c
+- psutil/arch/windows/security.c
+- psutil/arch/windows/services.c
+- psutil/arch/windows/socks.c
+- psutil/arch/windows/wmi.c
+@@ -59,6 +36,71 @@ SRCS(
+-PY_REGISTER(
+- psutil._psutil_linux
+- psutil._psutil_osx
+- psutil._psutil_posix
+- psutil._psutil_windows
+-)
++IF (OS_LINUX)
++ CFLAGS(
++ -DPSUTIL_POSIX=1
++ -DPSUTIL_LINUX=1
++ )
++
++ SRCS(
++ psutil/_psutil_linux.c
++ psutil/_psutil_posix.c
++ )
++
++ PY_REGISTER(
++ psutil._psutil_linux
++ psutil._psutil_posix
++ )
++ENDIF()
++
++IF (OS_DARWIN)
++ CFLAGS(
++ -DPSUTIL_POSIX=1
++ -DPSUTIL_OSX=1
++ )
++
++ LDFLAGS(
++ -framework CoreFoundation
++ -framework IOKit
++ )
++
++ SRCS(
++ psutil/_psutil_osx.c
++ psutil/_psutil_posix.c
++ psutil/arch/osx/process_info.c
++ )
++
++ PY_REGISTER(
++ psutil._psutil_osx
++ psutil._psutil_posix
++ )
++ENDIF()
++
++IF (OS_WINDOWS)
++ CFLAGS(
++ -DPSUTIL_WINDOWS=1
++ -DPSUTIL_SIZEOF_PID_T=4
++ )
++
++ LDFLAGS(
++ Shell32.lib
++ PowrProf.lib
++ Wtsapi32.lib
++ Pdh.lib
++ )
++
++ SRCS(
++ psutil/_psutil_windows.c
++ psutil/arch/windows/cpu.c
++ psutil/arch/windows/disk.c
++ psutil/arch/windows/net.c
++ psutil/arch/windows/process_handles.c
++ psutil/arch/windows/process_info.c
++ psutil/arch/windows/process_utils.c
++ psutil/arch/windows/security.c
++ psutil/arch/windows/services.c
++ psutil/arch/windows/socks.c
++ psutil/arch/windows/wmi.c
++ )
++
++ PY_REGISTER(
++ psutil._psutil_windows
++ )
++ENDIF()