Skip to content

Commit d61262b

Browse files
authored
Always enable the dotnet module. (#222)
When building prior to this commit the dotnet module would be disabled unless you explicitly asked for it. This is the opposite of what the default is in libyara. Fix it by always building the dotnet module. Tested with: ``` wxs@mbp yara-python % PYTHONPATH=build/lib.macosx-10.9-universal2-3.9 python3 -c 'import yara; print(yara.modules)' ['tests', 'pe', 'elf', 'math', 'time', 'console', 'string', 'dotnet', 'hash'] wxs@mbp yara-python % ``` Without this change the dotnet module would not be in the list.
1 parent 3a6a633 commit d61262b

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

setup.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
('dynamic-linking', None, 'link dynamically against libyara'),
3535
('enable-cuckoo', None, 'enable "cuckoo" module'),
3636
('enable-magic', None, 'enable "magic" module'),
37-
('enable-dotnet', None, 'enable "dotnet" module'),
3837
('enable-dex', None, 'enable "dex" module'),
3938
('enable-macho', None, 'enable "macho" module'),
4039
('enable-profiling', None, 'enable profiling features')]
@@ -44,7 +43,6 @@
4443
'dynamic-linking',
4544
'enable-cuckoo',
4645
'enable-magic',
47-
'enable-dotnet',
4846
'enable-dex',
4947
'enable-macho',
5048
'enable-profiling']
@@ -119,7 +117,6 @@ def initialize_options(self):
119117
self.dynamic_linking = None
120118
self.enable_magic = None
121119
self.enable_cuckoo = None
122-
self.enable_dotnet = None
123120
self.enable_dex = None
124121
self.enable_macho = None
125122
self.enable_profiling = None
@@ -141,7 +138,6 @@ def initialize_options(self):
141138
self.dynamic_linking = None
142139
self.enable_magic = None
143140
self.enable_cuckoo = None
144-
self.enable_dotnet = None
145141
self.enable_dex = None
146142
self.enable_macho = None
147143
self.enable_profiling = None
@@ -157,7 +153,6 @@ def finalize_options(self):
157153
('dynamic_linking', 'dynamic_linking'),
158154
('enable_magic', 'enable_magic'),
159155
('enable_cuckoo', 'enable_cuckoo'),
160-
('enable_dotnet', 'enable_dotnet'),
161156
('enable_dex', 'enable_dex'),
162157
('enable_macho', 'enable_macho'),
163158
('enable_profiling', 'enable_profiling'))
@@ -168,9 +163,6 @@ def finalize_options(self):
168163
if self.enable_cuckoo and self.dynamic_linking:
169164
raise distutils.errors.DistutilsOptionError(
170165
'--enable-cuckoo can''t be used with --dynamic-linking')
171-
if self.enable_dotnet and self.dynamic_linking:
172-
raise distutils.errors.DistutilsOptionError(
173-
'--enable-dotnet can''t be used with --dynamic-linking')
174166
if self.enable_dex and self.dynamic_linking:
175167
raise distutils.errors.DistutilsOptionError(
176168
'--enable-dex can''t be used with --dynamic-linking')
@@ -314,11 +306,6 @@ def run(self):
314306
else:
315307
exclusions.append('yara/libyara/modules/cuckoo/cuckoo.c')
316308

317-
if self.enable_dotnet:
318-
module.define_macros.append(('DOTNET_MODULE', '1'))
319-
else:
320-
exclusions.append('yara/libyara/modules/dotnet/dotnet.c')
321-
322309
if self.enable_dex:
323310
module.define_macros.append(('DEX_MODULE', '1'))
324311
else:
@@ -333,6 +320,9 @@ def run(self):
333320
exclusions.append('yara/libyara/modules/pb_tests/pb_tests.c')
334321
exclusions.append('yara/libyara/modules/pb_tests/pb_tests.pb-c.c')
335322

323+
# Always turn on the DOTNET module.
324+
module.define_macros.append(('DOTNET_MODULE', '1'))
325+
336326
exclusions = [os.path.normpath(x) for x in exclusions]
337327

338328
for directory, _, files in os.walk('yara/libyara/'):

0 commit comments

Comments
 (0)