Skip to content

Commit

Permalink
Use conda.base.constants.KNOWN_SUBDIRS for setting up selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Sep 22, 2023
1 parent 0a3ecf0 commit 2b7d734
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
23 changes: 14 additions & 9 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
find_recipe,
get_installed_packages,
insert_variant_versions,
DEFAULT_SUBDIRS,
)

from .conda_interface import MatchSpec, envs_dirs, md5_file, non_x86_linux_machines
Expand Down Expand Up @@ -121,25 +122,29 @@ def get_selectors(config: Config) -> dict[str, bool]:
# Remember to update the docs of any of this changes
plat = config.host_subdir
d = dict(
linux=plat.startswith("linux-"),
linux32=bool(plat == "linux-32"),
linux64=bool(plat == "linux-64"),
emscripten=plat.startswith("emscripten-"),
wasi=plat.startswith("wasi-"),
arm=plat.startswith("linux-arm"),
osx=plat.startswith("osx-"),
unix=plat.startswith(("linux-", "osx-", "emscripten-")),
win=plat.startswith("win-"),
win32=bool(plat == "win-32"),
win64=bool(plat == "win-64"),
x86=plat.endswith(("-32", "-64")),
x86_64=plat.endswith("-64"),
wasm32=bool(plat.endswith("-wasm32")),
os=os,
environ=os.environ,
nomkl=bool(int(os.environ.get("FEATURE_NOMKL", False))),
)

subdirs = [subdir for subdir in DEFAULT_SUBDIRS if subdir != "noarch"]
subdir_oses = set([subdir.split("-")[0] for subdir in DEFAULT_SUBDIRS])
subdir_archs = set([subdir.split("-")[1] for subdir in DEFAULT_SUBDIRS])

for os in subdir_oses:
d[os] = plat.startswith(f"{os}-")

for arch in subdir_arches:
arch_full = ARCH_MAP.get(arch, arch)
d[arch_full] = plat.endswith(f"-{arch}")
if arch == "32":
d["x86"] = plat.endswith(("-32", "-64"))

defaults = variants.get_default_variant(config)
py = config.variant.get("python", defaults["python"])
# there are times when python comes in as a tuple
Expand Down
22 changes: 3 additions & 19 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
CONDA_PACKAGE_EXTENSION_V2 = ".conda"
CONDA_PACKAGE_EXTENSIONS = (CONDA_PACKAGE_EXTENSION_V2, CONDA_PACKAGE_EXTENSION_V1)

from conda.base.constants import KNOWN_SUBDIRS

import urllib.parse as urlparse
import urllib.request as urllib
from glob import glob as glob_glob
Expand Down Expand Up @@ -112,25 +114,7 @@ def glob(pathname, recursive=True):
mmap_PROT_READ = 0 if on_win else mmap.PROT_READ
mmap_PROT_WRITE = 0 if on_win else mmap.PROT_WRITE

DEFAULT_SUBDIRS = {
"emscripten-wasm32",
"wasi-wasm32",
"linux-64",
"linux-32",
"linux-s390x",
"linux-ppc64",
"linux-ppc64le",
"linux-armv6l",
"linux-armv7l",
"linux-aarch64",
"win-64",
"win-32",
"win-arm64",
"osx-64",
"osx-arm64",
"zos-z",
"noarch",
}
DEFAULT_SUBDIRS = set(KNOWN_SUBDIRS)

RUN_EXPORTS_TYPES = {
"weak",
Expand Down

0 comments on commit 2b7d734

Please sign in to comment.