Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source lists do not allow path in conda-build 3.28.x #5111

Closed
2 tasks done
jaimergp opened this issue Dec 12, 2023 · 2 comments · Fixed by #5112
Closed
2 tasks done

source lists do not allow path in conda-build 3.28.x #5111

jaimergp opened this issue Dec 12, 2023 · 2 comments · Fixed by #5112
Labels
locked [bot] locked due to inactivity source::contributor created by a frequent contributor type::bug describes erroneous operation, use severity::* to classify the type

Comments

@jaimergp
Copy link
Contributor

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

Seen in conda/conda-standalone#36.

This type of source metadata:

source:
  - path: ../

  - url: https://github.com/conda/conda/archive/{{ conda_version }}.tar.gz
    sha256: 9276686c8a6ee536dc451cc6557685724fe275a44949ac4f741066fd23cdc7b4
    folder: conda_src
    patches:
      - ../src/conda_patches/0001-Rename-and-replace-entrypoint-stub-exe.patch
      - ../src/conda_patches/0002-Manipulate-PATH-directly-instead-of-_call_ing-conda.patch
      - ../src/conda_patches/0003-Return-unknown-module-in-deprecations.patch

  - url: https://github.com/conda/constructor/archive/{{ constructor_version }}.tar.gz  # [win]
    sha256: 787ffd85e9414bdf70fe531f01eab3987a040e3f6a6ac3a01409f4d332f7de9e  # [win]
    folder: constructor_src  # [win]

results in this traceback:

WARNING: No index specified in get_value('source/path'). Assuming index 0.

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda/cli/main.py", line 83, in main_subshell
        exit_code = do_call(args, parser)
                    ^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 140, in do_call
        result = plugin_subcommand.action(getattr(args, "_args", args))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/plugin.py", line 10, in build
        execute(*args, **kwargs)
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/cli/main_build.py", line 572, in execute
        outputs = api.build(
                  ^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/api.py", line 2[54](https://github.com/conda/conda-standalone/actions/runs/7181452098/job/19555878864#step:5:55), in build
        return build_tree(
               ^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/build.py", line 3793, in build_tree
        packages_from_this = build(
                             ^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/build.py", line 2474, in build
        output_metas = expand_outputs([(m, need_source_download, need_reparse_in_env)])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/render.py", line 929, in expand_outputs
        for output_dict, m in deepcopy(_m).get_output_metadata_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/metadata.py", line 2[58](https://github.com/conda/conda-standalone/actions/runs/7181452098/job/19555878864#step:5:59)6, in get_output_metadata_set
        conda_packages = finalize_outputs_pass(
                         ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/metadata.py", line 949, in finalize_outputs_pass
        fm = finalize_metadata(
             ^^^^^^^^^^^^^^^^^^
      File "/usr/share/miniconda/lib/python3.11/site-packages/conda_build/render.py", line [72](https://github.com/conda/conda-standalone/actions/runs/7181452098/job/19555878864#step:5:73)6, in finalize_metadata
        m.meta["source"]["path"] = normpath(join(m.path, source_path))
        ~~~~~~~~~~~~~~~~^^^^^^^^
    TypeError: list indices must be integers or slices, not str

Reverting to conda-build=3.27 fixes the issue.

Conda Info

active environment : base
    active env location : /usr/share/miniconda
            shell level : 1
       user config file : /home/runner/.condarc
 populated config files : /home/runner/.condarc
          conda version : 23.10.0
    conda-build version : 3.28.1
         python version : 3.11.5.final.0
       virtual packages : __archspec=1=zen2
                          __glibc=2.35=0
                          __linux=6.2.0=0
                          __unix=0=0
       base environment : /usr/share/miniconda  (writable)
      conda av data dir : /usr/share/miniconda/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/runner/conda_pkgs_dir
       envs directories : /usr/share/miniconda/envs
                          /home/runner/.conda/envs
               platform : linux-64
             user-agent : conda/23.10.0 requests/2.31.0 CPython/3.11.5 Linux/6.2.0-1018-azure ubuntu/22.04.3 glibc/2.35 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.3
                UID:GID : 1001:127
             netrc file : None
           offline mode : False

Conda Config

N/A

Conda list

See https://github.com/conda/conda-standalone/actions/runs/7181452098/job/19555878864

Additional Context

No response

@jaimergp jaimergp added the type::bug describes erroneous operation, use severity::* to classify the type label Dec 12, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Dec 12, 2023
@travishathaway travishathaway added the source::contributor created by a frequent contributor label Dec 12, 2023
@kenodegard
Copy link
Contributor

This is caused by the MetaData get_section/get_value refactor #5055.

Before:

if m.meta.get("source"):
if "path" in m.meta["source"]:
source_path = m.meta["source"]["path"]
os.path.expanduser(source_path)
if not os.path.isabs(source_path):
m.meta["source"]["path"] = os.path.normpath(
os.path.join(m.path, source_path)
)
elif "git_url" in m.meta["source"] and not (
# absolute paths are not relative paths
os.path.isabs(m.meta["source"]["git_url"])
or
# real urls are not relative paths
":" in m.meta["source"]["git_url"]
):
m.meta["source"]["git_url"] = os.path.normpath(
os.path.join(m.path, m.meta["source"]["git_url"])
)

After:

if source_path := m.get_value("source/path"):
if not isabs(source_path):
m.meta["source"]["path"] = normpath(join(m.path, source_path))
elif (
(git_url := m.get_value("source/git_url"))
# absolute paths are not relative paths
and not isabs(git_url)
# real urls are not relative paths
and ":" not in git_url
):
m.meta["source"]["git_url"] = normpath(join(m.path, git_url))

Before we were testing to see if path was defined in source and since the conda-standalone recipe defines several sources it is a list (instead of a single dict) and the "path" in m.meta["source"] conditional would always return false and the code block was previously skipped.

@kenodegard
Copy link
Contributor

#5112 has been merged, patch release coming this week

@github-project-automation github-project-automation bot moved this from 🆕 New to 🏁 Done in 🧭 Planning Dec 18, 2023
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity source::contributor created by a frequent contributor type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants