aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-13 22:56:48 -0500
committerDylan Baker <dylan@pnwbakers.com>2023-02-22 10:32:09 -0800
commit9bf718fcee0d9e30b5de2d6a2f154aa417aa8d4c (patch)
tree2ee4d2df8a80eb50c80d0f87b1c85457a222fa5a
parentaa69cf04484309f82d2da64c433539d2f6f2fa82 (diff)
downloadmeson-9bf718fcee0d9e30b5de2d6a2f154aa417aa8d4c.zip
meson-9bf718fcee0d9e30b5de2d6a2f154aa417aa8d4c.tar.gz
meson-9bf718fcee0d9e30b5de2d6a2f154aa417aa8d4c.tar.bz2
python dependency: simplify compile args handling
We can set it once instead of tangling it inside the guts of the overly specialized library lookups. It is mostly identical anyway.
-rw-r--r--mesonbuild/dependencies/python.py32
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