From 62223ec1d36ca7a3a2eaf3c14fbeca2a3a75a842 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 31 Jan 2023 13:56:00 -0600 Subject: [PATCH] Hack to install downstream packages in correct subdir --- conda_build/render.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/conda_build/render.py b/conda_build/render.py index 9f4e3c7cd2..f3d1801ec6 100644 --- a/conda_build/render.py +++ b/conda_build/render.py @@ -5,6 +5,7 @@ import json import os from os.path import isdir, isfile, abspath +from pathlib import Path import random import re import shutil @@ -217,9 +218,18 @@ def find_pkg_dir_or_file_in_pkgs_dirs(pkg_dist, m, files_only=False): with tarfile.open(pkg_file, 'w:bz2') as archive: for entry in os.listdir(pkg_dir): archive.add(os.path.join(pkg_dir, entry), arcname=entry) - pkg_subdir = os.path.join(m.config.croot, m.config.host_subdir) + + # use the package's subdir + try: + info = json.loads(Path(pkg_dir, "info", "index.json").read_text()) + subdir = info["subdir"] + except (FileNotFoundError, KeyError): + subdir = m.config.host_subdir + + pkg_subdir = os.path.join(m.config.croot, subdir) pkg_loc = os.path.join(pkg_subdir, os.path.basename(pkg_file)) shutil.move(pkg_file, pkg_loc) + break return pkg_loc