frida 16.2.1 → 16.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BSDmakefile +6 -0
- package/Makefile +16 -0
- package/README.md +14 -11
- package/configure +18 -0
- package/configure.bat +22 -0
- package/dist/native.js +0 -8
- package/lib/application.ts +98 -0
- package/lib/authentication.ts +3 -0
- package/lib/build.py +50 -0
- package/lib/bus.ts +30 -0
- package/lib/cancellable.ts +33 -0
- package/lib/child.ts +15 -0
- package/lib/crash.ts +11 -0
- package/lib/device.ts +329 -0
- package/lib/device_manager.ts +69 -0
- package/lib/endpoint_parameters.ts +56 -0
- package/lib/icon.ts +15 -0
- package/lib/index.ts +311 -0
- package/lib/iostream.ts +78 -0
- package/lib/meson.build +53 -0
- package/lib/native.ts +9 -0
- package/lib/portal_membership.ts +10 -0
- package/lib/portal_service.ts +105 -0
- package/lib/process.ts +57 -0
- package/lib/relay.ts +44 -0
- package/lib/script.ts +352 -0
- package/lib/session.ts +113 -0
- package/lib/signals.ts +45 -0
- package/lib/socket_address.ts +35 -0
- package/lib/spawn.ts +4 -0
- package/lib/system_parameters.ts +78 -0
- package/make.bat +23 -0
- package/meson.build +160 -0
- package/meson.options +11 -0
- package/package.json +27 -6
- package/releng/deps.py +1133 -0
- package/releng/deps.toml +391 -0
- package/releng/devkit-assets/frida-core-example-unix.c +188 -0
- package/releng/devkit-assets/frida-core-example-windows.c +197 -0
- package/releng/devkit-assets/frida-core-example.sln +28 -0
- package/releng/devkit-assets/frida-core-example.vcxproj +157 -0
- package/releng/devkit-assets/frida-core-example.vcxproj.filters +27 -0
- package/releng/devkit-assets/frida-gum-example-unix.c +122 -0
- package/releng/devkit-assets/frida-gum-example-windows.c +132 -0
- package/releng/devkit-assets/frida-gum-example.sln +28 -0
- package/releng/devkit-assets/frida-gum-example.vcxproj +157 -0
- package/releng/devkit-assets/frida-gum-example.vcxproj.filters +27 -0
- package/releng/devkit-assets/frida-gumjs-example-unix.c +84 -0
- package/releng/devkit-assets/frida-gumjs-example-windows.c +91 -0
- package/releng/devkit-assets/frida-gumjs-example.sln +28 -0
- package/releng/devkit-assets/frida-gumjs-example.vcxproj +157 -0
- package/releng/devkit-assets/frida-gumjs-example.vcxproj.filters +27 -0
- package/releng/devkit.py +535 -0
- package/releng/env.py +420 -0
- package/releng/env_android.py +150 -0
- package/releng/env_apple.py +176 -0
- package/releng/env_generic.py +373 -0
- package/releng/frida_version.py +69 -0
- package/releng/machine_file.py +44 -0
- package/releng/machine_spec.py +290 -0
- package/releng/meson/meson.py +27 -0
- package/releng/meson/mesonbuild/__init__.py +0 -0
- package/releng/meson/mesonbuild/_pathlib.py +63 -0
- package/releng/meson/mesonbuild/_typing.py +69 -0
- package/releng/meson/mesonbuild/arglist.py +321 -0
- package/releng/meson/mesonbuild/ast/__init__.py +23 -0
- package/releng/meson/mesonbuild/ast/interpreter.py +441 -0
- package/releng/meson/mesonbuild/ast/introspection.py +374 -0
- package/releng/meson/mesonbuild/ast/postprocess.py +109 -0
- package/releng/meson/mesonbuild/ast/printer.py +620 -0
- package/releng/meson/mesonbuild/ast/visitor.py +161 -0
- package/releng/meson/mesonbuild/backend/__init__.py +0 -0
- package/releng/meson/mesonbuild/backend/backends.py +2047 -0
- package/releng/meson/mesonbuild/backend/ninjabackend.py +3808 -0
- package/releng/meson/mesonbuild/backend/nonebackend.py +26 -0
- package/releng/meson/mesonbuild/backend/vs2010backend.py +2078 -0
- package/releng/meson/mesonbuild/backend/vs2012backend.py +35 -0
- package/releng/meson/mesonbuild/backend/vs2013backend.py +34 -0
- package/releng/meson/mesonbuild/backend/vs2015backend.py +35 -0
- package/releng/meson/mesonbuild/backend/vs2017backend.py +59 -0
- package/releng/meson/mesonbuild/backend/vs2019backend.py +54 -0
- package/releng/meson/mesonbuild/backend/vs2022backend.py +54 -0
- package/releng/meson/mesonbuild/backend/xcodebackend.py +1781 -0
- package/releng/meson/mesonbuild/build.py +3249 -0
- package/releng/meson/mesonbuild/cargo/__init__.py +5 -0
- package/releng/meson/mesonbuild/cargo/builder.py +238 -0
- package/releng/meson/mesonbuild/cargo/cfg.py +274 -0
- package/releng/meson/mesonbuild/cargo/interpreter.py +733 -0
- package/releng/meson/mesonbuild/cargo/manifest.py +227 -0
- package/releng/meson/mesonbuild/cargo/version.py +95 -0
- package/releng/meson/mesonbuild/cmake/__init__.py +28 -0
- package/releng/meson/mesonbuild/cmake/common.py +331 -0
- package/releng/meson/mesonbuild/cmake/data/__init__.py +0 -0
- package/releng/meson/mesonbuild/cmake/data/preload.cmake +82 -0
- package/releng/meson/mesonbuild/cmake/executor.py +241 -0
- package/releng/meson/mesonbuild/cmake/fileapi.py +324 -0
- package/releng/meson/mesonbuild/cmake/generator.py +186 -0
- package/releng/meson/mesonbuild/cmake/interpreter.py +1267 -0
- package/releng/meson/mesonbuild/cmake/toolchain.py +248 -0
- package/releng/meson/mesonbuild/cmake/traceparser.py +814 -0
- package/releng/meson/mesonbuild/cmake/tracetargets.py +161 -0
- package/releng/meson/mesonbuild/compilers/__init__.py +86 -0
- package/releng/meson/mesonbuild/compilers/asm.py +307 -0
- package/releng/meson/mesonbuild/compilers/c.py +788 -0
- package/releng/meson/mesonbuild/compilers/c_function_attributes.py +143 -0
- package/releng/meson/mesonbuild/compilers/compilers.py +1388 -0
- package/releng/meson/mesonbuild/compilers/cpp.py +1035 -0
- package/releng/meson/mesonbuild/compilers/cs.py +136 -0
- package/releng/meson/mesonbuild/compilers/cuda.py +806 -0
- package/releng/meson/mesonbuild/compilers/cython.py +91 -0
- package/releng/meson/mesonbuild/compilers/d.py +861 -0
- package/releng/meson/mesonbuild/compilers/detect.py +1396 -0
- package/releng/meson/mesonbuild/compilers/fortran.py +523 -0
- package/releng/meson/mesonbuild/compilers/java.py +113 -0
- package/releng/meson/mesonbuild/compilers/mixins/__init__.py +0 -0
- package/releng/meson/mesonbuild/compilers/mixins/arm.py +167 -0
- package/releng/meson/mesonbuild/compilers/mixins/ccrx.py +113 -0
- package/releng/meson/mesonbuild/compilers/mixins/clang.py +170 -0
- package/releng/meson/mesonbuild/compilers/mixins/clike.py +1330 -0
- package/releng/meson/mesonbuild/compilers/mixins/compcert.py +117 -0
- package/releng/meson/mesonbuild/compilers/mixins/elbrus.py +93 -0
- package/releng/meson/mesonbuild/compilers/mixins/emscripten.py +89 -0
- package/releng/meson/mesonbuild/compilers/mixins/gnu.py +629 -0
- package/releng/meson/mesonbuild/compilers/mixins/intel.py +167 -0
- package/releng/meson/mesonbuild/compilers/mixins/islinker.py +120 -0
- package/releng/meson/mesonbuild/compilers/mixins/metrowerks.py +279 -0
- package/releng/meson/mesonbuild/compilers/mixins/pgi.py +88 -0
- package/releng/meson/mesonbuild/compilers/mixins/ti.py +130 -0
- package/releng/meson/mesonbuild/compilers/mixins/visualstudio.py +458 -0
- package/releng/meson/mesonbuild/compilers/mixins/xc16.py +111 -0
- package/releng/meson/mesonbuild/compilers/objc.py +120 -0
- package/releng/meson/mesonbuild/compilers/objcpp.py +102 -0
- package/releng/meson/mesonbuild/compilers/rust.py +230 -0
- package/releng/meson/mesonbuild/compilers/swift.py +131 -0
- package/releng/meson/mesonbuild/compilers/vala.py +121 -0
- package/releng/meson/mesonbuild/coredata.py +1532 -0
- package/releng/meson/mesonbuild/dependencies/__init__.py +252 -0
- package/releng/meson/mesonbuild/dependencies/base.py +663 -0
- package/releng/meson/mesonbuild/dependencies/boost.py +1083 -0
- package/releng/meson/mesonbuild/dependencies/cmake.py +656 -0
- package/releng/meson/mesonbuild/dependencies/coarrays.py +80 -0
- package/releng/meson/mesonbuild/dependencies/configtool.py +163 -0
- package/releng/meson/mesonbuild/dependencies/cuda.py +295 -0
- package/releng/meson/mesonbuild/dependencies/data/CMakeLists.txt +102 -0
- package/releng/meson/mesonbuild/dependencies/data/CMakeListsLLVM.txt +204 -0
- package/releng/meson/mesonbuild/dependencies/data/CMakePathInfo.txt +31 -0
- package/releng/meson/mesonbuild/dependencies/data/__init__.py +0 -0
- package/releng/meson/mesonbuild/dependencies/detect.py +225 -0
- package/releng/meson/mesonbuild/dependencies/dev.py +707 -0
- package/releng/meson/mesonbuild/dependencies/dub.py +424 -0
- package/releng/meson/mesonbuild/dependencies/factory.py +146 -0
- package/releng/meson/mesonbuild/dependencies/framework.py +111 -0
- package/releng/meson/mesonbuild/dependencies/hdf5.py +168 -0
- package/releng/meson/mesonbuild/dependencies/misc.py +618 -0
- package/releng/meson/mesonbuild/dependencies/mpi.py +231 -0
- package/releng/meson/mesonbuild/dependencies/pkgconfig.py +570 -0
- package/releng/meson/mesonbuild/dependencies/platform.py +52 -0
- package/releng/meson/mesonbuild/dependencies/python.py +431 -0
- package/releng/meson/mesonbuild/dependencies/qt.py +484 -0
- package/releng/meson/mesonbuild/dependencies/scalapack.py +142 -0
- package/releng/meson/mesonbuild/dependencies/ui.py +281 -0
- package/releng/meson/mesonbuild/depfile.py +82 -0
- package/releng/meson/mesonbuild/envconfig.py +480 -0
- package/releng/meson/mesonbuild/environment.py +987 -0
- package/releng/meson/mesonbuild/interpreter/__init__.py +47 -0
- package/releng/meson/mesonbuild/interpreter/compiler.py +900 -0
- package/releng/meson/mesonbuild/interpreter/dependencyfallbacks.py +386 -0
- package/releng/meson/mesonbuild/interpreter/interpreter.py +3595 -0
- package/releng/meson/mesonbuild/interpreter/interpreterobjects.py +1096 -0
- package/releng/meson/mesonbuild/interpreter/kwargs.py +479 -0
- package/releng/meson/mesonbuild/interpreter/mesonmain.py +487 -0
- package/releng/meson/mesonbuild/interpreter/primitives/__init__.py +29 -0
- package/releng/meson/mesonbuild/interpreter/primitives/array.py +108 -0
- package/releng/meson/mesonbuild/interpreter/primitives/boolean.py +52 -0
- package/releng/meson/mesonbuild/interpreter/primitives/dict.py +88 -0
- package/releng/meson/mesonbuild/interpreter/primitives/integer.py +86 -0
- package/releng/meson/mesonbuild/interpreter/primitives/range.py +38 -0
- package/releng/meson/mesonbuild/interpreter/primitives/string.py +247 -0
- package/releng/meson/mesonbuild/interpreter/type_checking.py +853 -0
- package/releng/meson/mesonbuild/interpreterbase/__init__.py +126 -0
- package/releng/meson/mesonbuild/interpreterbase/_unholder.py +25 -0
- package/releng/meson/mesonbuild/interpreterbase/baseobjects.py +174 -0
- package/releng/meson/mesonbuild/interpreterbase/decorators.py +806 -0
- package/releng/meson/mesonbuild/interpreterbase/disabler.py +35 -0
- package/releng/meson/mesonbuild/interpreterbase/exceptions.py +22 -0
- package/releng/meson/mesonbuild/interpreterbase/helpers.py +67 -0
- package/releng/meson/mesonbuild/interpreterbase/interpreterbase.py +665 -0
- package/releng/meson/mesonbuild/interpreterbase/operator.py +32 -0
- package/releng/meson/mesonbuild/linkers/__init__.py +20 -0
- package/releng/meson/mesonbuild/linkers/base.py +39 -0
- package/releng/meson/mesonbuild/linkers/detect.py +229 -0
- package/releng/meson/mesonbuild/linkers/linkers.py +1614 -0
- package/releng/meson/mesonbuild/mcompile.py +380 -0
- package/releng/meson/mesonbuild/mconf.py +368 -0
- package/releng/meson/mesonbuild/mdevenv.py +234 -0
- package/releng/meson/mesonbuild/mdist.py +376 -0
- package/releng/meson/mesonbuild/mesondata.py +38 -0
- package/releng/meson/mesonbuild/mesonlib.py +23 -0
- package/releng/meson/mesonbuild/mesonmain.py +289 -0
- package/releng/meson/mesonbuild/minit.py +204 -0
- package/releng/meson/mesonbuild/minstall.py +864 -0
- package/releng/meson/mesonbuild/mintro.py +667 -0
- package/releng/meson/mesonbuild/mlog.py +542 -0
- package/releng/meson/mesonbuild/modules/__init__.py +270 -0
- package/releng/meson/mesonbuild/modules/cmake.py +442 -0
- package/releng/meson/mesonbuild/modules/cuda.py +377 -0
- package/releng/meson/mesonbuild/modules/dlang.py +117 -0
- package/releng/meson/mesonbuild/modules/external_project.py +306 -0
- package/releng/meson/mesonbuild/modules/fs.py +323 -0
- package/releng/meson/mesonbuild/modules/gnome.py +2215 -0
- package/releng/meson/mesonbuild/modules/hotdoc.py +487 -0
- package/releng/meson/mesonbuild/modules/i18n.py +405 -0
- package/releng/meson/mesonbuild/modules/icestorm.py +123 -0
- package/releng/meson/mesonbuild/modules/java.py +112 -0
- package/releng/meson/mesonbuild/modules/keyval.py +65 -0
- package/releng/meson/mesonbuild/modules/modtest.py +33 -0
- package/releng/meson/mesonbuild/modules/pkgconfig.py +744 -0
- package/releng/meson/mesonbuild/modules/python.py +556 -0
- package/releng/meson/mesonbuild/modules/python3.py +85 -0
- package/releng/meson/mesonbuild/modules/qt.py +621 -0
- package/releng/meson/mesonbuild/modules/qt4.py +23 -0
- package/releng/meson/mesonbuild/modules/qt5.py +23 -0
- package/releng/meson/mesonbuild/modules/qt6.py +22 -0
- package/releng/meson/mesonbuild/modules/rust.py +355 -0
- package/releng/meson/mesonbuild/modules/simd.py +114 -0
- package/releng/meson/mesonbuild/modules/sourceset.py +291 -0
- package/releng/meson/mesonbuild/modules/wayland.py +151 -0
- package/releng/meson/mesonbuild/modules/windows.py +207 -0
- package/releng/meson/mesonbuild/mparser.py +1114 -0
- package/releng/meson/mesonbuild/msetup.py +365 -0
- package/releng/meson/mesonbuild/msubprojects.py +764 -0
- package/releng/meson/mesonbuild/mtest.py +2201 -0
- package/releng/meson/mesonbuild/munstable_coredata.py +107 -0
- package/releng/meson/mesonbuild/optinterpreter.py +276 -0
- package/releng/meson/mesonbuild/programs.py +367 -0
- package/releng/meson/mesonbuild/rewriter.py +1075 -0
- package/releng/meson/mesonbuild/scripts/__init__.py +10 -0
- package/releng/meson/mesonbuild/scripts/clangformat.py +55 -0
- package/releng/meson/mesonbuild/scripts/clangtidy.py +30 -0
- package/releng/meson/mesonbuild/scripts/cleantrees.py +35 -0
- package/releng/meson/mesonbuild/scripts/cmake_run_ctgt.py +103 -0
- package/releng/meson/mesonbuild/scripts/cmd_or_ps.ps1 +17 -0
- package/releng/meson/mesonbuild/scripts/copy.py +19 -0
- package/releng/meson/mesonbuild/scripts/coverage.py +214 -0
- package/releng/meson/mesonbuild/scripts/delwithsuffix.py +27 -0
- package/releng/meson/mesonbuild/scripts/depfixer.py +495 -0
- package/releng/meson/mesonbuild/scripts/depscan.py +198 -0
- package/releng/meson/mesonbuild/scripts/dirchanger.py +20 -0
- package/releng/meson/mesonbuild/scripts/env2mfile.py +402 -0
- package/releng/meson/mesonbuild/scripts/externalproject.py +106 -0
- package/releng/meson/mesonbuild/scripts/gettext.py +86 -0
- package/releng/meson/mesonbuild/scripts/gtkdochelper.py +286 -0
- package/releng/meson/mesonbuild/scripts/hotdochelper.py +40 -0
- package/releng/meson/mesonbuild/scripts/itstool.py +77 -0
- package/releng/meson/mesonbuild/scripts/meson_exe.py +115 -0
- package/releng/meson/mesonbuild/scripts/msgfmthelper.py +29 -0
- package/releng/meson/mesonbuild/scripts/pycompile.py +54 -0
- package/releng/meson/mesonbuild/scripts/python_info.py +121 -0
- package/releng/meson/mesonbuild/scripts/regen_checker.py +55 -0
- package/releng/meson/mesonbuild/scripts/run_tool.py +58 -0
- package/releng/meson/mesonbuild/scripts/scanbuild.py +57 -0
- package/releng/meson/mesonbuild/scripts/symbolextractor.py +322 -0
- package/releng/meson/mesonbuild/scripts/tags.py +44 -0
- package/releng/meson/mesonbuild/scripts/test_loaded_modules.py +14 -0
- package/releng/meson/mesonbuild/scripts/uninstall.py +41 -0
- package/releng/meson/mesonbuild/scripts/vcstagger.py +35 -0
- package/releng/meson/mesonbuild/scripts/yasm.py +24 -0
- package/releng/meson/mesonbuild/templates/__init__.py +0 -0
- package/releng/meson/mesonbuild/templates/cpptemplates.py +143 -0
- package/releng/meson/mesonbuild/templates/cstemplates.py +90 -0
- package/releng/meson/mesonbuild/templates/ctemplates.py +126 -0
- package/releng/meson/mesonbuild/templates/cudatemplates.py +143 -0
- package/releng/meson/mesonbuild/templates/dlangtemplates.py +109 -0
- package/releng/meson/mesonbuild/templates/fortrantemplates.py +101 -0
- package/releng/meson/mesonbuild/templates/javatemplates.py +94 -0
- package/releng/meson/mesonbuild/templates/mesontemplates.py +70 -0
- package/releng/meson/mesonbuild/templates/objcpptemplates.py +126 -0
- package/releng/meson/mesonbuild/templates/objctemplates.py +126 -0
- package/releng/meson/mesonbuild/templates/rusttemplates.py +79 -0
- package/releng/meson/mesonbuild/templates/samplefactory.py +41 -0
- package/releng/meson/mesonbuild/templates/sampleimpl.py +160 -0
- package/releng/meson/mesonbuild/templates/valatemplates.py +82 -0
- package/releng/meson/mesonbuild/utils/__init__.py +0 -0
- package/releng/meson/mesonbuild/utils/core.py +166 -0
- package/releng/meson/mesonbuild/utils/platform.py +27 -0
- package/releng/meson/mesonbuild/utils/posix.py +32 -0
- package/releng/meson/mesonbuild/utils/universal.py +2445 -0
- package/releng/meson/mesonbuild/utils/vsenv.py +126 -0
- package/releng/meson/mesonbuild/utils/win32.py +29 -0
- package/releng/meson/mesonbuild/wrap/__init__.py +59 -0
- package/releng/meson/mesonbuild/wrap/wrap.py +846 -0
- package/releng/meson/mesonbuild/wrap/wraptool.py +198 -0
- package/releng/meson-scripts/BSDmakefile +6 -0
- package/releng/meson-scripts/Makefile +16 -0
- package/releng/meson-scripts/configure +18 -0
- package/releng/meson-scripts/configure.bat +22 -0
- package/releng/meson-scripts/make.bat +23 -0
- package/releng/meson_configure.py +506 -0
- package/releng/meson_make.py +131 -0
- package/releng/mkdevkit.py +107 -0
- package/releng/mkfatmacho.py +54 -0
- package/releng/post-process-oabi.py +97 -0
- package/releng/progress.py +14 -0
- package/releng/sync-from-upstream.py +185 -0
- package/releng/tomlkit/tomlkit/__init__.py +59 -0
- package/releng/tomlkit/tomlkit/_compat.py +22 -0
- package/releng/tomlkit/tomlkit/_types.py +83 -0
- package/releng/tomlkit/tomlkit/_utils.py +158 -0
- package/releng/tomlkit/tomlkit/api.py +308 -0
- package/releng/tomlkit/tomlkit/container.py +875 -0
- package/releng/tomlkit/tomlkit/exceptions.py +227 -0
- package/releng/tomlkit/tomlkit/items.py +1967 -0
- package/releng/tomlkit/tomlkit/parser.py +1141 -0
- package/releng/tomlkit/tomlkit/py.typed +0 -0
- package/releng/tomlkit/tomlkit/source.py +180 -0
- package/releng/tomlkit/tomlkit/toml_char.py +52 -0
- package/releng/tomlkit/tomlkit/toml_document.py +7 -0
- package/releng/tomlkit/tomlkit/toml_file.py +58 -0
- package/releng/winenv.py +140 -0
- package/scripts/adjust-version.py +19 -0
- package/scripts/detect-version.py +40 -0
- package/scripts/fetch-abi-bits.py +343 -0
- package/scripts/install.js +23 -0
- package/scripts/package.py +15 -0
- package/src/addon.cc +76 -0
- package/src/application.cc +148 -0
- package/src/application.h +31 -0
- package/src/authentication.cc +174 -0
- package/src/authentication.h +24 -0
- package/src/bus.cc +167 -0
- package/src/bus.h +33 -0
- package/src/cancellable.cc +117 -0
- package/src/cancellable.h +31 -0
- package/src/child.cc +150 -0
- package/src/child.h +32 -0
- package/src/crash.cc +122 -0
- package/src/crash.h +30 -0
- package/src/device.cc +1302 -0
- package/src/device.h +55 -0
- package/src/device_manager.cc +362 -0
- package/src/device_manager.h +35 -0
- package/src/endpoint_parameters.cc +171 -0
- package/src/endpoint_parameters.h +28 -0
- package/src/glib_context.cc +62 -0
- package/src/glib_context.h +29 -0
- package/src/glib_object.cc +25 -0
- package/src/glib_object.h +37 -0
- package/src/iostream.cc +247 -0
- package/src/iostream.h +30 -0
- package/src/meson.build +26 -0
- package/src/operation.h +94 -0
- package/src/portal_membership.cc +100 -0
- package/src/portal_membership.h +26 -0
- package/src/portal_service.cc +401 -0
- package/src/portal_service.h +40 -0
- package/src/process.cc +135 -0
- package/src/process.h +30 -0
- package/src/relay.cc +139 -0
- package/src/relay.h +31 -0
- package/src/runtime.cc +443 -0
- package/src/runtime.h +64 -0
- package/src/script.cc +301 -0
- package/src/script.h +36 -0
- package/src/session.cc +860 -0
- package/src/session.h +42 -0
- package/src/signals.cc +334 -0
- package/src/signals.h +47 -0
- package/src/spawn.cc +95 -0
- package/src/spawn.h +27 -0
- package/src/usage_monitor.h +117 -0
- package/src/uv_context.cc +118 -0
- package/src/uv_context.h +40 -0
- package/src/win_delay_load_hook.cc +63 -0
- package/subprojects/frida-core.wrap +8 -0
- package/subprojects/nan.wrap +9 -0
- package/subprojects/packagefiles/nan.patch +13 -0
- package/test/data/index.ts +13 -0
- package/test/data/unixvictim-linux-x86 +0 -0
- package/test/data/unixvictim-linux-x86_64 +0 -0
- package/test/data/unixvictim-macos +0 -0
- package/test/device.ts +27 -0
- package/test/device_manager.ts +16 -0
- package/test/labrat.ts +32 -0
- package/test/script.ts +176 -0
- package/test/session.ts +73 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# Copyright 2013-2021 The Meson development team
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from .. import mesonlib, mlog
|
|
7
|
+
from .disabler import Disabler
|
|
8
|
+
from .exceptions import InterpreterException, InvalidArguments
|
|
9
|
+
from ._unholder import _unholder
|
|
10
|
+
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from functools import wraps
|
|
13
|
+
import abc
|
|
14
|
+
import itertools
|
|
15
|
+
import copy
|
|
16
|
+
import typing as T
|
|
17
|
+
|
|
18
|
+
if T.TYPE_CHECKING:
|
|
19
|
+
from typing_extensions import Protocol
|
|
20
|
+
|
|
21
|
+
from .. import mparser
|
|
22
|
+
from .baseobjects import InterpreterObject, SubProject, TV_func, TYPE_var, TYPE_kwargs
|
|
23
|
+
from .operator import MesonOperator
|
|
24
|
+
|
|
25
|
+
_TV_IntegerObject = T.TypeVar('_TV_IntegerObject', bound=InterpreterObject, contravariant=True)
|
|
26
|
+
_TV_ARG1 = T.TypeVar('_TV_ARG1', bound=TYPE_var, contravariant=True)
|
|
27
|
+
|
|
28
|
+
class FN_Operator(Protocol[_TV_IntegerObject, _TV_ARG1]):
|
|
29
|
+
def __call__(s, self: _TV_IntegerObject, other: _TV_ARG1) -> TYPE_var: ...
|
|
30
|
+
_TV_FN_Operator = T.TypeVar('_TV_FN_Operator', bound=FN_Operator)
|
|
31
|
+
|
|
32
|
+
def get_callee_args(wrapped_args: T.Sequence[T.Any]) -> T.Tuple['mparser.BaseNode', T.List['TYPE_var'], 'TYPE_kwargs', 'SubProject']:
|
|
33
|
+
# First argument could be InterpreterBase, InterpreterObject or ModuleObject.
|
|
34
|
+
# In the case of a ModuleObject it is the 2nd argument (ModuleState) that
|
|
35
|
+
# contains the needed information.
|
|
36
|
+
s = wrapped_args[0]
|
|
37
|
+
if not hasattr(s, 'current_node'):
|
|
38
|
+
s = wrapped_args[1]
|
|
39
|
+
node = s.current_node
|
|
40
|
+
subproject = s.subproject
|
|
41
|
+
args = kwargs = None
|
|
42
|
+
if len(wrapped_args) >= 3:
|
|
43
|
+
args = wrapped_args[-2]
|
|
44
|
+
kwargs = wrapped_args[-1]
|
|
45
|
+
return node, args, kwargs, subproject
|
|
46
|
+
|
|
47
|
+
def noPosargs(f: TV_func) -> TV_func:
|
|
48
|
+
@wraps(f)
|
|
49
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
50
|
+
args = get_callee_args(wrapped_args)[1]
|
|
51
|
+
if args:
|
|
52
|
+
raise InvalidArguments('Function does not take positional arguments.')
|
|
53
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
54
|
+
return T.cast('TV_func', wrapped)
|
|
55
|
+
|
|
56
|
+
def noKwargs(f: TV_func) -> TV_func:
|
|
57
|
+
@wraps(f)
|
|
58
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
59
|
+
kwargs = get_callee_args(wrapped_args)[2]
|
|
60
|
+
if kwargs:
|
|
61
|
+
raise InvalidArguments('Function does not take keyword arguments.')
|
|
62
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
63
|
+
return T.cast('TV_func', wrapped)
|
|
64
|
+
|
|
65
|
+
def stringArgs(f: TV_func) -> TV_func:
|
|
66
|
+
@wraps(f)
|
|
67
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
68
|
+
args = get_callee_args(wrapped_args)[1]
|
|
69
|
+
if not isinstance(args, list):
|
|
70
|
+
mlog.debug('Not a list:', str(args))
|
|
71
|
+
raise InvalidArguments('Argument not a list.')
|
|
72
|
+
if not all(isinstance(s, str) for s in args):
|
|
73
|
+
mlog.debug('Element not a string:', str(args))
|
|
74
|
+
raise InvalidArguments('Arguments must be strings.')
|
|
75
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
76
|
+
return T.cast('TV_func', wrapped)
|
|
77
|
+
|
|
78
|
+
def noArgsFlattening(f: TV_func) -> TV_func:
|
|
79
|
+
setattr(f, 'no-args-flattening', True) # noqa: B010
|
|
80
|
+
return f
|
|
81
|
+
|
|
82
|
+
def noSecondLevelHolderResolving(f: TV_func) -> TV_func:
|
|
83
|
+
setattr(f, 'no-second-level-holder-flattening', True) # noqa: B010
|
|
84
|
+
return f
|
|
85
|
+
|
|
86
|
+
def unholder_return(f: TV_func) -> T.Callable[..., TYPE_var]:
|
|
87
|
+
@wraps(f)
|
|
88
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
89
|
+
res = f(*wrapped_args, **wrapped_kwargs)
|
|
90
|
+
return _unholder(res)
|
|
91
|
+
return T.cast('T.Callable[..., TYPE_var]', wrapped)
|
|
92
|
+
|
|
93
|
+
def disablerIfNotFound(f: TV_func) -> TV_func:
|
|
94
|
+
@wraps(f)
|
|
95
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
96
|
+
kwargs = get_callee_args(wrapped_args)[2]
|
|
97
|
+
disabler = kwargs.pop('disabler', False)
|
|
98
|
+
ret = f(*wrapped_args, **wrapped_kwargs)
|
|
99
|
+
if disabler and not ret.found():
|
|
100
|
+
return Disabler()
|
|
101
|
+
return ret
|
|
102
|
+
return T.cast('TV_func', wrapped)
|
|
103
|
+
|
|
104
|
+
@dataclass(repr=False, eq=False)
|
|
105
|
+
class permittedKwargs:
|
|
106
|
+
permitted: T.Set[str]
|
|
107
|
+
|
|
108
|
+
def __call__(self, f: TV_func) -> TV_func:
|
|
109
|
+
@wraps(f)
|
|
110
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
111
|
+
kwargs = get_callee_args(wrapped_args)[2]
|
|
112
|
+
unknowns = set(kwargs).difference(self.permitted)
|
|
113
|
+
if unknowns:
|
|
114
|
+
ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)])
|
|
115
|
+
raise InvalidArguments(f'Got unknown keyword arguments {ustr}')
|
|
116
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
117
|
+
return T.cast('TV_func', wrapped)
|
|
118
|
+
|
|
119
|
+
def typed_operator(operator: MesonOperator,
|
|
120
|
+
types: T.Union[T.Type, T.Tuple[T.Type, ...]]) -> T.Callable[['_TV_FN_Operator'], '_TV_FN_Operator']:
|
|
121
|
+
"""Decorator that does type checking for operator calls.
|
|
122
|
+
|
|
123
|
+
The principle here is similar to typed_pos_args, however much simpler
|
|
124
|
+
since only one other object ever is passed
|
|
125
|
+
"""
|
|
126
|
+
def inner(f: '_TV_FN_Operator') -> '_TV_FN_Operator':
|
|
127
|
+
@wraps(f)
|
|
128
|
+
def wrapper(self: 'InterpreterObject', other: TYPE_var) -> TYPE_var:
|
|
129
|
+
if not isinstance(other, types):
|
|
130
|
+
raise InvalidArguments(f'The `{operator.value}` of {self.display_name()} does not accept objects of type {type(other).__name__} ({other})')
|
|
131
|
+
return f(self, other)
|
|
132
|
+
return T.cast('_TV_FN_Operator', wrapper)
|
|
133
|
+
return inner
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def typed_pos_args(name: str, *types: T.Union[T.Type, T.Tuple[T.Type, ...]],
|
|
137
|
+
varargs: T.Optional[T.Union[T.Type, T.Tuple[T.Type, ...]]] = None,
|
|
138
|
+
optargs: T.Optional[T.List[T.Union[T.Type, T.Tuple[T.Type, ...]]]] = None,
|
|
139
|
+
min_varargs: int = 0, max_varargs: int = 0) -> T.Callable[..., T.Any]:
|
|
140
|
+
"""Decorator that types type checking of positional arguments.
|
|
141
|
+
|
|
142
|
+
This supports two different models of optional arguments, the first is the
|
|
143
|
+
variadic argument model. Variadic arguments are a possibly bounded,
|
|
144
|
+
possibly unbounded number of arguments of the same type (unions are
|
|
145
|
+
supported). The second is the standard default value model, in this case
|
|
146
|
+
a number of optional arguments may be provided, but they are still
|
|
147
|
+
ordered, and they may have different types.
|
|
148
|
+
|
|
149
|
+
This function does not support mixing variadic and default arguments.
|
|
150
|
+
|
|
151
|
+
:name: The name of the decorated function (as displayed in error messages)
|
|
152
|
+
:varargs: They type(s) of any variadic arguments the function takes. If
|
|
153
|
+
None the function takes no variadic args
|
|
154
|
+
:min_varargs: the minimum number of variadic arguments taken
|
|
155
|
+
:max_varargs: the maximum number of variadic arguments taken. 0 means unlimited
|
|
156
|
+
:optargs: The types of any optional arguments parameters taken. If None
|
|
157
|
+
then no optional parameters are taken.
|
|
158
|
+
|
|
159
|
+
Some examples of usage blow:
|
|
160
|
+
>>> @typed_pos_args('mod.func', str, (str, int))
|
|
161
|
+
... def func(self, state: ModuleState, args: T.Tuple[str, T.Union[str, int]], kwargs: T.Dict[str, T.Any]) -> T.Any:
|
|
162
|
+
... pass
|
|
163
|
+
|
|
164
|
+
>>> @typed_pos_args('method', str, varargs=str)
|
|
165
|
+
... def method(self, node: BaseNode, args: T.Tuple[str, T.List[str]], kwargs: T.Dict[str, T.Any]) -> T.Any:
|
|
166
|
+
... pass
|
|
167
|
+
|
|
168
|
+
>>> @typed_pos_args('method', varargs=str, min_varargs=1)
|
|
169
|
+
... def method(self, node: BaseNode, args: T.Tuple[T.List[str]], kwargs: T.Dict[str, T.Any]) -> T.Any:
|
|
170
|
+
... pass
|
|
171
|
+
|
|
172
|
+
>>> @typed_pos_args('method', str, optargs=[(str, int), str])
|
|
173
|
+
... def method(self, node: BaseNode, args: T.Tuple[str, T.Optional[T.Union[str, int]], T.Optional[str]], kwargs: T.Dict[str, T.Any]) -> T.Any:
|
|
174
|
+
... pass
|
|
175
|
+
|
|
176
|
+
When should you chose `typed_pos_args('name', varargs=str,
|
|
177
|
+
min_varargs=1)` vs `typed_pos_args('name', str, varargs=str)`?
|
|
178
|
+
|
|
179
|
+
The answer has to do with the semantics of the function, if all of the
|
|
180
|
+
inputs are the same type (such as with `files()`) then the former is
|
|
181
|
+
correct, all of the arguments are string names of files. If the first
|
|
182
|
+
argument is something else the it should be separated.
|
|
183
|
+
"""
|
|
184
|
+
def inner(f: TV_func) -> TV_func:
|
|
185
|
+
|
|
186
|
+
@wraps(f)
|
|
187
|
+
def wrapper(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
188
|
+
args = get_callee_args(wrapped_args)[1]
|
|
189
|
+
|
|
190
|
+
# These are implementation programming errors, end users should never see them.
|
|
191
|
+
assert isinstance(args, list), args
|
|
192
|
+
assert max_varargs >= 0, 'max_varags cannot be negative'
|
|
193
|
+
assert min_varargs >= 0, 'min_varags cannot be negative'
|
|
194
|
+
assert optargs is None or varargs is None, \
|
|
195
|
+
'varargs and optargs not supported together as this would be ambiguous'
|
|
196
|
+
|
|
197
|
+
num_args = len(args)
|
|
198
|
+
num_types = len(types)
|
|
199
|
+
a_types = types
|
|
200
|
+
|
|
201
|
+
if varargs:
|
|
202
|
+
min_args = num_types + min_varargs
|
|
203
|
+
max_args = num_types + max_varargs
|
|
204
|
+
if max_varargs == 0 and num_args < min_args:
|
|
205
|
+
raise InvalidArguments(f'{name} takes at least {min_args} arguments, but got {num_args}.')
|
|
206
|
+
elif max_varargs != 0 and (num_args < min_args or num_args > max_args):
|
|
207
|
+
raise InvalidArguments(f'{name} takes between {min_args} and {max_args} arguments, but got {num_args}.')
|
|
208
|
+
elif optargs:
|
|
209
|
+
if num_args < num_types:
|
|
210
|
+
raise InvalidArguments(f'{name} takes at least {num_types} arguments, but got {num_args}.')
|
|
211
|
+
elif num_args > num_types + len(optargs):
|
|
212
|
+
raise InvalidArguments(f'{name} takes at most {num_types + len(optargs)} arguments, but got {num_args}.')
|
|
213
|
+
# Add the number of positional arguments required
|
|
214
|
+
if num_args > num_types:
|
|
215
|
+
diff = num_args - num_types
|
|
216
|
+
a_types = tuple(list(types) + list(optargs[:diff]))
|
|
217
|
+
elif num_args != num_types:
|
|
218
|
+
raise InvalidArguments(f'{name} takes exactly {num_types} arguments, but got {num_args}.')
|
|
219
|
+
|
|
220
|
+
for i, (arg, type_) in enumerate(itertools.zip_longest(args, a_types, fillvalue=varargs), start=1):
|
|
221
|
+
if not isinstance(arg, type_):
|
|
222
|
+
if isinstance(type_, tuple):
|
|
223
|
+
shouldbe = 'one of: {}'.format(", ".join(f'"{t.__name__}"' for t in type_))
|
|
224
|
+
else:
|
|
225
|
+
shouldbe = f'"{type_.__name__}"'
|
|
226
|
+
raise InvalidArguments(f'{name} argument {i} was of type "{type(arg).__name__}" but should have been {shouldbe}')
|
|
227
|
+
|
|
228
|
+
# Ensure that we're actually passing a tuple.
|
|
229
|
+
# Depending on what kind of function we're calling the length of
|
|
230
|
+
# wrapped_args can vary.
|
|
231
|
+
nargs = list(wrapped_args)
|
|
232
|
+
i = nargs.index(args)
|
|
233
|
+
if varargs:
|
|
234
|
+
# if we have varargs we need to split them into a separate
|
|
235
|
+
# tuple, as python's typing doesn't understand tuples with
|
|
236
|
+
# fixed elements and variadic elements, only one or the other.
|
|
237
|
+
# so in that case we need T.Tuple[int, str, float, T.Tuple[str, ...]]
|
|
238
|
+
pos = args[:len(types)]
|
|
239
|
+
var = list(args[len(types):])
|
|
240
|
+
pos.append(var)
|
|
241
|
+
nargs[i] = tuple(pos)
|
|
242
|
+
elif optargs:
|
|
243
|
+
if num_args < num_types + len(optargs):
|
|
244
|
+
diff = num_types + len(optargs) - num_args
|
|
245
|
+
nargs[i] = tuple(list(args) + [None] * diff)
|
|
246
|
+
else:
|
|
247
|
+
nargs[i] = tuple(args)
|
|
248
|
+
else:
|
|
249
|
+
nargs[i] = tuple(args)
|
|
250
|
+
return f(*nargs, **wrapped_kwargs)
|
|
251
|
+
|
|
252
|
+
return T.cast('TV_func', wrapper)
|
|
253
|
+
return inner
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class ContainerTypeInfo:
|
|
257
|
+
|
|
258
|
+
"""Container information for keyword arguments.
|
|
259
|
+
|
|
260
|
+
For keyword arguments that are containers (list or dict), this class encodes
|
|
261
|
+
that information.
|
|
262
|
+
|
|
263
|
+
:param container: the type of container
|
|
264
|
+
:param contains: the types the container holds
|
|
265
|
+
:param pairs: if the container is supposed to be of even length.
|
|
266
|
+
This is mainly used for interfaces that predate the addition of dictionaries, and use
|
|
267
|
+
`[key, value, key2, value2]` format.
|
|
268
|
+
:param allow_empty: Whether this container is allowed to be empty
|
|
269
|
+
There are some cases where containers not only must be passed, but must
|
|
270
|
+
not be empty, and other cases where an empty container is allowed.
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
def __init__(self, container: T.Type, contains: T.Union[T.Type, T.Tuple[T.Type, ...]], *,
|
|
274
|
+
pairs: bool = False, allow_empty: bool = True):
|
|
275
|
+
self.container = container
|
|
276
|
+
self.contains = contains
|
|
277
|
+
self.pairs = pairs
|
|
278
|
+
self.allow_empty = allow_empty
|
|
279
|
+
|
|
280
|
+
def check(self, value: T.Any) -> bool:
|
|
281
|
+
"""Check that a value is valid.
|
|
282
|
+
|
|
283
|
+
:param value: A value to check
|
|
284
|
+
:return: True if it is valid, False otherwise
|
|
285
|
+
"""
|
|
286
|
+
if not isinstance(value, self.container):
|
|
287
|
+
return False
|
|
288
|
+
iter_ = iter(value.values()) if isinstance(value, dict) else iter(value)
|
|
289
|
+
if any(not isinstance(i, self.contains) for i in iter_):
|
|
290
|
+
return False
|
|
291
|
+
if self.pairs and len(value) % 2 != 0:
|
|
292
|
+
return False
|
|
293
|
+
if not value and not self.allow_empty:
|
|
294
|
+
return False
|
|
295
|
+
return True
|
|
296
|
+
|
|
297
|
+
def check_any(self, value: T.Any) -> bool:
|
|
298
|
+
"""Check a value should emit new/deprecated feature.
|
|
299
|
+
|
|
300
|
+
:param value: A value to check
|
|
301
|
+
:return: True if any of the items in value matches, False otherwise
|
|
302
|
+
"""
|
|
303
|
+
if not isinstance(value, self.container):
|
|
304
|
+
return False
|
|
305
|
+
iter_ = iter(value.values()) if isinstance(value, dict) else iter(value)
|
|
306
|
+
return any(isinstance(i, self.contains) for i in iter_)
|
|
307
|
+
|
|
308
|
+
def description(self) -> str:
|
|
309
|
+
"""Human readable description of this container type.
|
|
310
|
+
|
|
311
|
+
:return: string to be printed
|
|
312
|
+
"""
|
|
313
|
+
container = 'dict' if self.container is dict else 'array'
|
|
314
|
+
if isinstance(self.contains, tuple):
|
|
315
|
+
contains = ' | '.join([t.__name__ for t in self.contains])
|
|
316
|
+
else:
|
|
317
|
+
contains = self.contains.__name__
|
|
318
|
+
s = f'{container}[{contains}]'
|
|
319
|
+
if self.pairs:
|
|
320
|
+
s += ' that has even size'
|
|
321
|
+
if not self.allow_empty:
|
|
322
|
+
s += ' that cannot be empty'
|
|
323
|
+
return s
|
|
324
|
+
|
|
325
|
+
_T = T.TypeVar('_T')
|
|
326
|
+
|
|
327
|
+
class _NULL_T:
|
|
328
|
+
"""Special null type for evolution, this is an implementation detail."""
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
_NULL = _NULL_T()
|
|
332
|
+
|
|
333
|
+
class KwargInfo(T.Generic[_T]):
|
|
334
|
+
|
|
335
|
+
"""A description of a keyword argument to a meson function
|
|
336
|
+
|
|
337
|
+
This is used to describe a value to the :func:typed_kwargs function.
|
|
338
|
+
|
|
339
|
+
:param name: the name of the parameter
|
|
340
|
+
:param types: A type or tuple of types that are allowed, or a :class:ContainerType
|
|
341
|
+
:param required: Whether this is a required keyword argument. defaults to False
|
|
342
|
+
:param listify: If true, then the argument will be listified before being
|
|
343
|
+
checked. This is useful for cases where the Meson DSL allows a scalar or
|
|
344
|
+
a container, but internally we only want to work with containers
|
|
345
|
+
:param default: A default value to use if this isn't set. defaults to None,
|
|
346
|
+
this may be safely set to a mutable type, as long as that type does not
|
|
347
|
+
itself contain mutable types, typed_kwargs will copy the default
|
|
348
|
+
:param since: Meson version in which this argument has been added. defaults to None
|
|
349
|
+
:param since_message: An extra message to pass to FeatureNew when since is triggered
|
|
350
|
+
:param deprecated: Meson version in which this argument has been deprecated. defaults to None
|
|
351
|
+
:param deprecated_message: An extra message to pass to FeatureDeprecated
|
|
352
|
+
when since is triggered
|
|
353
|
+
:param validator: A callable that does additional validation. This is mainly
|
|
354
|
+
intended for cases where a string is expected, but only a few specific
|
|
355
|
+
values are accepted. Must return None if the input is valid, or a
|
|
356
|
+
message if the input is invalid
|
|
357
|
+
:param convertor: A callable that converts the raw input value into a
|
|
358
|
+
different type. This is intended for cases such as the meson DSL using a
|
|
359
|
+
string, but the implementation using an Enum. This should not do
|
|
360
|
+
validation, just conversion.
|
|
361
|
+
:param deprecated_values: a dictionary mapping a value to the version of
|
|
362
|
+
meson it was deprecated in. The Value may be any valid value for this
|
|
363
|
+
argument.
|
|
364
|
+
:param since_values: a dictionary mapping a value to the version of meson it was
|
|
365
|
+
added in.
|
|
366
|
+
:param not_set_warning: A warning message that is logged if the kwarg is not
|
|
367
|
+
set by the user.
|
|
368
|
+
"""
|
|
369
|
+
def __init__(self, name: str,
|
|
370
|
+
types: T.Union[T.Type[_T], T.Tuple[T.Union[T.Type[_T], ContainerTypeInfo], ...], ContainerTypeInfo],
|
|
371
|
+
*, required: bool = False, listify: bool = False,
|
|
372
|
+
default: T.Optional[_T] = None,
|
|
373
|
+
since: T.Optional[str] = None,
|
|
374
|
+
since_message: T.Optional[str] = None,
|
|
375
|
+
since_values: T.Optional[T.Dict[T.Union[_T, ContainerTypeInfo, type], T.Union[str, T.Tuple[str, str]]]] = None,
|
|
376
|
+
deprecated: T.Optional[str] = None,
|
|
377
|
+
deprecated_message: T.Optional[str] = None,
|
|
378
|
+
deprecated_values: T.Optional[T.Dict[T.Union[_T, ContainerTypeInfo, type], T.Union[str, T.Tuple[str, str]]]] = None,
|
|
379
|
+
validator: T.Optional[T.Callable[[T.Any], T.Optional[str]]] = None,
|
|
380
|
+
convertor: T.Optional[T.Callable[[_T], object]] = None,
|
|
381
|
+
not_set_warning: T.Optional[str] = None):
|
|
382
|
+
self.name = name
|
|
383
|
+
self.types = types
|
|
384
|
+
self.required = required
|
|
385
|
+
self.listify = listify
|
|
386
|
+
self.default = default
|
|
387
|
+
self.since = since
|
|
388
|
+
self.since_message = since_message
|
|
389
|
+
self.since_values = since_values
|
|
390
|
+
self.deprecated = deprecated
|
|
391
|
+
self.deprecated_message = deprecated_message
|
|
392
|
+
self.deprecated_values = deprecated_values
|
|
393
|
+
self.validator = validator
|
|
394
|
+
self.convertor = convertor
|
|
395
|
+
self.not_set_warning = not_set_warning
|
|
396
|
+
|
|
397
|
+
def evolve(self, *,
|
|
398
|
+
name: T.Union[str, _NULL_T] = _NULL,
|
|
399
|
+
required: T.Union[bool, _NULL_T] = _NULL,
|
|
400
|
+
listify: T.Union[bool, _NULL_T] = _NULL,
|
|
401
|
+
default: T.Union[_T, None, _NULL_T] = _NULL,
|
|
402
|
+
since: T.Union[str, None, _NULL_T] = _NULL,
|
|
403
|
+
since_message: T.Union[str, None, _NULL_T] = _NULL,
|
|
404
|
+
since_values: T.Union[T.Dict[T.Union[_T, ContainerTypeInfo, type], T.Union[str, T.Tuple[str, str]]], None, _NULL_T] = _NULL,
|
|
405
|
+
deprecated: T.Union[str, None, _NULL_T] = _NULL,
|
|
406
|
+
deprecated_message: T.Union[str, None, _NULL_T] = _NULL,
|
|
407
|
+
deprecated_values: T.Union[T.Dict[T.Union[_T, ContainerTypeInfo, type], T.Union[str, T.Tuple[str, str]]], None, _NULL_T] = _NULL,
|
|
408
|
+
validator: T.Union[T.Callable[[_T], T.Optional[str]], None, _NULL_T] = _NULL,
|
|
409
|
+
convertor: T.Union[T.Callable[[_T], TYPE_var], None, _NULL_T] = _NULL) -> 'KwargInfo':
|
|
410
|
+
"""Create a shallow copy of this KwargInfo, with modifications.
|
|
411
|
+
|
|
412
|
+
This allows us to create a new copy of a KwargInfo with modifications.
|
|
413
|
+
This allows us to use a shared kwarg that implements complex logic, but
|
|
414
|
+
has slight differences in usage, such as being added to different
|
|
415
|
+
functions in different versions of Meson.
|
|
416
|
+
|
|
417
|
+
The use the _NULL special value here allows us to pass None, which has
|
|
418
|
+
meaning in many of these cases. _NULL itself is never stored, always
|
|
419
|
+
being replaced by either the copy in self, or the provided new version.
|
|
420
|
+
"""
|
|
421
|
+
return type(self)(
|
|
422
|
+
name if not isinstance(name, _NULL_T) else self.name,
|
|
423
|
+
self.types,
|
|
424
|
+
listify=listify if not isinstance(listify, _NULL_T) else self.listify,
|
|
425
|
+
required=required if not isinstance(required, _NULL_T) else self.required,
|
|
426
|
+
default=default if not isinstance(default, _NULL_T) else self.default,
|
|
427
|
+
since=since if not isinstance(since, _NULL_T) else self.since,
|
|
428
|
+
since_message=since_message if not isinstance(since_message, _NULL_T) else self.since_message,
|
|
429
|
+
since_values=since_values if not isinstance(since_values, _NULL_T) else self.since_values,
|
|
430
|
+
deprecated=deprecated if not isinstance(deprecated, _NULL_T) else self.deprecated,
|
|
431
|
+
deprecated_message=deprecated_message if not isinstance(deprecated_message, _NULL_T) else self.deprecated_message,
|
|
432
|
+
deprecated_values=deprecated_values if not isinstance(deprecated_values, _NULL_T) else self.deprecated_values,
|
|
433
|
+
validator=validator if not isinstance(validator, _NULL_T) else self.validator,
|
|
434
|
+
convertor=convertor if not isinstance(convertor, _NULL_T) else self.convertor,
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
def typed_kwargs(name: str, *types: KwargInfo, allow_unknown: bool = False) -> T.Callable[..., T.Any]:
|
|
439
|
+
"""Decorator for type checking keyword arguments.
|
|
440
|
+
|
|
441
|
+
Used to wrap a meson DSL implementation function, where it checks various
|
|
442
|
+
things about keyword arguments, including the type, and various other
|
|
443
|
+
information. For non-required values it sets the value to a default, which
|
|
444
|
+
means the value will always be provided.
|
|
445
|
+
|
|
446
|
+
If type is a :class:ContainerTypeInfo, then the default value will be
|
|
447
|
+
passed as an argument to the container initializer, making a shallow copy
|
|
448
|
+
|
|
449
|
+
:param name: the name of the function, including the object it's attached to
|
|
450
|
+
(if applicable)
|
|
451
|
+
:param *types: KwargInfo entries for each keyword argument.
|
|
452
|
+
"""
|
|
453
|
+
def inner(f: TV_func) -> TV_func:
|
|
454
|
+
|
|
455
|
+
def types_description(types_tuple: T.Tuple[T.Union[T.Type, ContainerTypeInfo], ...]) -> str:
|
|
456
|
+
candidates = []
|
|
457
|
+
for t in types_tuple:
|
|
458
|
+
if isinstance(t, ContainerTypeInfo):
|
|
459
|
+
candidates.append(t.description())
|
|
460
|
+
else:
|
|
461
|
+
candidates.append(t.__name__)
|
|
462
|
+
shouldbe = 'one of: ' if len(candidates) > 1 else ''
|
|
463
|
+
shouldbe += ', '.join(candidates)
|
|
464
|
+
return shouldbe
|
|
465
|
+
|
|
466
|
+
def raw_description(t: object) -> str:
|
|
467
|
+
"""describe a raw type (ie, one that is not a ContainerTypeInfo)."""
|
|
468
|
+
if isinstance(t, list):
|
|
469
|
+
if t:
|
|
470
|
+
return f"array[{' | '.join(sorted(mesonlib.OrderedSet(type(v).__name__ for v in t)))}]"
|
|
471
|
+
return 'array[]'
|
|
472
|
+
elif isinstance(t, dict):
|
|
473
|
+
if t:
|
|
474
|
+
return f"dict[{' | '.join(sorted(mesonlib.OrderedSet(type(v).__name__ for v in t.values())))}]"
|
|
475
|
+
return 'dict[]'
|
|
476
|
+
return type(t).__name__
|
|
477
|
+
|
|
478
|
+
def check_value_type(types_tuple: T.Tuple[T.Union[T.Type, ContainerTypeInfo], ...],
|
|
479
|
+
value: T.Any) -> bool:
|
|
480
|
+
for t in types_tuple:
|
|
481
|
+
if isinstance(t, ContainerTypeInfo):
|
|
482
|
+
if t.check(value):
|
|
483
|
+
return True
|
|
484
|
+
elif isinstance(value, t):
|
|
485
|
+
return True
|
|
486
|
+
return False
|
|
487
|
+
|
|
488
|
+
@wraps(f)
|
|
489
|
+
def wrapper(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
490
|
+
|
|
491
|
+
def emit_feature_change(values: T.Dict[_T, T.Union[str, T.Tuple[str, str]]], feature: T.Union[T.Type['FeatureDeprecated'], T.Type['FeatureNew']]) -> None:
|
|
492
|
+
for n, version in values.items():
|
|
493
|
+
if isinstance(version, tuple):
|
|
494
|
+
version, msg = version
|
|
495
|
+
else:
|
|
496
|
+
msg = None
|
|
497
|
+
|
|
498
|
+
warning: T.Optional[str] = None
|
|
499
|
+
if isinstance(n, ContainerTypeInfo):
|
|
500
|
+
if n.check_any(value):
|
|
501
|
+
warning = f'of type {n.description()}'
|
|
502
|
+
elif isinstance(n, type):
|
|
503
|
+
if isinstance(value, n):
|
|
504
|
+
warning = f'of type {n.__name__}'
|
|
505
|
+
elif isinstance(value, list):
|
|
506
|
+
if n in value:
|
|
507
|
+
warning = f'value "{n}" in list'
|
|
508
|
+
elif isinstance(value, dict):
|
|
509
|
+
if n in value.keys():
|
|
510
|
+
warning = f'value "{n}" in dict keys'
|
|
511
|
+
elif n == value:
|
|
512
|
+
warning = f'value "{n}"'
|
|
513
|
+
if warning:
|
|
514
|
+
feature.single_use(f'"{name}" keyword argument "{info.name}" {warning}', version, subproject, msg, location=node)
|
|
515
|
+
|
|
516
|
+
node, _, _kwargs, subproject = get_callee_args(wrapped_args)
|
|
517
|
+
# Cast here, as the convertor function may place something other than a TYPE_var in the kwargs
|
|
518
|
+
kwargs = T.cast('T.Dict[str, object]', _kwargs)
|
|
519
|
+
|
|
520
|
+
if not allow_unknown:
|
|
521
|
+
all_names = {t.name for t in types}
|
|
522
|
+
unknowns = set(kwargs).difference(all_names)
|
|
523
|
+
if unknowns:
|
|
524
|
+
ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)])
|
|
525
|
+
raise InvalidArguments(f'{name} got unknown keyword arguments {ustr}')
|
|
526
|
+
|
|
527
|
+
for info in types:
|
|
528
|
+
types_tuple = info.types if isinstance(info.types, tuple) else (info.types,)
|
|
529
|
+
value = kwargs.get(info.name)
|
|
530
|
+
if value is not None:
|
|
531
|
+
if info.since:
|
|
532
|
+
feature_name = info.name + ' arg in ' + name
|
|
533
|
+
FeatureNew.single_use(feature_name, info.since, subproject, info.since_message, location=node)
|
|
534
|
+
if info.deprecated:
|
|
535
|
+
feature_name = info.name + ' arg in ' + name
|
|
536
|
+
FeatureDeprecated.single_use(feature_name, info.deprecated, subproject, info.deprecated_message, location=node)
|
|
537
|
+
if info.listify:
|
|
538
|
+
kwargs[info.name] = value = mesonlib.listify(value)
|
|
539
|
+
if not check_value_type(types_tuple, value):
|
|
540
|
+
shouldbe = types_description(types_tuple)
|
|
541
|
+
raise InvalidArguments(f'{name} keyword argument {info.name!r} was of type {raw_description(value)} but should have been {shouldbe}')
|
|
542
|
+
|
|
543
|
+
if info.validator is not None:
|
|
544
|
+
msg = info.validator(value)
|
|
545
|
+
if msg is not None:
|
|
546
|
+
raise InvalidArguments(f'{name} keyword argument "{info.name}" {msg}')
|
|
547
|
+
|
|
548
|
+
if info.deprecated_values is not None:
|
|
549
|
+
emit_feature_change(info.deprecated_values, FeatureDeprecated)
|
|
550
|
+
|
|
551
|
+
if info.since_values is not None:
|
|
552
|
+
emit_feature_change(info.since_values, FeatureNew)
|
|
553
|
+
|
|
554
|
+
elif info.required:
|
|
555
|
+
raise InvalidArguments(f'{name} is missing required keyword argument "{info.name}"')
|
|
556
|
+
else:
|
|
557
|
+
# set the value to the default, this ensuring all kwargs are present
|
|
558
|
+
# This both simplifies the typing checking and the usage
|
|
559
|
+
assert check_value_type(types_tuple, info.default), f'In function {name} default value of {info.name} is not a valid type, got {type(info.default)} expected {types_description(types_tuple)}'
|
|
560
|
+
# Create a shallow copy of the container. This allows mutable
|
|
561
|
+
# types to be used safely as default values
|
|
562
|
+
kwargs[info.name] = copy.copy(info.default)
|
|
563
|
+
if info.not_set_warning:
|
|
564
|
+
mlog.warning(info.not_set_warning)
|
|
565
|
+
|
|
566
|
+
if info.convertor:
|
|
567
|
+
kwargs[info.name] = info.convertor(kwargs[info.name])
|
|
568
|
+
|
|
569
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
570
|
+
return T.cast('TV_func', wrapper)
|
|
571
|
+
return inner
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
# This cannot be a dataclass due to https://github.com/python/mypy/issues/5374
|
|
575
|
+
class FeatureCheckBase(metaclass=abc.ABCMeta):
|
|
576
|
+
"Base class for feature version checks"
|
|
577
|
+
|
|
578
|
+
feature_registry: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[T.Tuple[str, T.Optional['mparser.BaseNode']]]]]]
|
|
579
|
+
emit_notice = False
|
|
580
|
+
unconditional = False
|
|
581
|
+
|
|
582
|
+
def __init__(self, feature_name: str, feature_version: str, extra_message: str = ''):
|
|
583
|
+
self.feature_name = feature_name
|
|
584
|
+
self.feature_version = feature_version
|
|
585
|
+
self.extra_message = extra_message
|
|
586
|
+
|
|
587
|
+
@staticmethod
|
|
588
|
+
def get_target_version(subproject: str) -> str:
|
|
589
|
+
# Don't do any checks if project() has not been parsed yet
|
|
590
|
+
if subproject not in mesonlib.project_meson_versions:
|
|
591
|
+
return ''
|
|
592
|
+
return mesonlib.project_meson_versions[subproject]
|
|
593
|
+
|
|
594
|
+
@staticmethod
|
|
595
|
+
@abc.abstractmethod
|
|
596
|
+
def check_version(target_version: str, feature_version: str) -> bool:
|
|
597
|
+
pass
|
|
598
|
+
|
|
599
|
+
def use(self, subproject: 'SubProject', location: T.Optional['mparser.BaseNode'] = None) -> None:
|
|
600
|
+
tv = self.get_target_version(subproject)
|
|
601
|
+
# No target version
|
|
602
|
+
if tv == '' and not self.unconditional:
|
|
603
|
+
return
|
|
604
|
+
# Target version is new enough, don't warn
|
|
605
|
+
if self.check_version(tv, self.feature_version) and not self.emit_notice:
|
|
606
|
+
return
|
|
607
|
+
# Feature is too new for target version or we want to emit notices, register it
|
|
608
|
+
if subproject not in self.feature_registry:
|
|
609
|
+
self.feature_registry[subproject] = {self.feature_version: set()}
|
|
610
|
+
register = self.feature_registry[subproject]
|
|
611
|
+
if self.feature_version not in register:
|
|
612
|
+
register[self.feature_version] = set()
|
|
613
|
+
|
|
614
|
+
feature_key = (self.feature_name, location)
|
|
615
|
+
if feature_key in register[self.feature_version]:
|
|
616
|
+
# Don't warn about the same feature multiple times
|
|
617
|
+
# FIXME: This is needed to prevent duplicate warnings, but also
|
|
618
|
+
# means we won't warn about a feature used in multiple places.
|
|
619
|
+
return
|
|
620
|
+
register[self.feature_version].add(feature_key)
|
|
621
|
+
# Target version is new enough, don't warn even if it is registered for notice
|
|
622
|
+
if self.check_version(tv, self.feature_version):
|
|
623
|
+
return
|
|
624
|
+
self.log_usage_warning(tv, location)
|
|
625
|
+
|
|
626
|
+
@classmethod
|
|
627
|
+
def report(cls, subproject: str) -> None:
|
|
628
|
+
if subproject not in cls.feature_registry:
|
|
629
|
+
return
|
|
630
|
+
warning_str = cls.get_warning_str_prefix(cls.get_target_version(subproject))
|
|
631
|
+
notice_str = cls.get_notice_str_prefix(cls.get_target_version(subproject))
|
|
632
|
+
fv = cls.feature_registry[subproject]
|
|
633
|
+
tv = cls.get_target_version(subproject)
|
|
634
|
+
for version in sorted(fv.keys()):
|
|
635
|
+
message = ', '.join(sorted({f"'{i[0]}'" for i in fv[version]}))
|
|
636
|
+
if cls.check_version(tv, version):
|
|
637
|
+
notice_str += '\n * {}: {{{}}}'.format(version, message)
|
|
638
|
+
else:
|
|
639
|
+
warning_str += '\n * {}: {{{}}}'.format(version, message)
|
|
640
|
+
if '\n' in notice_str:
|
|
641
|
+
mlog.notice(notice_str, fatal=False)
|
|
642
|
+
if '\n' in warning_str:
|
|
643
|
+
mlog.warning(warning_str)
|
|
644
|
+
|
|
645
|
+
def log_usage_warning(self, tv: str, location: T.Optional['mparser.BaseNode']) -> None:
|
|
646
|
+
raise InterpreterException('log_usage_warning not implemented')
|
|
647
|
+
|
|
648
|
+
@staticmethod
|
|
649
|
+
def get_warning_str_prefix(tv: str) -> str:
|
|
650
|
+
raise InterpreterException('get_warning_str_prefix not implemented')
|
|
651
|
+
|
|
652
|
+
@staticmethod
|
|
653
|
+
def get_notice_str_prefix(tv: str) -> str:
|
|
654
|
+
raise InterpreterException('get_notice_str_prefix not implemented')
|
|
655
|
+
|
|
656
|
+
def __call__(self, f: TV_func) -> TV_func:
|
|
657
|
+
@wraps(f)
|
|
658
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
659
|
+
node, _, _, subproject = get_callee_args(wrapped_args)
|
|
660
|
+
if subproject is None:
|
|
661
|
+
raise AssertionError(f'{wrapped_args!r}')
|
|
662
|
+
self.use(subproject, node)
|
|
663
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
664
|
+
return T.cast('TV_func', wrapped)
|
|
665
|
+
|
|
666
|
+
@classmethod
|
|
667
|
+
def single_use(cls, feature_name: str, version: str, subproject: 'SubProject',
|
|
668
|
+
extra_message: str = '', location: T.Optional['mparser.BaseNode'] = None) -> None:
|
|
669
|
+
"""Oneline version that instantiates and calls use()."""
|
|
670
|
+
cls(feature_name, version, extra_message).use(subproject, location)
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
class FeatureNew(FeatureCheckBase):
|
|
674
|
+
"""Checks for new features"""
|
|
675
|
+
|
|
676
|
+
# Class variable, shared across all instances
|
|
677
|
+
#
|
|
678
|
+
# Format: {subproject: {feature_version: set(feature_names)}}
|
|
679
|
+
feature_registry = {}
|
|
680
|
+
|
|
681
|
+
@staticmethod
|
|
682
|
+
def check_version(target_version: str, feature_version: str) -> bool:
|
|
683
|
+
return mesonlib.version_compare_condition_with_min(target_version, feature_version)
|
|
684
|
+
|
|
685
|
+
@staticmethod
|
|
686
|
+
def get_warning_str_prefix(tv: str) -> str:
|
|
687
|
+
return f'Project specifies a minimum meson_version \'{tv}\' but uses features which were added in newer versions:'
|
|
688
|
+
|
|
689
|
+
@staticmethod
|
|
690
|
+
def get_notice_str_prefix(tv: str) -> str:
|
|
691
|
+
return ''
|
|
692
|
+
|
|
693
|
+
def log_usage_warning(self, tv: str, location: T.Optional['mparser.BaseNode']) -> None:
|
|
694
|
+
args = [
|
|
695
|
+
'Project targets', f"'{tv}'",
|
|
696
|
+
'but uses feature introduced in',
|
|
697
|
+
f"'{self.feature_version}':",
|
|
698
|
+
f'{self.feature_name}.',
|
|
699
|
+
]
|
|
700
|
+
if self.extra_message:
|
|
701
|
+
args.append(self.extra_message)
|
|
702
|
+
mlog.warning(*args, location=location)
|
|
703
|
+
|
|
704
|
+
class FeatureDeprecated(FeatureCheckBase):
|
|
705
|
+
"""Checks for deprecated features"""
|
|
706
|
+
|
|
707
|
+
# Class variable, shared across all instances
|
|
708
|
+
#
|
|
709
|
+
# Format: {subproject: {feature_version: set(feature_names)}}
|
|
710
|
+
feature_registry = {}
|
|
711
|
+
emit_notice = True
|
|
712
|
+
|
|
713
|
+
@staticmethod
|
|
714
|
+
def check_version(target_version: str, feature_version: str) -> bool:
|
|
715
|
+
# For deprecation checks we need to return the inverse of FeatureNew checks
|
|
716
|
+
return not mesonlib.version_compare_condition_with_min(target_version, feature_version)
|
|
717
|
+
|
|
718
|
+
@staticmethod
|
|
719
|
+
def get_warning_str_prefix(tv: str) -> str:
|
|
720
|
+
return 'Deprecated features used:'
|
|
721
|
+
|
|
722
|
+
@staticmethod
|
|
723
|
+
def get_notice_str_prefix(tv: str) -> str:
|
|
724
|
+
return 'Future-deprecated features used:'
|
|
725
|
+
|
|
726
|
+
def log_usage_warning(self, tv: str, location: T.Optional['mparser.BaseNode']) -> None:
|
|
727
|
+
args = [
|
|
728
|
+
'Project targets', f"'{tv}'",
|
|
729
|
+
'but uses feature deprecated since',
|
|
730
|
+
f"'{self.feature_version}':",
|
|
731
|
+
f'{self.feature_name}.',
|
|
732
|
+
]
|
|
733
|
+
if self.extra_message:
|
|
734
|
+
args.append(self.extra_message)
|
|
735
|
+
mlog.warning(*args, location=location)
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
class FeatureBroken(FeatureCheckBase):
|
|
739
|
+
"""Checks for broken features"""
|
|
740
|
+
|
|
741
|
+
# Class variable, shared across all instances
|
|
742
|
+
#
|
|
743
|
+
# Format: {subproject: {feature_version: set(feature_names)}}
|
|
744
|
+
feature_registry = {}
|
|
745
|
+
unconditional = True
|
|
746
|
+
|
|
747
|
+
@staticmethod
|
|
748
|
+
def check_version(target_version: str, feature_version: str) -> bool:
|
|
749
|
+
# always warn for broken stuff
|
|
750
|
+
return False
|
|
751
|
+
|
|
752
|
+
@staticmethod
|
|
753
|
+
def get_warning_str_prefix(tv: str) -> str:
|
|
754
|
+
return 'Broken features used:'
|
|
755
|
+
|
|
756
|
+
@staticmethod
|
|
757
|
+
def get_notice_str_prefix(tv: str) -> str:
|
|
758
|
+
return ''
|
|
759
|
+
|
|
760
|
+
def log_usage_warning(self, tv: str, location: T.Optional['mparser.BaseNode']) -> None:
|
|
761
|
+
args = [
|
|
762
|
+
'Project uses feature that was always broken,',
|
|
763
|
+
'and is now deprecated since',
|
|
764
|
+
f"'{self.feature_version}':",
|
|
765
|
+
f'{self.feature_name}.',
|
|
766
|
+
]
|
|
767
|
+
if self.extra_message:
|
|
768
|
+
args.append(self.extra_message)
|
|
769
|
+
mlog.deprecation(*args, location=location)
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
# This cannot be a dataclass due to https://github.com/python/mypy/issues/5374
|
|
773
|
+
class FeatureCheckKwargsBase(metaclass=abc.ABCMeta):
|
|
774
|
+
|
|
775
|
+
@property
|
|
776
|
+
@abc.abstractmethod
|
|
777
|
+
def feature_check_class(self) -> T.Type[FeatureCheckBase]:
|
|
778
|
+
pass
|
|
779
|
+
|
|
780
|
+
def __init__(self, feature_name: str, feature_version: str,
|
|
781
|
+
kwargs: T.List[str], extra_message: T.Optional[str] = None):
|
|
782
|
+
self.feature_name = feature_name
|
|
783
|
+
self.feature_version = feature_version
|
|
784
|
+
self.kwargs = kwargs
|
|
785
|
+
self.extra_message = extra_message
|
|
786
|
+
|
|
787
|
+
def __call__(self, f: TV_func) -> TV_func:
|
|
788
|
+
@wraps(f)
|
|
789
|
+
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
|
|
790
|
+
node, _, kwargs, subproject = get_callee_args(wrapped_args)
|
|
791
|
+
if subproject is None:
|
|
792
|
+
raise AssertionError(f'{wrapped_args!r}')
|
|
793
|
+
for arg in self.kwargs:
|
|
794
|
+
if arg not in kwargs:
|
|
795
|
+
continue
|
|
796
|
+
name = arg + ' arg in ' + self.feature_name
|
|
797
|
+
self.feature_check_class.single_use(
|
|
798
|
+
name, self.feature_version, subproject, self.extra_message, node)
|
|
799
|
+
return f(*wrapped_args, **wrapped_kwargs)
|
|
800
|
+
return T.cast('TV_func', wrapped)
|
|
801
|
+
|
|
802
|
+
class FeatureNewKwargs(FeatureCheckKwargsBase):
|
|
803
|
+
feature_check_class = FeatureNew
|
|
804
|
+
|
|
805
|
+
class FeatureDeprecatedKwargs(FeatureCheckKwargsBase):
|
|
806
|
+
feature_check_class = FeatureDeprecated
|