aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2022-04-24 14:47:58 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2022-04-24 14:52:47 +0300
commit393ce77450fcf7d3d55f04ce79761b10a432fa20 (patch)
treee9faa4b4fa39b3520718f99405cb754f478ad5b1 /mesonbuild/modules
parent660bfa6e7c8dfb7bd8bffdb68c053e1a22945f8a (diff)
downloadmeson-393ce77450fcf7d3d55f04ce79761b10a432fa20.zip
meson-393ce77450fcf7d3d55f04ce79761b10a432fa20.tar.gz
meson-393ce77450fcf7d3d55f04ce79761b10a432fa20.tar.bz2
Remove deprecated python3 module.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/python3.py69
1 files changed, 2 insertions, 67 deletions
diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py
index 1e7463c..2e328ba 100644
--- a/mesonbuild/modules/python3.py
+++ b/mesonbuild/modules/python3.py
@@ -1,4 +1,4 @@
-# Copyright 2016-2017 The Meson development team
+# Copyright 2016-2022 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,72 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import sysconfig
from .. import mesonlib
-from . import ExtensionModule
-from ..interpreterbase import typed_pos_args, noPosargs, noKwargs, permittedKwargs, FeatureDeprecated, FeatureNew
-from ..build import known_shmod_kwargs
-from ..programs import ExternalProgram
-
-
-class Python3Module(ExtensionModule):
- @FeatureNew('python3 module', '0.38.0')
- @FeatureDeprecated('python3 module', '0.48.0')
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.methods.update({
- 'extension_module': self.extension_module,
- 'find_python': self.find_python,
- 'language_version': self.language_version,
- 'sysconfig_path': self.sysconfig_path,
- })
-
- @permittedKwargs(known_shmod_kwargs)
- def extension_module(self, state, args, kwargs):
- if 'name_prefix' in kwargs:
- raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.')
- if 'name_suffix' in kwargs:
- raise mesonlib.MesonException('Name_suffix is set automatically, specifying it is forbidden.')
- host_system = state.host_machine.system
- if host_system == 'darwin':
- # Default suffix is 'dylib' but Python does not use it for extensions.
- suffix = 'so'
- elif host_system == 'windows':
- # On Windows the extension is pyd for some unexplainable reason.
- suffix = 'pyd'
- else:
- suffix = []
- kwargs['name_prefix'] = ''
- kwargs['name_suffix'] = suffix
- return self.interpreter.func_shared_module(None, args, kwargs)
-
- @noPosargs
- @noKwargs
- def find_python(self, state, args, kwargs):
- command = state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, 'python3')
- if command is not None:
- py3 = ExternalProgram.from_entry('python3', command)
- else:
- py3 = ExternalProgram('python3', mesonlib.python_command, silent=True)
- return py3
-
- @noPosargs
- @noKwargs
- def language_version(self, state, args, kwargs):
- return sysconfig.get_python_version()
-
- @noKwargs
- @typed_pos_args('python3.sysconfig_path', str)
- def sysconfig_path(self, state, args, kwargs):
- path_name = args[0]
- valid_names = sysconfig.get_path_names()
- if path_name not in valid_names:
- raise mesonlib.MesonException(f'{path_name} is not a valid path name {valid_names}.')
-
- # Get a relative path without a prefix, e.g. lib/python3.6/site-packages
- return sysconfig.get_path(path_name, vars={'base': '', 'platbase': '', 'installed_base': ''})[1:]
-
-
def initialize(*args, **kwargs):
- return Python3Module(*args, **kwargs)
+ raise mesonlib.MesonException(f'The "python3" module has been removed. Please update your code to use the "python" module instead..')