aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-07-16 20:33:57 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-07-16 21:03:23 +0200
commit05ddd6543d4c4fc33b4c64f26291e73f49733f71 (patch)
treed93d9e3dd08c33c0c7cb69d75e9fd94c60bb614f
parent019ed04331695bb6f5c5fff70dfced34c4ba9012 (diff)
downloadmeson-05ddd6543d4c4fc33b4c64f26291e73f49733f71.zip
meson-05ddd6543d4c4fc33b4c64f26291e73f49733f71.tar.gz
meson-05ddd6543d4c4fc33b4c64f26291e73f49733f71.tar.bz2
mdata: remove setuptools and use mesondata instead
-rw-r--r--mesonbuild/cmake/interpreter.py5
-rw-r--r--mesonbuild/dependencies/base.py6
-rw-r--r--msi/createmsi.py4
-rw-r--r--setup.py5
4 files changed, 4 insertions, 16 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index 0516947..f404109 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -15,8 +15,6 @@
# This class contains the basic functionality needed to run any interpreter
# or an interpreter-based tool.
-import pkg_resources
-
from .common import CMakeException, CMakeTarget, TargetOptions
from .client import CMakeClient, RequestCMakeInputs, RequestConfigure, RequestCompute, RequestCodeModel
from .fileapi import CMakeFileAPI
@@ -25,6 +23,7 @@ from .traceparser import CMakeTraceParser, CMakeGeneratorTarget
from .. import mlog, mesonlib
from ..environment import Environment
from ..mesonlib import MachineChoice, OrderedSet, version_compare
+from ..mesondata import mesondata
from ..compilers.compilers import lang_suffixes, header_suffixes, obj_suffixes, lib_suffixes, is_header
from enum import Enum
from functools import lru_cache
@@ -814,7 +813,7 @@ class CMakeInterpreter:
raise CMakeException('Unable to find CMake')
self.trace = CMakeTraceParser(cmake_exe.version(), self.build_dir, permissive=True)
- preload_file = pkg_resources.resource_filename('mesonbuild', 'cmake/data/preload.cmake')
+ preload_file = mesondata['cmake/data/preload.cmake'].write_to_private(self.env)
# Prefere CMAKE_PROJECT_INCLUDE over CMAKE_TOOLCHAIN_FILE if possible,
# since CMAKE_PROJECT_INCLUDE was actually designed for code injection.
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 23701da..4c9c9fe 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -29,8 +29,6 @@ import typing as T
from enum import Enum
from pathlib import Path, PurePath
-import pkg_resources
-
from .. import mlog
from .. import mesonlib
from ..compilers import clib_langs
@@ -40,6 +38,7 @@ from ..cmake import CMakeExecutor, CMakeTraceParser, CMakeException
from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine
from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify, stringlistify, extract_as_list, split_args
from ..mesonlib import Version, LibType
+from ..mesondata import mesondata
if T.TYPE_CHECKING:
from ..compilers.compilers import CompilerType # noqa: F401
@@ -1512,8 +1511,7 @@ class CMakeDependency(ExternalDependency):
build_dir = self._get_build_dir()
# Insert language parameters into the CMakeLists.txt and write new CMakeLists.txt
- # Per the warning in pkg_resources, this is *not* a path and os.path and Pathlib are *not* safe to use here.
- cmake_txt = pkg_resources.resource_string('mesonbuild', 'dependencies/data/' + cmake_file).decode()
+ cmake_txt = mesondata['dependencies/data/' + cmake_file].data
# In general, some Fortran CMake find_package() also require C language enabled,
# even if nothing from C is directly used. An easy Fortran example that fails
diff --git a/msi/createmsi.py b/msi/createmsi.py
index 67020a5..eca4493 100644
--- a/msi/createmsi.py
+++ b/msi/createmsi.py
@@ -151,8 +151,6 @@ class PackageGenerator:
if os.path.exists(sdir):
shutil.rmtree(sdir)
main_stage, ninja_stage = self.staging_dirs
- dep_data_dir = 'mesonbuild/dependencies/data'
- cmake_data_dir = 'mesonbuild/cmake/data'
modules = self.get_all_modules_from_dir('mesonbuild/modules')
modules += self.get_all_modules_from_dir('mesonbuild/scripts')
modules += self.get_more_modules()
@@ -174,8 +172,6 @@ class PackageGenerator:
pyinst_cmd += ['meson.py']
subprocess.check_call(pyinst_cmd)
shutil.move(pyinstaller_tmpdir + '/meson', main_stage)
- shutil.copytree(dep_data_dir, main_stage + '/mesonbuild/dependencies/data')
- shutil.copytree(cmake_data_dir, main_stage + '/mesonbuild/cmake/data')
if not os.path.exists(os.path.join(main_stage, 'meson.exe')):
sys.exit('Meson exe missing from staging dir.')
os.mkdir(ninja_stage)
diff --git a/setup.py b/setup.py
index 1f95be7..145f19c 100644
--- a/setup.py
+++ b/setup.py
@@ -37,10 +37,6 @@ packages = ['mesonbuild',
'mesonbuild.scripts',
'mesonbuild.templates',
'mesonbuild.wrap']
-package_data = {
- 'mesonbuild.dependencies': ['data/CMakeLists.txt', 'data/CMakeListsLLVM.txt', 'data/CMakePathInfo.txt'],
- 'mesonbuild.cmake': ['data/run_ctgt.py', 'data/preload.cmake'],
-}
data_files = []
if sys.platform != 'win32':
# Only useful on UNIX-like systems
@@ -51,6 +47,5 @@ if __name__ == '__main__':
setup(name='meson',
version=version,
packages=packages,
- package_data=package_data,
entry_points=entries,
data_files=data_files,)