cargo/interpreter: delete dead code

pull/12299/merge
Dylan Baker 2 weeks ago committed by Eli Schwartz
parent a2b0e665bb
commit 5d95342c21
  1. 43
      mesonbuild/cargo/interpreter.py

@ -11,9 +11,7 @@ port will be required.
from __future__ import annotations
import dataclasses
import glob
import importlib
import itertools
import json
import os
import shutil
@ -372,47 +370,6 @@ def _convert_manifest(raw_manifest: manifest.Manifest, subdir: str, path: str =
)
def _load_manifests(subdir: str) -> T.Dict[str, Manifest]:
filename = os.path.join(subdir, 'Cargo.toml')
raw = load_toml(filename)
manifests: T.Dict[str, Manifest] = {}
raw_manifest: T.Union[manifest.Manifest, manifest.VirtualManifest]
if 'package' in raw:
raw_manifest = T.cast('manifest.Manifest', raw)
manifest_ = _convert_manifest(raw_manifest, subdir)
manifests[manifest_.package.name] = manifest_
else:
raw_manifest = T.cast('manifest.VirtualManifest', raw)
if 'workspace' in raw_manifest:
# XXX: need to verify that python glob and cargo globbing are the
# same and probably write a glob implementation. Blarg
# We need to chdir here to make the glob work correctly
pwd = os.getcwd()
os.chdir(subdir)
members: T.Iterable[str]
try:
members = itertools.chain.from_iterable(
glob.glob(m) for m in raw_manifest['workspace']['members'])
finally:
os.chdir(pwd)
if 'exclude' in raw_manifest['workspace']:
members = (x for x in members if x not in raw_manifest['workspace']['exclude'])
for m in members:
filename = os.path.join(subdir, m, 'Cargo.toml')
raw = load_toml(filename)
raw_manifest = T.cast('manifest.Manifest', raw)
man = _convert_manifest(raw_manifest, subdir, m)
manifests[man.package.name] = man
return manifests
def _version_to_api(version: str) -> str:
# x.y.z -> x
# 0.x.y -> 0.x

Loading…
Cancel
Save