fishhook 0.3.3__tar.gz → 0.3.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fishhook
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Allows for runtime hooking of static class functions
5
5
  Author-email: chilaxan <chilaxan@gmail.com>
6
6
  License: MIT
@@ -5,7 +5,7 @@ import platform
5
5
  try:
6
6
  import capstone as CS
7
7
  except ModuleNotFoundError as err:
8
- if err.name == 'distutils':
8
+ if 'distutils' in err.name:
9
9
  # capstone depends on distutils and pkg_resources, but in most configs does not need them
10
10
  # 3.12+ has deprecated these modules
11
11
  # we can stub them out and re-attempt the import
@@ -20,7 +20,23 @@ except ModuleNotFoundError as err:
20
20
  sys.modules['pkg_resources'] = stub()
21
21
  import capstone as CS
22
22
 
23
- import keystone as KS
23
+ try:
24
+ import keystone as KS
25
+ except ModuleNotFoundError as err:
26
+ if 'distutils' in err.name:
27
+ # keystone depends on distutils and pkg_resources, but in most configs does not need them
28
+ # 3.12+ has deprecated these modules
29
+ # we can stub them out and re-attempt the import
30
+ class stub:
31
+ def __getattr__(self, attr):
32
+ return self
33
+ def __call__(self, *args):
34
+ return ''
35
+
36
+ sys.modules['distutils'] = stub()
37
+ sys.modules['distutils.sysconfig'] = stub()
38
+ sys.modules['pkg_resources'] = stub()
39
+ import keystone as KS
24
40
 
25
41
  ENDIAN = 'LITTLE' if memoryview(b'\1\0').cast('h')[0]==1 else 'BIG'
26
42
  BIT_SIZE = sys.maxsize.bit_length() + 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fishhook
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Allows for runtime hooking of static class functions
5
5
  Author-email: chilaxan <chilaxan@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fishhook"
3
- version = "0.3.3"
3
+ version = "0.3.5"
4
4
  description = "Allows for runtime hooking of static class functions"
5
5
  authors = [
6
6
  { name = "chilaxan", email = "chilaxan@gmail.com" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes