retracesoftware-proxy 0.1.5__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. retracesoftware/__main__.py +285 -0
  2. retracesoftware/autoenable.py +53 -0
  3. retracesoftware/config.json +19 -233
  4. retracesoftware/config.yaml +0 -0
  5. retracesoftware/install/config.py +6 -0
  6. retracesoftware/install/edgecases.py +23 -1
  7. retracesoftware/install/patcher.py +98 -513
  8. retracesoftware/install/patchfindspec.py +117 -0
  9. retracesoftware/install/phases.py +338 -0
  10. retracesoftware/install/record.py +111 -40
  11. retracesoftware/install/replace.py +28 -0
  12. retracesoftware/install/replay.py +59 -11
  13. retracesoftware/install/tracer.py +171 -33
  14. retracesoftware/install/typeutils.py +20 -0
  15. retracesoftware/modules.toml +384 -0
  16. retracesoftware/preload.txt +216 -0
  17. retracesoftware/proxy/__init__.py +1 -1
  18. retracesoftware/proxy/globalref.py +31 -0
  19. retracesoftware/proxy/messagestream.py +204 -0
  20. retracesoftware/proxy/proxysystem.py +328 -71
  21. retracesoftware/proxy/proxytype.py +90 -38
  22. retracesoftware/proxy/record.py +109 -119
  23. retracesoftware/proxy/replay.py +94 -188
  24. retracesoftware/proxy/serializer.py +28 -0
  25. retracesoftware/proxy/startthread.py +40 -0
  26. retracesoftware/proxy/stubfactory.py +82 -27
  27. retracesoftware/proxy/thread.py +64 -4
  28. retracesoftware/replay.py +104 -0
  29. retracesoftware/run.py +378 -0
  30. retracesoftware/stackdifference.py +133 -0
  31. {retracesoftware_proxy-0.1.5.dist-info → retracesoftware_proxy-0.2.4.dist-info}/METADATA +2 -1
  32. retracesoftware_proxy-0.2.4.dist-info/RECORD +42 -0
  33. retracesoftware_proxy-0.1.5.dist-info/RECORD +0 -27
  34. {retracesoftware_proxy-0.1.5.dist-info → retracesoftware_proxy-0.2.4.dist-info}/WHEEL +0 -0
  35. {retracesoftware_proxy-0.1.5.dist-info → retracesoftware_proxy-0.2.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,384 @@
1
+ [_frozen_importlib_external]
2
+ # "_frozen_importlib_external": {
3
+ # "comment": {
4
+ # "with_state": {
5
+ # "disabled": ["_path_stat"]
6
+ # }
7
+ # }
8
+ # },
9
+
10
+ # "_imp": {
11
+ # "patch_extension_exec": ["exec_dynamic", "exec_builtin"],
12
+ # "comment": {
13
+ # "with_state": {
14
+ # "internal": ["create_dynamic"]
15
+ # }
16
+ # }
17
+ # },
18
+
19
+ [bdb.type_attributes]
20
+ Bdb.disable = ["trace_dispatch"]
21
+
22
+ [pydevd.type_attributes]
23
+ PyDB.disable = ["enable_tracing", "set_suspend", "do_wait_suspend"]
24
+
25
+ ["_pydevd_bundle.pydevd_trace_dispatch_regular".type_attributes]
26
+ ThreadTracer.disable = ["__call__"]
27
+
28
+ [sys]
29
+ disable = ["excepthook"]
30
+
31
+ # [importlib]
32
+ # disable = "import_module"
33
+
34
+ # "importlib._bootstrap": {
35
+ # "comment": {
36
+ # "with_state": {
37
+ # "internal": [
38
+ # "_load_unlocked",
39
+ # "_find_spec",
40
+ # "_lock_unlock_module",
41
+ # "_get_module_lock"]
42
+ # }
43
+ # }
44
+ # },
45
+
46
+ [encodings]
47
+ disable = ["search_function"]
48
+
49
+ [enum]
50
+ immutable = ["Enum"]
51
+
52
+ [os]
53
+ immutable = ["stat_result", "terminal_size", "statvfs_result"]
54
+
55
+ # "mmap": {
56
+ # "proxy": [
57
+ # "mmapXXX"
58
+ # ]
59
+ # },
60
+
61
+ [types]
62
+ patch_hash = ["FunctionType"]
63
+ immutable = ["TracebackType", "ModuleType"]
64
+
65
+ [builtins]
66
+ patch_hash = ["object"]
67
+ disable = ["print"]
68
+ immutable = ["BaseException", "memoryview", "int", "float", "complex", "str", "bytes", "bool", "bytearray",
69
+ "type", "slice"]
70
+
71
+ [_thread]
72
+ proxy = ["allocate", "allocate_lock", "RLock"]
73
+
74
+ [_datetime]
75
+ immutable = ["datetime", "tzinfo", "timezone"]
76
+
77
+ [_datetime.type_attributes]
78
+ datetime.proxy = ["now", "utcnow", "today"]
79
+
80
+ [time]
81
+ immutable = ["struct_time"]
82
+ proxy = ["perf_counter", "time", "gmtime", "localtime", "monotonic", "monotonic_ns", "time_ns"]
83
+
84
+ # "io": {
85
+ # "comment": {
86
+ # "proxy": ["open_code", "open"]
87
+ # },
88
+ # "path_predicates": {
89
+ # "open_code": "path",
90
+ # "open": "file"
91
+ # },
92
+ # "patchtype": {
93
+ # "FileIO": {
94
+ # "readinfo": "retracesoftware.install.edgecases.readinto"
95
+ # },
96
+ # "BufferedReader": {
97
+ # "readinfo": "retracesoftware.install.edgecases.readinto"
98
+ # },
99
+ # "BufferedRandom": {
100
+ # "readinfo": "retracesoftware.install.edgecases.readinto"
101
+ # }
102
+ # }
103
+ # },
104
+
105
+ [pathlib]
106
+ immutable = ["PosixPath"]
107
+
108
+ [posix]
109
+ immutable = ["times_result", "statvfs_result", "uname_result", "stat_result", "terminal_size"]
110
+ # ignore = ["fork", "register_at_fork", "basename", "readlink", "strerror", "listdir", "_path_normpath", "DirEntry"]
111
+ # default = "try_proxy"
112
+
113
+ proxy = [
114
+ "_exit", # Function. Exits the process immediately, bypassing cleanup.
115
+ "_fcopyfile", # Function. Low-level file copying (used in shutil).
116
+ "abort", # Function. Sends SIGABRT to terminate the process.
117
+ "access", # Function. Checks file permissions (os.access).
118
+ "chdir", # Function. Changes the current working directory (os.chdir).
119
+ "chflags", # Function. Sets file flags (Unix-specific).
120
+ "chmod", # Function. Changes file permissions (os.chmod).
121
+ "chown", # Function. Changes file ownership (os.chown).
122
+ "chroot", # Function. Changes the root directory for the process.
123
+ "close", # Function. Closes a file descriptor (os.close).
124
+ "closerange", # Function. Closes a range of file descriptors.
125
+ "confstr", # Function. Gets configuration string values (os.confstr).
126
+ "cpu_count", # Function. Returns the number of CPUs (os.cpu_count).
127
+ "ctermid", # Function. Returns the filename for the controlling terminal.
128
+ "device_encoding", # Function. Returns encoding for a file descriptor.
129
+ "dup", # Function. Duplicates a file descriptor (os.dup).
130
+ "dup2", # Function. Duplicates a file descriptor to a specific value (os.dup2).
131
+ "execv", # Function. Executes a program with a path and arguments (os.execv).
132
+ "execve", # Function. Executes a program with environment variables (os.execve).
133
+ "fchdir", # Function. Changes directory using a file descriptor.
134
+ "fchmod", # Function. Changes permissions of a file descriptor.
135
+ "fchown", # Function. Changes ownership of a file descriptor.
136
+ "fork", # Function. Creates a child process (os.fork).
137
+ "forkpty", # Function. Creates a child process with a pseudo-terminal.
138
+ "fpathconf", # Function. Gets configuration values for a file descriptor (os.fpathconf).
139
+ "fspath", # Function. Converts a path-like object to a string or bytes (os.fspath).
140
+ "fstat", # Function. Gets file status for a file descriptor (os.fstat).
141
+ "fstatvfs", # Function. Gets filesystem information for a file descriptor.
142
+ "fsync", # Function. Synchronizes file contents to disk (os.fsync).
143
+ "ftruncate", # Function. Truncates a file descriptor to a specified length.
144
+ "get_blocking", # Function. Checks if a file descriptor is in blocking mode.
145
+ "get_inheritable", # Function. Checks if a file descriptor is inheritable.
146
+ "get_terminal_size", # Function. Returns terminal size (os.get_terminal_size).
147
+ "getcwd", # Function. Gets the current working directory (os.getcwd).
148
+ "getcwdb", # Function. Gets the current working directory as bytes.
149
+ "getegid", # Function. Gets the effective group ID (os.getegid).
150
+ "geteuid", # Function. Gets the effective user ID (os.geteuid).
151
+ "getgid", # Function. Gets the group ID (os.getgid).
152
+ "getgrouplist", # Function. Gets the list of groups for a user.
153
+ "getgroups", # Function. Gets the list of supplementary group IDs.
154
+ "getloadavg", # Function. Returns system load averages (os.getloadavg).
155
+ "getlogin", # Function. Gets the name of the logged-in user (os.getlogin).
156
+ "getpgid", # Function. Gets the process group ID for a process.
157
+ "getpgrp", # Function. Gets the process group ID of the current process.
158
+ "getpid", # Function. Gets the current process ID (os.getpid).
159
+ "getppid", # Function. Gets the parent process ID (os.getppid).
160
+ "getpriority", # Function. Gets the scheduling priority of a process.
161
+ "getsid", # Function. Gets the session ID of a process.
162
+ "getuid", # Function. Gets the user ID (os.getuid).
163
+ "initgroups", # Function. Initializes group access list for a user.
164
+ "isatty", # Function. Checks if a file descriptor is a terminal (os.isatty).
165
+ "kill", # Function. Sends a signal to a process (os.kill).
166
+ "killpg", # Function. Sends a signal to a process group.
167
+ "lchflags", # Function. Sets flags on a symbolic link.
168
+ "lchmod", # Function. Changes permissions of a symbolic link.
169
+ "lchown", # Function. Changes ownership of a symbolic link.
170
+ "link", # Function. Creates a hard link (os.link).
171
+ "listdir", # Function. Lists directory contents (os.listdir).
172
+ "lockf", # Function. Applies or removes advisory locks on a file descriptor.
173
+ "login_tty", # Function. Prepares a terminal for login.
174
+ "lseek", # Function. Repositions the file offset for a file descriptor (os.lseek).
175
+ "lstat", # Function. Gets file status for a symbolic link (os.lstat).
176
+ "major", # Function. Extracts the major device number from a device ID.
177
+ "makedev", # Function. Creates a device ID from major and minor numbers.
178
+ "minor", # Function. Extracts the minor device number from a device ID.
179
+ "mkdir", # Function. Creates a directory (os.mkdir).
180
+ "mkfifo", # Function. Creates a FIFO (named pipe) (os.mkfifo).
181
+ "mknod", # Function. Creates a filesystem node (file, device, etc.).
182
+ "nice", # Function. Adjusts process priority.
183
+ "open", # Function. Opens a file descriptor (os.open).
184
+ "openpty", # Function. Opens a pseudo-terminal pair.
185
+ "pathconf", # Function. Gets configuration values for a path (os.pathconf).
186
+ "pipe", # Function. Creates a pipe (os.pipe).
187
+ "posix_spawn", # Function. Spawns a new process.
188
+ "posix_spawnp", # Function. Spawns a new process using PATH.
189
+ "pread", # Function. Reads from a file descriptor at a given offset.
190
+ "preadv", # Function. Reads from a file descriptor into multiple buffers.
191
+ "putenv", # Function. Sets an environment variable.
192
+ "pwrite", # Function. Writes to a file descriptor at a given offset.
193
+ "pwritev", # Function. Writes from multiple buffers to a file descriptor.
194
+ "read", # Function. Reads from a file descriptor (os.read).
195
+ "readlink", # Function. Reads the target of a symbolic link (os.readlink).
196
+ "readv", # Function. Reads into multiple buffers from a file descriptor.
197
+
198
+ #"register_at_fork", # Function. Registers functions to run before/after fork.
199
+
200
+ "remove", # Function. Removes a file (os.remove).
201
+ "rename", # Function. Renames a file or directory (os.rename).
202
+ "replace", # Function. Renames a file, replacing the destination if it exists.
203
+ "rmdir", # Function. Removes a directory (os.rmdir).
204
+ "scandir", # Function. Lists directory entries with metadata (os.scandir).
205
+ "sched_get_priority_max", # Function. Gets maximum scheduling priority.
206
+ "sched_get_priority_min", # Function. Gets minimum scheduling priority.
207
+ "sched_yield", # Function. Yields the processor.
208
+ "sendfile", # Function. Transfers data between file descriptors.
209
+ "set_blocking", # Function. Sets blocking mode for a file descriptor.
210
+ "set_inheritable", # Function. Sets whether a file descriptor is inheritable.
211
+ "setegid", # Function. Sets the effective group ID.
212
+ "seteuid", # Function. Sets the effective user ID.
213
+ "setgid", # Function. Sets the group ID.
214
+ "setgroups", # Function. Sets supplementary group IDs.
215
+ "setpgid", # Function. Sets the process group ID for a process.
216
+ "setpgrp", # Function. Sets the process group ID.
217
+ "setpriority", # Function. Sets the scheduling priority of a process.
218
+ "setregid", # Function. Sets real and effective group IDs.
219
+ "setreuid", # Function. Sets real and effective user IDs.
220
+ "setsid", # Function. Creates a new session.
221
+ "setuid", # Function. Sets the user ID.
222
+ "stat", # Function. Gets file status (os.stat).
223
+ "statvfs", # Function. Gets filesystem information.
224
+ "symlink", # Function. Creates a symbolic link (os.symlink).
225
+ "sync", # Function. Synchronizes all filesystems.
226
+ "sysconf", # Function. Gets system configuration values (os.sysconf).
227
+ "system", # Function. Executes a shell command (os.system).
228
+ "tcgetpgrp", # Function. Gets the process group associated with a terminal.
229
+ "tcsetpgrp", # Function. Sets the process group associated with a terminal.
230
+ "times", # Function. Gets process times (os.times).
231
+ "truncate", # Function. Truncates a file to a specified length (os.truncate).
232
+ "ttyname", # Function. Returns the terminal name for a file descriptor.
233
+ "umask", # Function. Sets or gets the file creation mask (os.umask).
234
+ "uname", # Function. Gets system information (os.uname).
235
+ "unlink", # Function. Removes a file (alias for os.remove).
236
+ "unsetenv", # Function. Removes an environment variable.
237
+ "urandom", # Function. Generates random bytes (os.urandom).
238
+ "utime", # Function. Sets file access/modification times (os.utime).
239
+ "wait", # Function. Waits for a child process to terminate.
240
+ "wait3", # Function. Waits for a child process with options.
241
+ "wait4", # Function. Waits for a specific child process with options.
242
+ "waitpid", # Function. Waits for a specific process ID (os.waitpid).
243
+ "write", # Function. Writes to a file descriptor (os.write).
244
+ "writev", # Function. Writes from multiple buffers to a file descriptor.
245
+ ]
246
+
247
+ [posix.wrap]
248
+ posix_spawn = "retracesoftware.install.edgecases.posix_spawn"
249
+
250
+ [_posixsubprocess]
251
+ proxy = ["fork_exec"]
252
+
253
+ [_posixsubprocess.wrap]
254
+ fork_exec = "retracesoftware.install.edgecases.fork_exec"
255
+
256
+ [fnctl]
257
+ proxy = ["fcntl", "flock", "ioctl", "lockf"]
258
+
259
+ [_signal]
260
+ proxy = [
261
+ "alarm",
262
+ "getitimer",
263
+ "getsignal", "pause", "pthread_kill", "pthread_sigmask", "raise_signal", "set_wakeup_fd",
264
+ "setitimer", "siginterrupt", "signal", "sigpending", "sigwait"]
265
+
266
+ [_socket]
267
+ # ignore = "CAPI"
268
+ immutable = ["error", "herror", "gaierror", "timeout"]
269
+ proxy = ["socket",
270
+ "close",
271
+ "dup",
272
+ "getaddrinfo",
273
+ "getdefaulttimeout",
274
+ "gethostbyaddr",
275
+ "gethostbyname",
276
+ "gethostbyname_ex",
277
+ "gethostname",
278
+ "getnameinfo",
279
+ "getprotobyname",
280
+ "getservbyname",
281
+ "getservbyport",
282
+ "has_ipv6",
283
+ "if_indextoname",
284
+ "if_nameindex",
285
+ "if_nametoindex",
286
+ "setdefaulttimeout",
287
+ "sethostname",
288
+ "socketpair"]
289
+ # default = "try_proxy"
290
+
291
+ [_socket.patch_class.socket]
292
+ recvfrom_into = "retracesoftware.install.edgecases.recvfrom_into"
293
+ recv_into = "retracesoftware.install.edgecases.recv_into"
294
+ recvmsg_into = "retracesoftware.install.edgecases.recvmsg_into"
295
+
296
+ [select]
297
+ proxy = ["kevent", "kqueue", "poll", "epoll", "select"]
298
+
299
+ [_sqlite3]
300
+ proxy = ["Blob", "Connection", "Cursor", "adapt", "connect"]
301
+ default = "try_proxy"
302
+
303
+ [_ssl]
304
+ proxy = ["_SSLSocket", "MemoryBIO", "_SSLContext"]
305
+
306
+ [_ssl.patch_class._SSLSocket]
307
+ read = "retracesoftware.install.edgecases.read"
308
+
309
+ [ssl]
310
+ bind = ["Options"]
311
+
312
+ # "_ssl": {
313
+ # "proxy_all_except": [],
314
+
315
+ # "proxy_functions": ".*",
316
+ # "comment": {
317
+ # "proxy_types": [
318
+ # "MemoryBIO",
319
+ # "_SSLSocket",
320
+ # "_SSLContext"
321
+ # ],
322
+ # "wrap": {
323
+ # "_SSLSocket.write": "write"
324
+ # }
325
+ # },
326
+ # "patchtype": {
327
+ # "_SSLSocket": {
328
+ # "read": "retracesoftware.install.edgecases.read"
329
+ # }
330
+ # }
331
+ # },
332
+
333
+ [_random]
334
+ proxy = ["Random"]
335
+
336
+ # "_random": {
337
+ # "proxy_all_except": [],
338
+ # "proxy_types": [
339
+ # "Random"
340
+ # ],
341
+ # "proxy_functions": ".*"
342
+ # },
343
+
344
+ # "_multiprocessing": {
345
+ # "proxy": ["sem_unlink", "SemLock"]
346
+ # },
347
+
348
+ # ["multiprocessing.context"]
349
+ # proxy = "BaseContext"
350
+
351
+ [_multiprocessing]
352
+ proxy = ["SemLock", "sem_unlink"]
353
+
354
+
355
+ # "multiprocessing.context": {
356
+ # "comment": {
357
+ # "proxy": ["_default_context"]
358
+ # }
359
+ # },
360
+
361
+ # "PIL._imaging": {
362
+ # "map_buffer": "ignore",
363
+ # "*": "proxy_if_function"
364
+ # },
365
+ # "psycopg2._psycopg": {
366
+ # "proxy_all_except": ["Error"]
367
+ # },
368
+
369
+ # "_weakrefset": {
370
+ # "WeakSet": "sync_type",
371
+ # "_IterationGuard": "sync_type"
372
+ # },
373
+ # "_collections": {
374
+ # "sync_types": [
375
+ # "deque"
376
+ # ]
377
+ # },
378
+ # "_queue": {
379
+ # "sync_types": [
380
+ # "SimpleQueue"
381
+ # ]
382
+ # }
383
+ # }
384
+ # }
@@ -0,0 +1,216 @@
1
+ sys
2
+ builtins
3
+ _frozen_importlib
4
+ _imp
5
+ _thread
6
+ _warnings
7
+ _weakref
8
+ _io
9
+ marshal
10
+ posix
11
+ _frozen_importlib_external
12
+ time
13
+ zipimport
14
+ _codecs
15
+ codecs
16
+ encodings.aliases
17
+ encodings
18
+ encodings.utf_8
19
+ _signal
20
+ _abc
21
+ abc
22
+ io
23
+ _stat
24
+ stat
25
+ _collections_abc
26
+ errno
27
+ genericpath
28
+ posixpath
29
+ os.path
30
+ os
31
+ _sitebuiltins
32
+ collections.abc
33
+ itertools
34
+ keyword
35
+ _operator
36
+ operator
37
+ reprlib
38
+ _collections
39
+ collections
40
+ _functools
41
+ functools
42
+ types
43
+ enum
44
+ _sre
45
+ re._constants
46
+ re._parser
47
+ re._casefix
48
+ re._compiler
49
+ copyreg
50
+ re
51
+ sitecustomize
52
+ site
53
+ importlib._bootstrap
54
+ importlib._bootstrap_external
55
+ importlib
56
+ importlib.machinery
57
+ importlib._abc
58
+ importlib.util
59
+ runpy
60
+ __main__
61
+ __future__
62
+ _weakrefset
63
+ weakref
64
+ copy
65
+ _ast
66
+ contextlib
67
+ ast
68
+ _opcode
69
+ _opcode_metadata
70
+ opcode
71
+ dis
72
+ linecache
73
+ token
74
+ _tokenize
75
+ tokenize
76
+ inspect
77
+ dataclasses
78
+ _typing
79
+ typing
80
+ _json
81
+ json.scanner
82
+ json.decoder
83
+ json.encoder
84
+ json
85
+ warnings
86
+ platform
87
+ _struct
88
+ struct
89
+ encodings.ascii
90
+ encodings.latin_1
91
+ unicodedata
92
+ stringprep
93
+ encodings.idna
94
+ threading
95
+ _socket
96
+ math
97
+ select
98
+ selectors
99
+ array
100
+ socket
101
+ textwrap
102
+ _colorize
103
+ traceback
104
+ codeop
105
+ code
106
+ _heapq
107
+ heapq
108
+ _queue
109
+ queue
110
+ xmlrpc
111
+ binascii
112
+ base64
113
+ _datetime
114
+ datetime
115
+ numbers
116
+ _decimal
117
+ decimal
118
+ http
119
+ email
120
+ email.errors
121
+ _string
122
+ string
123
+ email.quoprimime
124
+ email.base64mime
125
+ quopri
126
+ email.encoders
127
+ email.charset
128
+ email.header
129
+ urllib
130
+ ipaddress
131
+ urllib.parse
132
+ email._parseaddr
133
+ email.utils
134
+ email._policybase
135
+ email.feedparser
136
+ email.parser
137
+ email._encoded_words
138
+ email.iterators
139
+ email.message
140
+ _ssl
141
+ ssl
142
+ http.client
143
+ xml
144
+ xml.parsers
145
+ pyexpat.errors
146
+ pyexpat.model
147
+ pyexpat
148
+ xml.parsers.expat.model
149
+ xml.parsers.expat.errors
150
+ xml.parsers.expat
151
+ _compression
152
+ zlib
153
+ gzip
154
+ xmlrpc.client
155
+ html.entities
156
+ html
157
+ mimetypes
158
+ fnmatch
159
+ _bz2
160
+ bz2
161
+ _lzma
162
+ lzma
163
+ shutil
164
+ socketserver
165
+ http.server
166
+ pkgutil
167
+ sysconfig
168
+ _pyrepl
169
+ _pyrepl.pager
170
+ _sysconfigdata__darwin_darwin
171
+ _osx_support
172
+ pydoc
173
+ fcntl
174
+ xmlrpc.server
175
+ atexit
176
+ termios
177
+ getpass
178
+ ntpath
179
+ glob
180
+ signal
181
+ _ctypes
182
+ ctypes._endian
183
+ ctypes
184
+ _compat_pickle
185
+ _pickle
186
+ pickle
187
+ _locale
188
+ locale
189
+ _bisect
190
+ bisect
191
+ pathlib._abc
192
+ pwd
193
+ grp
194
+ pathlib._local
195
+ pathlib
196
+ _posixsubprocess
197
+ subprocess
198
+ plistlib
199
+ zipfile._path.glob
200
+ zipfile._path
201
+ zipfile
202
+ importlib.metadata._meta
203
+ importlib.metadata._collections
204
+ importlib.metadata._functools
205
+ importlib.metadata._itertools
206
+ _random
207
+ random
208
+ tempfile
209
+ importlib.resources.abc
210
+ importlib.resources._common
211
+ importlib.resources._functional
212
+ importlib.resources
213
+ importlib.abc
214
+ importlib.metadata
215
+ importlib.metadata._text
216
+ importlib.metadata._adapters
@@ -1,3 +1,3 @@
1
1
  from retracesoftware.proxy.record import RecordProxySystem
2
2
  from retracesoftware.proxy.replay import ReplayProxySystem
3
- from retracesoftware.proxy.thread import set_thread_id, per_thread_messages
3
+ from retracesoftware.proxy.thread import per_thread_messages
@@ -0,0 +1,31 @@
1
+ import types
2
+ import sys
3
+
4
+ def find_module_name(mod):
5
+ for name,value in sys.modules.items():
6
+ if value is mod:
7
+ return name
8
+
9
+ raise Exception(f"Cannot create GlobalRef as module {mod} not found in sys.modules")
10
+
11
+ class GlobalRef:
12
+ __slots__ = ['parts']
13
+
14
+ def __init__(self, obj):
15
+ if isinstance(obj, types.ModuleType):
16
+ self.parts = (find_module_name(obj),)
17
+ else:
18
+ raise Exception(f"Cannot create GlobalRef from {obj}")
19
+
20
+ def __call__(self):
21
+ module = self.parts[0]
22
+
23
+ if len(self.parts) == 0:
24
+ return module
25
+ else:
26
+ obj = getattr(module, self.parts[1])
27
+
28
+ if len(self.parts) == 1:
29
+ return obj
30
+ else:
31
+ raise Exception(f"TODO")