diff --git a/0001-Add-back-conda-and-conda_env-entry-point.patch b/0001-Add-back-conda-and-conda_env-entry-point.patch new file mode 100644 index 0000000..c91e727 --- /dev/null +++ b/0001-Add-back-conda-and-conda_env-entry-point.patch @@ -0,0 +1,29 @@ +From ce24f4787ea5647be849590f7eff6f6c1951b504 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 12 Sep 2021 21:04:40 +0200 +Subject: [PATCH 1/2] Add back conda and conda_env entry point + +Partially reverts 0ccc029997e0dc0a28420a89e0cb39c08ff0b738. +'conda init' is designed to fail and emit a warning. Go back +to the normal init. +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 84ecb55cca..bb3db39c4d 100644 +--- a/setup.py ++++ b/setup.py +@@ -86,7 +86,8 @@ setup( + }, + entry_points={ + 'console_scripts': [ +- 'conda=conda.cli.main_pip:main', ++ 'conda=conda.cli.main:main', ++ 'conda-env = conda_env.cli.main:main', + ], + }, + install_requires=install_requires, +-- +2.32.0 + diff --git a/0001-Fix-toolz-imports.patch b/0001-Fix-toolz-imports.patch new file mode 100644 index 0000000..e2e9e0b --- /dev/null +++ b/0001-Fix-toolz-imports.patch @@ -0,0 +1,81 @@ +diff --git a/conda/plan.py b/conda/plan.py +index 091ab89..855cacc 100644 +--- a/conda/plan.py ++++ b/conda/plan.py +@@ -370,7 +370,7 @@ def _plan_from_actions(actions, index): # pragma: no cover + def _inject_UNLINKLINKTRANSACTION(plan, index, prefix, axn, specs): # pragma: no cover + from os.path import isdir + from .models.dist import Dist +- from ._vendor.toolz.itertoolz import groupby ++ from ._vendor.toolz import groupby + from .instructions import LINK, PROGRESSIVEFETCHEXTRACT, UNLINK, UNLINKLINKTRANSACTION + from .core.package_cache_data import ProgressiveFetchExtract + from .core.link import PrefixSetup, UnlinkLinkTransaction +diff --git a/conda_env/env.py b/conda_env/env.py +index 27393a4..cdb16ef 100644 +--- a/conda_env/env.py ++++ b/conda_env/env.py +@@ -22,10 +22,7 @@ from conda.models.match_spec import MatchSpec + from conda.models.prefix_graph import PrefixGraph + from conda.history import History + +-try: +- from cytoolz.itertoolz import concatv, groupby +-except ImportError: # pragma: no cover +- from conda._vendor.toolz.itertoolz import concatv, groupby # NOQA ++from conda._vendor.toolz import concatv, groupby # NOQA + + + VALID_KEYS = ('name', 'dependencies', 'prefix', 'channels', 'variables') +diff --git a/tests/base/test_context.py b/tests/base/test_context.py +index 5d19c8d..9f4e7ac 100644 +--- a/tests/base/test_context.py ++++ b/tests/base/test_context.py +@@ -15,7 +15,7 @@ import pytest + + from conda.auxlib.collection import AttrDict + from conda.auxlib.ish import dals +-from conda._vendor.toolz.itertoolz import concat ++from conda._vendor.toolz import concat + from conda.base.constants import PathConflict, ChannelPriority + from conda.base.context import ( + context, +diff --git a/tests/core/test_path_actions.py b/tests/core/test_path_actions.py +index 5c6b283..7cffdd6 100644 +--- a/tests/core/test_path_actions.py ++++ b/tests/core/test_path_actions.py +@@ -16,7 +16,7 @@ from uuid import uuid4 + import pytest + + from conda.auxlib.collection import AttrDict +-from conda._vendor.toolz.itertoolz import groupby ++from conda._vendor.toolz import groupby + from conda.base.context import context + from conda.common.compat import on_win + from conda.common.path import get_bin_directory_short_path, get_python_noarch_target_path, \ +diff --git a/tests/test_activate.py b/tests/test_activate.py +index c36a9e3..6fbddec 100644 +--- a/tests/test_activate.py ++++ b/tests/test_activate.py +@@ -22,7 +22,7 @@ import pytest + from conda import __version__ as conda_version + from conda import CONDA_PACKAGE_ROOT, CONDA_SOURCE_ROOT + from conda.auxlib.ish import dals +-from conda._vendor.toolz.itertoolz import concatv ++from conda._vendor.toolz import concatv + from conda.activate import ( + CmdExeActivator, + CshActivator, +diff --git a/tests/test_create.py b/tests/test_create.py +index 952d38d..7888f33 100644 +--- a/tests/test_create.py ++++ b/tests/test_create.py +@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera + from glob import glob + + from conda.auxlib.compat import Utf8NamedTemporaryFile +-from conda._vendor.toolz.itertoolz import groupby ++from conda._vendor.toolz import groupby + from conda.gateways.disk.permissions import make_read_only + from conda.gateways.disk.create import compile_multiple_pyc + from conda.models.channel import Channel diff --git a/0001-conda_sys_prefix.patch.patch b/0001-conda_sys_prefix.patch.patch deleted file mode 100644 index 6e2c646..0000000 --- a/0001-conda_sys_prefix.patch.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7eeb6a32d2004bc20a156dd8920964c107e99321 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 30 Jul 2024 18:00:00 -0600 -Subject: [PATCH 1/2] conda_sys_prefix.patch - ---- - conda/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/conda/__init__.py b/conda/__init__.py -index 4245cae..a436b1d 100644 ---- a/conda/__init__.py -+++ b/conda/__init__.py -@@ -54,7 +54,7 @@ __summary__ = __doc__ - __url__ = "https://github.com/conda/conda" - - if os.getenv("CONDA_ROOT") is None: -- os.environ["CONDA_ROOT"] = sys.prefix -+ os.environ["CONDA_ROOT"] = '/usr/share/conda' - - #: The conda package directory. - CONDA_PACKAGE_ROOT = abspath(dirname(__file__)) --- -2.45.2 - diff --git a/0002-Go-back-to-ruamel_yaml.patch b/0002-Go-back-to-ruamel_yaml.patch new file mode 100644 index 0000000..078a526 --- /dev/null +++ b/0002-Go-back-to-ruamel_yaml.patch @@ -0,0 +1,13 @@ +diff --git a/setup.py b/setup.py +index 16f338f..a7419c3 100644 +--- a/setup.py ++++ b/setup.py +@@ -36,7 +36,7 @@ source. + install_requires = [ + "pycosat >=0.6.3", + "requests >=2.20.1", +- "ruamel_yaml_conda >=0.11.14", ++ "ruamel_yaml >=0.11.14", + "menuinst ; platform_system=='Windows'", + ] + diff --git a/0002-Use-main-entry-point-for-conda-and-re-add-conda-env-.patch b/0002-Use-main-entry-point-for-conda-and-re-add-conda-env-.patch deleted file mode 100644 index 3d3d298..0000000 --- a/0002-Use-main-entry-point-for-conda-and-re-add-conda-env-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f8f9a23a2a7540ec39cab9606f8b95aa8b346b65 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Mon, 24 Nov 2025 17:30:20 -0700 -Subject: [PATCH 2/2] Use main entry point for conda and re-add conda-env entry - ---- - pyproject.toml | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/pyproject.toml b/pyproject.toml -index 7c8f24f..049859b 100644 ---- a/pyproject.toml -+++ b/pyproject.toml -@@ -51,7 +51,8 @@ readme = "README.md" - requires-python = ">=3.10" - - [project.scripts] --conda = "conda.cli.main_pip:main" -+conda = "conda.cli.main:main" -+conda-env = "conda_env.cli.main:main" - - [project.urls] - changelog = "https://github.com/conda/conda/blob/main/CHANGELOG.md" --- -2.51.1 - diff --git a/0004-Do-not-try-to-run-usr-bin-python.patch b/0004-Do-not-try-to-run-usr-bin-python.patch index f747eb0..7a055a5 100644 --- a/0004-Do-not-try-to-run-usr-bin-python.patch +++ b/0004-Do-not-try-to-run-usr-bin-python.patch @@ -1,24 +1,25 @@ -diff -up conda-24.9.1/conda/common/path/python.py.python conda-24.9.1/conda/common/path/python.py ---- conda-24.9.1/conda/common/path/python.py.python 2024-10-01 15:11:32.000000000 -0600 -+++ conda-24.9.1/conda/common/path/python.py 2024-10-07 21:43:44.951895698 -0600 -@@ -5,6 +5,7 @@ - from __future__ import annotations - - import re -+import sys +diff --git a/conda/common/path.py b/conda/common/path.py +index 510f15f..e9e3195 100644 +--- a/conda/common/path.py ++++ b/conda/common/path.py +@@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera + from functools import lru_cache, reduce from logging import getLogger - from os.path import join, split, splitext - -@@ -52,9 +53,11 @@ def parse_entry_point_def(ep_definition) + import os ++import sys + from os.path import abspath, basename, expanduser, expandvars, join, normcase, split, splitext + import re + import subprocess +@@ -155,9 +156,11 @@ def parse_entry_point_def(ep_definition): def get_python_short_path(python_version=None): if on_win: return "python.exe" -- if python_version and "." not in python_version: +- if python_version and '.' not in python_version: + if not python_version: + return sys.executable + if '.' not in python_version: - python_version = ".".join(python_version) -- return join("bin", "python%s" % (python_version or "")) + python_version = '.'.join(python_version) +- return join("bin", "python%s" % (python_version or '')) + return join("bin", "python" + python_version) diff --git a/0005-Fix-failing-tests-in-test_api.py.patch b/0005-Fix-failing-tests-in-test_api.py.patch index b5e2f95..7434f7b 100644 --- a/0005-Fix-failing-tests-in-test_api.py.patch +++ b/0005-Fix-failing-tests-in-test_api.py.patch @@ -1,5 +1,21 @@ +From 4bc8b4ec9579e7c015a6ad5b41031c850596e0fb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 21 Sep 2018 10:23:39 +0200 +Subject: [PATCH] Fix failing tests in test_api.py +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Based on commit 0722e2edc93ae818bddd18f23be5b18c3a2a1d55 by +Kale Franz . + +Signed-off-by: Zbigniew Jędrzejewski-Szmek +--- + tests/test_api.py | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + diff --git a/tests/test_api.py b/tests/test_api.py -index dd6a7b9..c60d1a1 100644 +index 3ca97be734..e866e82fd3 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -224,7 +224,7 @@ def test_PackageCacheData_return_value_contract(): @@ -11,7 +27,7 @@ index dd6a7b9..c60d1a1 100644 first_writable_result = PackageCacheData.first_writable() assert isinstance(first_writable_result, PackageCacheData) -@@ -265,13 +265,14 @@ def test_PrefixData_contract(): +@@ -269,20 +269,21 @@ def test_PrefixData_contract(): def test_PrefixData_return_value_contract(): pd = PrefixData(context.conda_prefix) @@ -23,17 +39,16 @@ index dd6a7b9..c60d1a1 100644 + get_result = pd.get(PackageRecord.from_objects(single_prefix_rec)) + assert isinstance(get_result, PrefixRecord) -- query_result = pd.query("openssl") +- query_result = pd.query('openssl') - assert isinstance(query_result, tuple) - assert all(isinstance(prefix_rec, PrefixRecord) for prefix_rec in query_result) -+ query_result = pd.query("openssl") ++ query_result = pd.query('openssl') + assert isinstance(query_result, tuple) + assert all(isinstance(prefix_rec, PrefixRecord) for prefix_rec in query_result) iter_records_result = pd.iter_records() assert isiterable(iter_records_result) -@@ -280,7 +281,7 @@ def test_PrefixData_return_value_contract(): - ) + assert all(isinstance(prefix_rec, PrefixRecord) for prefix_rec in iter_records_result) is_writable_result = pd.is_writable - assert is_writable_result is True or is_writable_result is False @@ -41,3 +56,6 @@ index dd6a7b9..c60d1a1 100644 reload_result = pd.reload() assert isinstance(reload_result, PrefixData) +-- +2.19.2 + diff --git a/0006-shell-assume-shell-plugins-are-in-etc.patch b/0006-shell-assume-shell-plugins-are-in-etc.patch index 68c60df..790aeb6 100644 --- a/0006-shell-assume-shell-plugins-are-in-etc.patch +++ b/0006-shell-assume-shell-plugins-are-in-etc.patch @@ -1,72 +1,32 @@ diff --git a/conda/activate.py b/conda/activate.py -index f79a03f..951bed4 100644 +index e1b1812..567140f 100644 --- a/conda/activate.py +++ b/conda/activate.py -@@ -914,13 +914,7 @@ class PosixActivator(_Activator): - set_var_tmpl = "%s='%s'" - run_script_tmpl = ". \"`cygpath '%s'`\"" if on_win else '. "%s"' +@@ -825,7 +825,7 @@ class PosixActivator(_Activator): + self.set_var_tmpl = "%s='%s'" + self.run_script_tmpl = '. "%s"' -- hook_source_path = Path( -- CONDA_PACKAGE_ROOT, -- "shell", -- "etc", -- "profile.d", -- "conda.sh", -- ) -+ hook_source_path = Path("/etc/profile.d/conda.sh") - inline_hook_source = True +- self.hook_source_path = join(CONDA_PACKAGE_ROOT, 'shell', 'etc', 'profile.d', 'conda.sh') ++ self.hook_source_path = '/etc/profile.d/conda.sh' - def _update_prompt(self, set_vars, conda_prompt_modifier): -@@ -956,13 +950,7 @@ class CshActivator(_Activator): - set_var_tmpl = "set %s='%s'" - run_script_tmpl = "source \"`cygpath '%s'`\"" if on_win else 'source "%s"' + super(PosixActivator, self).__init__(arguments) -- hook_source_path = Path( -- CONDA_PACKAGE_ROOT, -- "shell", -- "etc", -- "profile.d", -- "conda.csh", -- ) -+ hook_source_path = Path("/etc/profile.d/conda.csh") - # TCSH/CSH removes newlines when doing command substitution (see `man tcsh`), - # source conda.csh directly and use line terminators to separate commands - inline_hook_source = False -@@ -1001,7 +989,7 @@ class XonshActivator(_Activator): - else 'source-bash --suppress-skip-message -n "%s"' - ) +@@ -882,7 +882,7 @@ class CshActivator(_Activator): + self.set_var_tmpl = "set %s='%s'" + self.run_script_tmpl = 'source "%s"' -- hook_source_path = Path(CONDA_PACKAGE_ROOT, "shell", "conda.xsh") -+ hook_source_path = Path("/etc/profile.d/conda.xsh") - inline_hook_source = True +- self.hook_source_path = join(CONDA_PACKAGE_ROOT, 'shell', 'etc', 'profile.d', 'conda.csh') ++ self.hook_source_path = '/etc/profile.d/conda.csh' - def template_path_var(self, key: str, value: str) -> str: -@@ -1055,14 +1043,7 @@ class FishActivator(_Activator): - set_var_tmpl = 'set -g %s "%s"' - run_script_tmpl = 'source "%s"' + super(CshActivator, self).__init__(arguments) -- hook_source_path = Path( -- CONDA_PACKAGE_ROOT, -- "shell", -- "etc", -- "fish", -- "conf.d", -- "conda.fish", -- ) -+ hook_source_path = Path("/etc/fish/conf.d/conda.fish") - inline_hook_source = True +@@ -993,8 +993,7 @@ class FishActivator(_Activator): + self.set_var_tmpl = 'set -g %s "%s"' + self.run_script_tmpl = 'source "%s"' +- self.hook_source_path = join(CONDA_PACKAGE_ROOT, 'shell', 'etc', 'fish', 'conf.d', +- 'conda.fish') ++ self.hook_source_path = '/etc/fish/conf.d/conda.fish' -diff --git a/conda/base/context.py b/conda/base/context.py -index adf6d6e..612ea4a 100644 ---- a/conda/base/context.py -+++ b/conda/base/context.py -@@ -848,7 +848,7 @@ class Context(Configuration): - def av_data_dir(self) -> PathType: - """Where critical artifact verification data (e.g., various public keys) can be found.""" - # TODO (AV): Find ways to make this user configurable? -- return join(self.conda_prefix, "etc", "conda") -+ return '/etc/conda' + super(FishActivator, self).__init__(arguments) - @property - def signing_metadata_url_base(self) -> str | None: diff --git a/11632.patch b/11632.patch new file mode 100644 index 0000000..9cc23dd --- /dev/null +++ b/11632.patch @@ -0,0 +1,112 @@ +From c4b3c8976c7eeeaf960f6116af0fbf5af7cd3b3e Mon Sep 17 00:00:00 2001 +From: Orion Poplawski +Date: Sun, 17 Jul 2022 21:05:34 -0600 +Subject: [PATCH] Use updated ruamel.yaml API + +--- + conda/common/serialize.py | 52 +++++++++++++++++++++++++-------------- + conda_env/env.py | 6 +---- + 2 files changed, 34 insertions(+), 24 deletions(-) + +diff --git a/conda/common/serialize.py b/conda/common/serialize.py +index d850ce6700..43153f1bcd 100644 +--- a/conda/common/serialize.py ++++ b/conda/common/serialize.py +@@ -20,14 +20,15 @@ def get_yaml(): + except ImportError: # pragma: no cover + try: + import ruamel.yaml as yaml ++ from ruamel.yaml.compat import StringIO + except ImportError: + raise ImportError("No yaml library available.\n" + "To proceed, conda install " + "ruamel_yaml") +- return yaml ++ return (yaml, StringIO) + + +-yaml = get_yaml() ++(yaml, StringIO) = get_yaml() + + + def represent_ordereddict(dumper, data): +@@ -47,7 +48,8 @@ def represent_ordereddict(dumper, data): + + + def yaml_round_trip_load(string): +- return yaml.round_trip_load(string, version="1.2") ++ yinst = yaml.YAML(typ='rt') ++ return yinst.load(string) + + + def yaml_safe_load(string): +@@ -57,22 +59,34 @@ def yaml_safe_load(string): + {'key': 'value'} + + """ +- return yaml.safe_load(string, version="1.2") +- +- +-def yaml_round_trip_dump(object): +- """dump object to string""" +- return yaml.round_trip_dump( +- object, block_seq_indent=2, default_flow_style=False, indent=2 +- ) +- +- +-def yaml_safe_dump(object): +- """dump object to string""" +- return yaml.safe_dump( +- object, block_seq_indent=2, default_flow_style=False, indent=2 +- ) +- ++ yinst=yaml.YAML(typ='safe', pure=True) ++ return yinst.load(string) ++ ++ ++def yaml_round_trip_dump(object, stream=None): ++ """dump object to string or stream""" ++ yinst = yaml.YAML(typ='rt') ++ yinst.indent(mapping=2, offset=2, sequence=4) ++ inefficient = False ++ if stream is None: ++ inefficient = True ++ stream = StringIO() ++ yinst.dump(object, stream) ++ if inefficient: ++ return stream.getvalue() ++ ++def yaml_safe_dump(object, stream=None): ++ """dump object to string or stream""" ++ yinst=yaml.YAML(typ='safe', pure=True) ++ yinst.indent(mapping=2, offset=2, sequence=4) ++ yinst.default_flow_style = False ++ inefficient = False ++ if stream is None: ++ inefficient = True ++ stream = StringIO() ++ yinst.dump(object, stream) ++ if inefficient: ++ return stream.getvalue() + + def json_load(string): + return json.loads(string) +diff --git a/conda_env/env.py b/conda_env/env.py +index c494b3d855..142731ada9 100644 +--- a/conda_env/env.py ++++ b/conda_env/env.py +@@ -257,13 +257,9 @@ def to_dict(self, stream=None): + + def to_yaml(self, stream=None): + d = self.to_dict() +- out = yaml_safe_dump(d) ++ out = yaml_safe_dump(d, stream) + if stream is None: + return out +- try: +- stream.write(bytes(out, encoding="utf-8")) +- except TypeError: +- stream.write(out) + + def save(self): + with open(self.filename, "wb") as fp: diff --git a/conda b/conda index 37bab57..0309bad 100644 --- a/conda +++ b/conda @@ -37,9 +37,8 @@ function __comp_conda_ensure_root() { : import conda : print(os.path.dirname(conda.__file__)) " - script="${script// : /}" # don't assume an active base environment - CONDA_SOURCE=$(conda activate base; python -c "$script") + CONDA_SOURCE=$(conda activate base; python -c "${script// : /}") fi } @@ -52,49 +51,40 @@ function __comp_conda_commands () { echo activate deactivate # check commands from full anaconda install - for f in "$CONDA_SOURCE"/cli/main_*.py + for f in $CONDA_SOURCE/cli/main_*.py do # skip pip -- not a sub-command - [[ "$f" == */main_pip.py ]] && continue - if [[ "$f" =~ .*_([a-z]+)\.py$ ]]; then - echo "${BASH_REMATCH[1]}" - fi + [[ $f == */main_pip.py ]] && continue + \expr match "$f" '.*_\([a-z]\+\)\.py$' done # check extra pluggins - for f in "$CONDA_ROOT"/bin/conda-* + for f in $CONDA_ROOT/bin/conda-* do if [[ -x "$f" && ! -d "$f" ]] then - if [[ "$f" =~ .*/conda-(.*) ]]; then - echo "${BASH_REMATCH[1]}" - fi + \expr match "$f" '^.*/conda-\(.*\)' fi done } function __comp_conda_env_commands() { - for f in "$CONDA_SOURCE"/../conda_env/cli/main_*.py + for f in $CONDA_SOURCE/../conda_env/cli/main_*.py do - [[ "$f" == */main_vars.py ]] && continue - if [[ "$f" =~ .*_([a-z]+)\.py$ ]]; then - echo "${BASH_REMATCH[1]}" - fi + \expr match "$f" '.*_\([a-z]\+\)\.py$' done } function __comp_conda_envs() { \local script=" - : from __future__ import print_function - : import json, os, sys - : from os.path import isdir, join + : from __future__ import print_function; + : import json, os, sys; + : from os.path import isdir, join; : print('\n'.join( : d for ed in json.load(sys.stdin)['envs_dirs'] if isdir(ed) - : for d in os.listdir(ed) if isdir(join(ed, d))) - : ) + : for d in os.listdir(ed) if isdir(join(ed, d)))); " - script="${script// : /}" - conda config --json --show envs_dirs | $CONDA_PYTHON_EXE -c "$script" + conda config --json --show envs_dirs | python -c "${script// : /}" } function __comp_conda_packages() { @@ -105,13 +95,13 @@ function __comp_conda_cmds_str() { # get a list of commands, skipping options \local cmd \local -a cmds - for cmd in "$@"; do + for cmd in $*; do case "$cmd" in -*) continue ;; - *) cmds+=("$cmd") ;; + *) cmds+=($cmd) ;; esac done - echo "${cmds[@]}" + echo "${cmds[*]}" } # helper for debugging issues with the cache @@ -145,7 +135,7 @@ function __comp_conda_option_lookup() { else word_list=${__comp_conda_cache[$cmd_key]} fi - echo "$word_list" + echo $word_list } # cache conda subcommand help lookups for the duration of the shell @@ -159,7 +149,6 @@ __comp_conda_ensure_root 2>/dev/null || : _comp_conda() { - # shellcheck disable=SC2034 \local cur prev words cword _init_completion || return @@ -168,7 +157,7 @@ _comp_conda() \local word_list cmd_str if [[ $cur == -* ]]; then # get the current list of commands as a string sans options - cmd_str=$(__comp_conda_cmds_str "${words[@]}") + cmd_str="$(__comp_conda_cmds_str ${words[@]})" word_list=$(__comp_conda_option_lookup "$cmd_str") else case "$prev" in @@ -179,12 +168,8 @@ _comp_conda() word_list=$(__comp_conda_env_commands 2>/dev/null) ;; activate) - if [[ $cur == */* ]] - then - _filedir -d # environment directories - else - word_list=$(__comp_conda_envs 2>/dev/null) - fi + _filedir -d # environment directories + word_list=$(__comp_conda_envs 2>/dev/null) ;; remove|uninstall|upgrade|update) word_list=$(__comp_conda_packages 2>/dev/null) @@ -208,9 +193,7 @@ _comp_conda() esac fi if [[ -n $word_list ]]; then - # append completion suggestions to COMPREPLY - mapfile -t -O "${#COMPREPLY[@]}" COMPREPLY < \ - <(compgen -W "$word_list" -- "$cur") + COMPREPLY+=( $(compgen -W "$word_list" -- "$cur") ) fi } && complete -F _comp_conda conda diff --git a/conda-32bit.patch b/conda-32bit.patch new file mode 100644 index 0000000..b40d819 --- /dev/null +++ b/conda-32bit.patch @@ -0,0 +1,20 @@ +diff -up conda-4.8.4/tests/core/test_solve.py.32bit conda-4.8.4/tests/core/test_solve.py +--- conda-4.8.4/tests/core/test_solve.py.32bit 2020-08-06 15:02:52.000000000 -0600 ++++ conda-4.8.4/tests/core/test_solve.py 2020-08-07 19:12:28.240154100 -0600 +@@ -284,14 +284,14 @@ def test_cuda_fail_1(tmpdir): + if sys.platform == "darwin": + plat = "osx-64" + elif sys.platform == "linux": +- plat = "linux-64" ++ plat = "linux-%s" % platform.architecture()[0][0:2] + elif sys.platform == "win32": + if platform.architecture()[0] == "32bit": + plat = "win-32" + else: + plat = "win-64" + else: +- plat = "linux-64" ++ plat = "linux-%s" % platform.architecture()[0][0:2] + + assert str(exc.value).strip() == dals("""The following specifications were found to be incompatible with your system: + diff --git a/conda-conda-build.patch b/conda-conda-build.patch new file mode 100644 index 0000000..75ddbcd --- /dev/null +++ b/conda-conda-build.patch @@ -0,0 +1,29 @@ +diff --git a/tests/conftest.py b/tests/conftest.py +index 0f91d86..9e0a3c3 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -14,24 +14,6 @@ pytest_plugins = ( + ) + + +-def _conda_build_recipe(recipe): +- subprocess.run( +- ["conda-build", str(Path(__file__).resolve().parent / "test-recipes" / recipe)], +- check=True, +- ) +- return recipe +- +- +-@pytest.fixture(scope="session") +-def activate_deactivate_package(): +- return _conda_build_recipe("activate_deactivate_package") +- +- +-@pytest.fixture(scope="session") +-def pre_link_messages_package(): +- return _conda_build_recipe("pre_link_messages_package") +- +- + @pytest.fixture + def clear_cache(): + from conda.core.subdir_data import SubdirData diff --git a/conda-cpuinfo.patch b/conda-cpuinfo.patch new file mode 100644 index 0000000..3ba2119 --- /dev/null +++ b/conda-cpuinfo.patch @@ -0,0 +1,13 @@ +diff --git a/conda/base/context.py b/conda/base/context.py +index 74758d8..ccfb426 100644 +--- a/conda/base/context.py ++++ b/conda/base/context.py +@@ -1698,7 +1698,7 @@ conda_tests_ctxt_mgmt_def_pol = replace_context_default + @lru_cache(maxsize=None) + def _get_cpu_info(): + # DANGER: This is rather slow +- from .._vendor.cpuinfo import get_cpu_info ++ from cpuinfo import get_cpu_info + return frozendict(get_cpu_info()) + + diff --git a/conda-mock.patch b/conda-mock.patch new file mode 100644 index 0000000..87b275f --- /dev/null +++ b/conda-mock.patch @@ -0,0 +1,25 @@ +diff --git a/tests/test_cli.py b/tests/test_cli.py +index eaa9b7e..dc8d027 100644 +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -7,7 +7,7 @@ import unittest + import uuid + import os + import stat +-from mock import patch ++from unittest.mock import patch + + import pytest + +diff -up conda-4.14.0/tests/cli/test_main_rename.py.mock conda-4.14.0/tests/cli/test_main_rename.py +--- conda-4.14.0/tests/cli/test_main_rename.py.mock 2022-08-03 15:00:36.000000000 -0600 ++++ conda-4.14.0/tests/cli/test_main_rename.py 2022-08-05 17:55:40.679594723 -0600 +@@ -4,7 +4,7 @@ + from __future__ import annotations + + import json +-import mock ++from unittest import mock + import os.path + import pathlib + import tempfile diff --git a/conda.spec b/conda.spec index 5e7e2c3..473fd67 100644 --- a/conda.spec +++ b/conda.spec @@ -1,38 +1,53 @@ %bcond_without tests Name: conda -Version: 25.11.1 +Version: 4.14.0 Release: %autorelease Summary: Cross-platform, Python-agnostic binary package manager -License: BSD-3-Clause AND Apache-2.0 -# The conda code is BSD-3-Clause -# adapters/ftp.py is Apache-2.0 +License: BSD and ASL 2.0 and LGPLv2+ and MIT +# The conda code is BSD +# progressbar is LGPLv2+ +# six is MIT/X11 +# adapters/ftp.py is ASL 2.0 URL: http://conda.pydata.org/docs/ Source0: https://github.com/conda/conda/archive/%{version}/%{name}-%{version}.tar.gz # bash completion script moved to a separate project -Source1: https://raw.githubusercontent.com/tartansandal/conda-bash-completion/1.7/conda -Patch0: 0001-conda_sys_prefix.patch.patch -# Use main entry point for conda and re-add conda-env entry point, no need to run conda init -Patch1: 0002-Use-main-entry-point-for-conda-and-re-add-conda-env-.patch +Source1: https://raw.githubusercontent.com/tartansandal/conda-bash-completion/1.5/conda +Patch0: conda_sys_prefix.patch +Patch1: conda_gateways_disk_create.patch +# Do not test with conda-build +Patch2: conda-conda-build.patch +# Use system cpuinfo +Patch3: conda-cpuinfo.patch +# Fix tests on 32bit +# https://github.com/conda/conda/pull/9759 +Patch4: conda-32bit.patch +# Fix mock import +Patch5: conda-mock.patch +# Use new (0.15) ruamel-yaml API +Patch6: https://patch-diff.githubusercontent.com/raw/conda/conda/pull/11632.patch +Patch10001: 0001-Fix-toolz-imports.patch Patch10004: 0004-Do-not-try-to-run-usr-bin-python.patch Patch10005: 0005-Fix-failing-tests-in-test_api.py.patch Patch10006: 0006-shell-assume-shell-plugins-are-in-etc.patch +Patch10007: 0001-Add-back-conda-and-conda_env-entry-point.patch +Patch10008: 0002-Go-back-to-ruamel_yaml.patch BuildArch: noarch BuildRequires: pkgconfig(bash-completion) %global bash_completionsdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null || echo '/etc/bash_completion.d') BuildRequires: sed -# For man pages -BuildRequires: python-conda-sphinx-theme Requires: python%{python3_pkgversion}-conda = %{version}-%{release} # Removed upstream in favour of calling "conda activate" in version 4.4.0 Obsoletes: conda-activate < 4.4 +%?python_enable_dependency_generator + %global _description %{expand: Conda is a cross-platform, Python-agnostic binary package manager. It @@ -48,54 +63,83 @@ can only use conda to create and manage new environments.} %description %_description - -%package tests -Summary: conda tests - -%description tests -Data for conda tests. Set CONDA_TEST_DATA_DIR to -%{_datadir}/conda/tests/data. +%global _py3_reqs \ + python%{python3_pkgversion}-cpuinfo \ + python%{python3_pkgversion}-conda-package-handling >= 1.3.0 \ + python%{python3_pkgversion}-distro >= 1.0.4 \ + python%{python3_pkgversion}-frozendict >= 1.2 \ + python%{python3_pkgversion}-pycosat >= 0.6.3 \ + python%{python3_pkgversion}-pyOpenSSL >= 16.2.0 \ + python%{python3_pkgversion}-pyyaml \ + python%{python3_pkgversion}-requests >= 2.18.4 \ + python%{python3_pkgversion}-ruamel-yaml >= 0.11.14 \ + python%{python3_pkgversion}-tqdm >= 4.22.0 \ + python%{python3_pkgversion}-urllib3 >= 1.19.1 +%global py3_reqs %(c="%_py3_reqs"; echo "$c" | xargs) %package -n python%{python3_pkgversion}-conda Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: %py3_reqs +# When this is present, vendored toolz should not be used +%if 0%{?fedora} || 0%{?rhel} >= 8 +# EPEL7 does not have new enough cytoolz +BuildRequires: python%{python3_pkgversion}-cytoolz >= 0.8.2 +%endif # For tests BuildRequires: python-unversioned-command -BuildRequires: python%{python3_pkgversion}-boltons BuildRequires: python%{python3_pkgversion}-boto3 -BuildRequires: python%{python3_pkgversion}-conda-libmamba-solver -BuildRequires: python%{python3_pkgversion}-flask -BuildRequires: python%{python3_pkgversion}-jsonpatch -BuildRequires: python%{python3_pkgversion}-libmambapy -BuildRequires: python%{python3_pkgversion}-pexpect -BuildRequires: python%{python3_pkgversion}-pytest-mock BuildRequires: python%{python3_pkgversion}-pytest-rerunfailures -BuildRequires: python%{python3_pkgversion}-pytest-split BuildRequires: python%{python3_pkgversion}-pytest-timeout BuildRequires: python%{python3_pkgversion}-pytest-xprocess BuildRequires: python%{python3_pkgversion}-responses -# conda uses a modified version of auxlib -Provides: bundled(python%{python3_pkgversion}-auxlib) = 0.0.43 +Requires: %py3_reqs +%if 0%{?fedora} || 0%{?rhel} >= 8 +# EPEL does not have new enough cytoolz +Requires: python%{python3_pkgversion}-cytoolz >= 0.8.2 +%endif +Provides: bundled(python%{python3_pkgversion}-appdirs) = 1.2.0 +Provides: bundled(python%{python3_pkgversion}-auxlib) +Provides: bundled(python%{python3_pkgversion}-boltons) = 18.0.0 +Provides: bundled(python%{python3_pkgversion}-six) = 1.10.0 +Provides: bundled(python%{python3_pkgversion}-toolz) = 0.8.2 + +%{?python_provide:%python_provide python%{python3_pkgversion}-conda} %description -n python%{python3_pkgversion}-conda %_description %prep %autosetup -p1 -# Re-enable dep on conda-libmamba-solver -sed -i -e '/"conda-libmamba-solver/s/# *//' pyproject.toml +sed -r -i 's/^(__version__ = ).*/\1"%{version}"/' conda/__init__.py +# xdoctest not packaged +sed -i -e '/xdoctest/d' setup.cfg -# Do not restrict upper bound of ruamel-yaml -sed -i -e '/ruamel.yaml/s/,<[0-9.]*//' pyproject.toml +# delete interpreter line, the user can always call the file +# explicitly as python3 /usr/lib/python3.6/site-packages/conda/_vendor/appdirs.py +# or so. +sed -r -i '1 {/#![/]usr[/]bin[/]env/d}' conda/_vendor/appdirs.py -# pytest-split/xdoctest not packaged, store-duration not needed -sed -i -e '/splitting-algorithm/d' -e '/store-durations/d' -e '/xdoctest/d' pyproject.toml +# Use Fedora's cpuinfo since it supports more arches +rm -r conda/_vendor/cpuinfo -# Unpackaged - really only applicable for macOS/Windows? -sed -i -e '/"truststore *>/d' pyproject.toml +# Replaced by cytools, byte compilation fails under python3.7 +%if 0%{?fedora} || 0%{?rhel} >= 8 +# EPEL does not have new enough cytoolz +# We need to keep __init__.py which does the dispatch between vendored and non-vendored +rm conda/_vendor/toolz/[a-zA-Z]* +%endif + +# Use system versions +# TODO - urllib3 - results in test failures: https://github.com/conda/conda/issues/9512 +#rm -r conda/_vendor/{distro.py,frozendict.py,tqdm,urllib3} +#find conda -name \*.py | xargs sed -i -e 's/^\( *\)from .*_vendor\.\(\(distro\|frozendict\|tqdm\|urllib3\).*\) import/\1from \2 import/' +rm -r conda/_vendor/{distro.py,frozendict,tqdm} +find conda -name \*.py | xargs sed -i -e 's/^\( *\)from .*_vendor\.\(\(distro\|frozendict\|tqdm\).*\) import/\1from \2 import/' %ifnarch x86_64 # Tests on 32-bit @@ -106,47 +150,36 @@ cp -a tests/data/conda_format_repo/{linux-64,%{python3_platform}} sed -i -e s/linux-64/%{python3_platform}/ tests/data/conda_format_repo/%{python3_platform}/*json %endif -# Do not run coverage in pytest -sed -i -e '/"--cov/d' pyproject.toml +# do not run coverage in pytest +sed -i -E '/--(no-)?cov/d' setup.cfg -%generate_buildrequires -# When not testing, we don't need runtime dependencies. -# Normally, we would still BuildRequire them to not accidentally build an uninstallable package, -# but there is a runtime dependency loop with python3-conda-libmamba-solver. -%pyproject_buildrequires %{!?with_tests:-R} %build -%pyproject_wheel +# build conda executable +%py3_build %install -%pyproject_install -#py3_shebang_fix %{buildroot}%{python3_sitelib}/conda/shell/bin/conda -%pyproject_save_files conda* +# install conda executable +%py3_install mkdir -p %{buildroot}%{_sysconfdir}/conda/condarc.d mkdir -p %{buildroot}%{_datadir}/conda/condarc.d cat >%{buildroot}%{_datadir}/conda/condarc.d/defaults.yaml <