Skip to content

Commit df9920f

Browse files
committed
Revert "Fixed sonarcloud complaints"
This reverts commit f4a827e.
1 parent 0f0a4c6 commit df9920f

2 files changed

Lines changed: 16 additions & 18 deletions

File tree

quantcrypt/internal/compiler.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@ def include_directive(self) -> str:
110110
header_file = self.source_dir / "api.h"
111111
return f'#include "{header_file.as_posix()}"'
112112

113-
def _add_linux_compiler_args(self, extra_flags: list[str]) -> None:
114-
arch = platform.machine().lower()
115-
extra_flags.append("-s")
116-
if arch in const.AMDArches:
117-
for flag in self.required_flags:
118-
extra_flags.append(f"-m{flag.lower()}")
119-
elif arch in const.ARMArches:
120-
march_flag = "-march=armv8.5-a"
121-
for flag in self.required_flags:
122-
march_flag += f"+{flag.lower()}"
123-
extra_flags.append(march_flag)
124-
125113
@property
126114
def compiler_args(self) -> list[str]: # pragma: no cover
127115
opsys = platform.system().lower()
@@ -140,7 +128,17 @@ def compiler_args(self) -> list[str]: # pragma: no cover
140128
extra_flags.append(f"/arch:{flag.upper()}")
141129
return ["/O2", "/MD", "/nologo", *extra_flags]
142130
elif opsys == "linux":
143-
self._add_linux_compiler_args(extra_flags)
131+
extra_flags.append("-s")
132+
if arch in const.AMDArches:
133+
for flag in self.required_flags:
134+
extra_flags.append(f"-m{flag.lower()}")
135+
elif arch in const.ARMArches:
136+
march_flag = "-march=armv8.5-a"
137+
for flag in self.required_flags:
138+
march_flag += f"+{flag.lower()}"
139+
extra_flags.append(march_flag)
140+
elif opsys == "darwin":
141+
pass
144142

145143
unix_flags.extend(extra_flags)
146144
return unix_flags

quantcrypt/internal/pqclean.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,9 @@ def read_algo_metadata(spec: const.AlgoSpec) -> PQAMetaData:
152152
return PQAMetaData(**data)
153153

154154

155-
def check_opsys_support(spf: PQASupportedPlatform, variant: const.PQAVariant) -> str | None:
155+
def check_opsys_support(spf: PQASupportedPlatform) -> str | None:
156156
for opsys in spf.operating_systems:
157157
if platform.system().lower() == opsys.lower():
158-
for x, y in const.ExcludedCombinations:
159-
if x == opsys and y == variant: # pragma: no cover
160-
return None
161158
return opsys.lower()
162159
return None
163160

@@ -187,9 +184,12 @@ def check_platform_support(
187184
if not spf:
188185
return None, None
189186
if spf.operating_systems:
190-
opsys = check_opsys_support(spf, variant)
187+
opsys = check_opsys_support(spf)
191188
if not opsys:
192189
return None, None
190+
for x, y in const.ExcludedCombinations:
191+
if x == opsys and y == variant: # pragma: no cover
192+
return None, None
193193
if spf.required_flags: # pragma: no branch
194194
required_flags = spf.required_flags
195195

0 commit comments

Comments
 (0)