diff options
-rw-r--r-- | mesonbuild/dependencies/python.py | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 11691e5..1bbcdfe 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -170,11 +170,24 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): SystemDependency.__init__(self, name, environment, kwargs) _PythonDependencyBase.__init__(self, installation, kwargs.get('embed', False)) + # link args if mesonlib.is_windows(): self.find_libpy_windows(environment) else: self.find_libpy(environment) + # compile args + inc_paths = mesonlib.OrderedSet([ + self.variables.get('INCLUDEPY'), + self.paths.get('include'), + self.paths.get('platinclude')]) + + self.compile_args += ['-I' + path for path in inc_paths if path] + + # https://sourceforge.net/p/mingw-w64/mailman/message/30504611/ + if mesonlib.is_windows() and self.get_windows_python_arch() == '64' and self.major_version == 2: + self.compile_args += ['-DMS_WIN64'] + def find_libpy(self, environment: 'Environment') -> None: if self.is_pypy: if self.major_version == 3: @@ -197,13 +210,6 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): self.is_found = largs is not None or not self.link_libpython - inc_paths = mesonlib.OrderedSet([ - self.variables.get('INCLUDEPY'), - self.paths.get('include'), - self.paths.get('platinclude')]) - - self.compile_args += ['-I' + path for path in inc_paths if path] - def get_windows_python_arch(self) -> T.Optional[str]: if self.platform == 'mingw': pycc = self.variables.get('CC') @@ -287,18 +293,6 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): self.is_found = False return self.link_args = largs - # Compile args - inc_paths = mesonlib.OrderedSet([ - self.variables.get('INCLUDEPY'), - self.paths.get('include'), - self.paths.get('platinclude')]) - - self.compile_args += ['-I' + path for path in inc_paths if path] - - # https://sourceforge.net/p/mingw-w64/mailman/message/30504611/ - if pyarch == '64' and self.major_version == 2: - self.compile_args += ['-DMS_WIN64'] - self.is_found = True @staticmethod |