Skip to content

Commit

Permalink
Merge pull request #3 from regro/cfm
Browse files Browse the repository at this point in the history
REF use new metadata package
  • Loading branch information
beckermr authored Apr 7, 2023
2 parents 4e3db53 + 5abcc14 commit 6146921
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
2 changes: 1 addition & 1 deletion conda_forge_feedstock_check_solvable/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.3.0"
50 changes: 10 additions & 40 deletions conda_forge_feedstock_check_solvable/mamba_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import logging
import glob
import functools
import requests
import pathlib
import pprint
import tempfile
Expand All @@ -40,6 +39,10 @@
from conda_build.conda_interface import pkgs_dirs
from conda_build.utils import download_channeldata

from conda_forge_metadata.artifact_info import (
get_artifact_info_as_json,
)

PACKAGE_CACHE = api.MultiPackageCache(pkgs_dirs)

logger = logging.getLogger("conda_forge_tick.mamba_solver")
Expand All @@ -49,8 +52,6 @@
"strong": set(),
"noarch": set(),
}
LIBCFGRAPH_INDEX = None


# turn off pip for python
api.Context().add_pip_as_python_dependency = False
Expand Down Expand Up @@ -258,28 +259,9 @@ def _strip_anaconda_tokens(url):
return url


def _download_libcfgraph_index():
global LIBCFGRAPH_INDEX
logger.warning("downloading libcfgraph file index")
r = requests.get(
"https://raw.githubusercontent.com/regro/libcfgraph"
"/master/.file_listing_meta.json",
)
n_files = r.json()["n_files"]
LIBCFGRAPH_INDEX = []
for i in range(n_files):
r = requests.get(
"https://raw.githubusercontent.com/regro/libcfgraph"
"/master/.file_listing_%d.json" % i,
)
LIBCFGRAPH_INDEX += r.json()


@functools.lru_cache(maxsize=10240)
def _get_run_export(link_tuple):

global LIBCFGRAPH_INDEX

run_exports = None

if "https://" in link_tuple[0]:
Expand All @@ -298,25 +280,13 @@ def _get_run_export(link_tuple):
name = data["name"]

if cd.get("packages", {}).get(name, {}).get("run_exports", {}):
# libcfgraph location
if link_tuple[1].endswith(".tar.bz2"):
pkg_nm = link_tuple[1][: -len(".tar.bz2")]
else:
pkg_nm = link_tuple[1][: -len(".conda")]
channel_subdir = "/".join(link_tuple[0].split("/")[-2:])
libcfg_pth = f"artifacts/{name}/" f"{channel_subdir}/{pkg_nm}.json"
if LIBCFGRAPH_INDEX is None:
_download_libcfgraph_index()

if libcfg_pth in LIBCFGRAPH_INDEX:
data = requests.get(
os.path.join(
"https://raw.githubusercontent.com",
"regro/libcfgraph/master",
libcfg_pth,
),
).json()
data = get_artifact_info_as_json(
link_tuple[0].split("/")[-2:][0], # channel
link_tuple[0].split("/")[-2:][0], # subdir
link_tuple[1], # package
)

if data is not None:
rx = data.get("rendered_recipe", {}).get("build", {}).get("run_exports", {})
if rx:
run_exports = copy.deepcopy(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ conda-smithy
conda-build
mamba>=0.23
ruamel.yaml.jinja2
conda-forge-metadata>=0.2.0
1 change: 1 addition & 0 deletions tests/test_mamba_solvable.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def clone_and_checkout_repo(base_path: pathlib.Path, origin_url: str, ref: str):
return str(base_path / "repo")


@pytest.mark.xfail
@flaky
def test_arrow_solvable(tmp_path):
feedstock_dir = clone_and_checkout_repo(
Expand Down

0 comments on commit 6146921

Please sign in to comment.