diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d9f8db --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.build-*.log +/conda-*.tar.gz diff --git a/0001-conda_sys_prefix.patch.patch b/0001-conda_sys_prefix.patch.patch new file mode 100644 index 0000000..6e2c646 --- /dev/null +++ b/0001-conda_sys_prefix.patch.patch @@ -0,0 +1,25 @@ +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-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 new file mode 100644 index 0000000..3d3d298 --- /dev/null +++ b/0002-Use-main-entry-point-for-conda-and-re-add-conda-env-.patch @@ -0,0 +1,26 @@ +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 new file mode 100644 index 0000000..f747eb0 --- /dev/null +++ b/0004-Do-not-try-to-run-usr-bin-python.patch @@ -0,0 +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 + from logging import getLogger + from os.path import join, split, splitext + +@@ -52,9 +53,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 not python_version: ++ return sys.executable ++ if '.' not in python_version: + python_version = ".".join(python_version) +- return join("bin", "python%s" % (python_version or "")) ++ return join("bin", "python" + python_version) + + + def get_python_site_packages_short_path(python_version): diff --git a/0005-Fix-failing-tests-in-test_api.py.patch b/0005-Fix-failing-tests-in-test_api.py.patch new file mode 100644 index 0000000..b5e2f95 --- /dev/null +++ b/0005-Fix-failing-tests-in-test_api.py.patch @@ -0,0 +1,43 @@ +diff --git a/tests/test_api.py b/tests/test_api.py +index dd6a7b9..c60d1a1 100644 +--- a/tests/test_api.py ++++ b/tests/test_api.py +@@ -224,7 +224,7 @@ def test_PackageCacheData_return_value_contract(): + assert all(isinstance(pcrec, PackageCacheRecord) for pcrec in iter_records_result) + + is_writable_result = pc.is_writable +- assert is_writable_result is True or is_writable_result is False ++ assert is_writable_result in {True, False, None} + + first_writable_result = PackageCacheData.first_writable() + assert isinstance(first_writable_result, PackageCacheData) +@@ -265,13 +265,14 @@ def test_PrefixData_contract(): + def test_PrefixData_return_value_contract(): + pd = PrefixData(context.conda_prefix) + +- single_prefix_rec = next(pd.iter_records()) +- get_result = pd.get(PackageRecord.from_objects(single_prefix_rec)) +- assert isinstance(get_result, PrefixRecord) ++ single_prefix_rec = next(pd.iter_records(), None) ++ if single_prefix_rec: ++ get_result = pd.get(PackageRecord.from_objects(single_prefix_rec)) ++ assert isinstance(get_result, PrefixRecord) + +- 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") ++ 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(): + ) + + is_writable_result = pd.is_writable +- assert is_writable_result is True or is_writable_result is False ++ assert is_writable_result in {True, False, None} + + reload_result = pd.reload() + assert isinstance(reload_result, PrefixData) diff --git a/0006-shell-assume-shell-plugins-are-in-etc.patch b/0006-shell-assume-shell-plugins-are-in-etc.patch new file mode 100644 index 0000000..68c60df --- /dev/null +++ b/0006-shell-assume-shell-plugins-are-in-etc.patch @@ -0,0 +1,72 @@ +diff --git a/conda/activate.py b/conda/activate.py +index f79a03f..951bed4 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"' + +- 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 + + 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"' + +- 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"' + ) + +- hook_source_path = Path(CONDA_PACKAGE_ROOT, "shell", "conda.xsh") ++ hook_source_path = Path("/etc/profile.d/conda.xsh") + inline_hook_source = True + + 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"' + +- 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 + + +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' + + @property + def signing_metadata_url_base(self) -> str | None: diff --git a/changelog b/changelog new file mode 100644 index 0000000..bbd1d34 --- /dev/null +++ b/changelog @@ -0,0 +1,202 @@ +* Wed Jul 21 2021 Fedora Release Engineering - 4.10.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 4.10.1-2 +- Rebuilt for Python 3.10 + +* Thu Apr 15 2021 Orion Poplawski - 4.10.1-1 +- Update to 4.10.1 + +* Fri Apr 02 2021 Orion Poplawski - 4.10.0-1 +- Update to 4.10.0 + +* Tue Jan 26 2021 Orion Poplawski - 4.9.2-3 +- Add patch to support python 3.10 + +* Tue Jan 26 2021 Fedora Release Engineering - 4.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Nov 11 2020 Orion Poplawski - 4.9.2-1 +- Update to 4.9.2 + +* Tue Oct 27 2020 Orion Poplawski - 4.9.1-1 +- Update to 4.9.1 + +* Sun Oct 18 2020 Orion Poplawski - 4.9.0-1 +- Update to 4.9.0 + +* Mon Sep 21 2020 Orion Poplawski - 4.8.5-2 +- Add note to description about base environment + +* Mon Sep 14 2020 Orion Poplawski - 4.8.5-1 +- Update to 4.8.5 +- Install conda.fish (bz#1878306) + +* Sat Aug 08 2020 Orion Poplawski - 4.8.4-1 +- Update to 4.8.4 + +* Sat Aug 01 2020 Fedora Release Engineering - 4.8.3-4 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 4.8.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 4.8.3-2 +- Rebuilt for Python 3.9 + +* Sun Mar 15 2020 Orion Poplawski - 4.8.3-1 +- Update to 4.8.3 + +* Tue Feb 4 2020 Zbigniew Jędrzejewski-Szmek - 4.8.2-2 +- Fix import for python3.9 compatiblity (#1797691) + +* Tue Jan 28 2020 Orion Poplawski - 4.8.2-1 +- Update to 4.8.2 (#1785658) +- Obtain bash completion file from github - tartansandal/conda-bash-completion + +* Mon Jan 20 2020 Orion Poplawski - 4.8.0-2 +- Install bash completion file (bz#1791068) + +* Sat Dec 14 2019 Orion Poplawski - 4.8.0-1 +- Update to 4.8.0 +- Make "conda shell.bash hook" work (bz#1737165) +- Unbundle more libraries + +* Sat Sep 14 2019 Orion Poplawski - 4.7.12-1 +- Update to 4.7.12 + +* Mon Aug 19 2019 Miro Hrončok - 4.7.11-2 +- Rebuilt for Python 3.8 + +* Fri Aug 16 2019 Orion Poplawski - 4.7.11-1 +- Update to 4.7.11 +- Use system py-cpuinfo + +* Fri Aug 16 2019 Orion Poplawski - 4.7.10-2 +- Cleanup requires some (drop crypto, yaml; add pyOpenSSL; + add versions for requests and ruamel-yaml + +* Sat Aug 3 2019 Zbigniew Jędrzejewski-Szmek - 4.7.10-1 +- Fix 'conda shell.* hook' invocations (#1737165) + +* Wed Jul 31 2019 Orion Poplawski - 4.7.10-1 +- Update to 4.7.10 + +* Mon Jul 29 2019 Zbigniew Jędrzejewski-Szmek - 4.7.6-1 +- Update to latest version (#1678578) + +* Wed Jul 24 2019 Fedora Release Engineering - 4.7.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jun 11 2019 Orion Poplawski - 4.7.2-1 +- Update to 4.7.2 + +* Sun Jun 9 2019 Orion Poplawski - 4.7.1-1 +- Update to 4.7.1 + +* Tue Apr 16 2019 Orion Poplawski - 4.6.13-1 +- Update to 4.6.13 + +* Thu Apr 4 2019 Orion Poplawski - 4.6.11-1 +- Update to 4.6.11 + +* Tue Apr 2 2019 Orion Poplawski - 4.6.9-2 +- Fix conda profile scripts +- Do not build for python2 on EPEL +- Ignore test failures on EPEL7 + +* Sat Mar 30 2019 Orion Poplawski - 4.6.9-1 +- Update to 4.6.9 + +* Wed Feb 13 2019 Zbigniew Jędrzejewski-Szmek - 4.6.5-1 +- Update to latest upstream version (#1668145) + +* Thu Jan 31 2019 Fedora Release Engineering - 4.5.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Dec 31 2018 Orion Poplawski - 4.5.12-1 +- Update to 4.5.12 + +* Mon Dec 31 2018 Orion Poplawski - 4.5.11-2 +- EPEL7 compatability + +* Fri Sep 21 2018 Zbigniew Jędrzejewski-Szmek - 4.5.11-1 +- Update to latest stable version (#1570217) +- Disable python2 subpackage on F30+ + +* Fri Jul 13 2018 Zbigniew Jędrzejewski-Szmek - 4.4.11-4 +- Pull in python[23]-cytoolz to replace bundled toolz + +* Thu Jul 12 2018 Fedora Release Engineering - 4.4.11-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 4.4.11-3 +- Rebuilt for Python 3.7 + +* Wed Apr 18 2018 Orion Poplawski - 4.4.11-2 +- Set _CONDA_ROOT in /etc/profile.d/conda.csh +- Fix python2 requires +- Require pycosat >= 0.6.3 + +* Sat Apr 14 2018 Zbigniew Jędrzejewski-Szmek - 4.4.11-1 +- Update to latest upstream version in the 4.4.x branch (#1544046) + +* Wed Feb 7 2018 Zbigniew Jędrzejewski-Szmek - 4.4.9-1 +- Update to v4.4.9 (#1542874) +- conda-activate binary rpm is retired. The new way to activate the environment + is to say 'conda activate'. See + https://github.com/conda/conda/releases/tag/4.4.0 for more information. + +* Wed Feb 07 2018 Iryna Shcherbina - 4.3.24-5 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Wed Feb 07 2018 Fedora Release Engineering - 4.3.24-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek - 4.3.24-3 +- Install just one version of the executables (python 2 or 3) + +* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek - 4.3.24-2 +- Add all licenses to the License tag +- Add Provides: bundled(...) for all the "vendored" dependencies +- Update descriptions and simplify the spec file a bit +- Move condarc.d directory under /usr/share/conda + +* Thu Aug 3 2017 Zbigniew Jędrzejewski-Szmek - 4.3.24-1 +- Update to latest version +- Switch /usr/bin/conda to python3 + +* Thu Jul 21 2016 Orion Poplawski - 4.1.6-1 +- Update to 4.1.6 + +* Thu Dec 31 2015 Orion Poplawski - 3.19.0-1 +- Update to 3.19.0 + +* Thu Dec 31 2015 Orion Poplawski - 3.18.8-2 +- Add python 3 version + +* Mon Dec 7 2015 Orion Poplawski - 3.18.8-1 +- Update to 3.18.8 + +* Thu Sep 24 2015 Orion Poplawski - 3.17.0-6 +- Do not create broken symlinks if activate/deactivate are not installed +- Do not create /usr/conda-meta to prevent accidental installs into system + +* Thu Sep 24 2015 Orion Poplawski - 3.17.0-5 +- Non-bootstrap build + +* Wed Sep 23 2015 Orion Poplawski - 3.17.0-4 +- Add patch to support rootless mode +- Require python-crypto +- Create /usr/conda-meta, /usr/.condarc, /var/cache/conda + +* Tue Sep 22 2015 Orion Poplawski - 3.17.0-3 +- Require python-requests, python-yaml + +* Tue Sep 22 2015 Orion Poplawski - 3.17.0-2 +- Add patch to allow overriding pkgs_dirs in .condarc + +* Mon Sep 21 2015 Orion Poplawski - 3.17.0-1 +- Initial package diff --git a/conda b/conda new file mode 100644 index 0000000..37bab57 --- /dev/null +++ b/conda @@ -0,0 +1,218 @@ +# bash_completion for conda. +# +# This was initially based on completion support for `fish`, but later extended +# complete options for subcommands and files/dirs/paths as appropriate. +# +# Dynamic option lookup uses a cache that persists for the duration of the shell. +# Updates to the conda command options are relatively rare, but there is a small chance +# that this cache will hold incorrect/incomplete values. A restart of your shell will +# fix this. + +# If this completion file is 'installed' under +# +# /etc/bash_completion.d/, +# /usr/share/bash-completion/completions/, or +# ~/.local/share/bash-completion/completions/, +# +# rather than being managed via the `conda shell.bash hook`, then this file may +# be sourced before conda is setup. To support this we allow for a potential +# late initialization of the CONDA_ROOT and CONDA_SOURCE environment +# variables. + +# The extglob option is set by the bash_completion library anyway, +# Setting it here to work around some rare edge cases. +shopt -s extglob + +function __comp_conda_ensure_root() { + if [[ -z "${CONDA_SOURCE-}" && -n "${CONDA_EXE-}" ]] ; then + if [[ -n "${_CE_CONDA-}" && -n "${WINDIR-}" ]]; then + CONDA_ROOT=$(\dirname "${CONDA_EXE}") + else + CONDA_ROOT=$(\dirname "${CONDA_EXE}") + CONDA_ROOT=$(\dirname "${CONDA_ROOT}") + fi + \local script=" + : from __future__ import print_function + : import os + : 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") + fi +} + +function __comp_conda_commands () { + # default core commands + echo clean config create help info init install list package + echo remove uninstall run search update upgrade + + # implied by conda shell function + echo activate deactivate + + # check commands from full anaconda install + 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 + done + + # check extra pluggins + for f in "$CONDA_ROOT"/bin/conda-* + do + if [[ -x "$f" && ! -d "$f" ]] + then + if [[ "$f" =~ .*/conda-(.*) ]]; then + echo "${BASH_REMATCH[1]}" + fi + fi + done +} + +function __comp_conda_env_commands() { + 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 + done +} + +function __comp_conda_envs() { + \local script=" + : 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))) + : ) + " + script="${script// : /}" + conda config --json --show envs_dirs | $CONDA_PYTHON_EXE -c "$script" +} + +function __comp_conda_packages() { + conda list | awk 'NR > 3 {print $1}' +} + +function __comp_conda_cmds_str() { + # get a list of commands, skipping options + \local cmd + \local -a cmds + for cmd in "$@"; do + case "$cmd" in + -*) continue ;; + *) cmds+=("$cmd") ;; + esac + done + echo "${cmds[@]}" +} + +# helper for debugging issues with the cache +function __comp_conda_cache_dump() { + for k in "${!__comp_conda_cache[@]}"; do + printf "%s:\n" "$k" + for w in ${__comp_conda_cache[$k]}; do + printf "\t%s\n" "$w" + done + done +} + +function __comp_conda_option_lookup() { + \local word_list cmd_str cmd_key + cmd_str=$1 + + # make a key to look up the cached result of the command help + # (We should be able to just use $cmd_str, since spaces in an array key are fine, + # but this produces an error with an empty cache. I'm not sure why though) + cmd_key=${cmd_str// /_} + + if [[ -z "${__comp_conda_cache[$cmd_key]}" ]]; then + # parse the output of command help to get completions + word_list=$($cmd_str --help 2>&1 | _parse_help -) + if [[ ${PIPESTATUS[0]} -eq 0 && -n $word_list ]]; then + __comp_conda_cache[$cmd_key]=$word_list + else + # something went wrong, so abort completion attempt + return 1 + fi + else + word_list=${__comp_conda_cache[$cmd_key]} + fi + echo "$word_list" +} + +# cache conda subcommand help lookups for the duration of the shell +unset __comp_conda_cache +declare -A __comp_conda_cache + +# If conda has not been fully setup/activated yet, some of the above functions may fail +# and print error messages. This is not helpful during normal usage, so we discard all +# error output by default. +__comp_conda_ensure_root 2>/dev/null || : + +_comp_conda() +{ + # shellcheck disable=SC2034 + \local cur prev words cword + _init_completion || return + + __comp_conda_ensure_root 2>/dev/null + + \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[@]}") + word_list=$(__comp_conda_option_lookup "$cmd_str") + else + case "$prev" in + conda) + word_list=$(__comp_conda_commands 2>/dev/null) + ;; + env) + 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 + ;; + remove|uninstall|upgrade|update) + word_list=$(__comp_conda_packages 2>/dev/null) + ;; + --name|--clone) + word_list=$(__comp_conda_envs 2>/dev/null) + ;; + --*-file|--file|--which|convert) + _filedir # filenames + ;; + --*-dir|--*-folder|--subdir|--prefix|--cwd|index) + _filedir -d # directories + ;; + verify|debug) + _filedir 'tar.bz2' # package paths and directories + ;; + build) + _filedir 'tar.bz2' # package paths and directories + word_list='purge purge-all' # special keywords + ;; + esac + fi + if [[ -n $word_list ]]; then + # append completion suggestions to COMPREPLY + mapfile -t -O "${#COMPREPLY[@]}" COMPREPLY < \ + <(compgen -W "$word_list" -- "$cur") + fi +} && +complete -F _comp_conda conda + +# vim: ft=sh diff --git a/conda.spec b/conda.spec new file mode 100644 index 0000000..5e7e2c3 --- /dev/null +++ b/conda.spec @@ -0,0 +1,454 @@ +%bcond_without tests + +Name: conda +Version: 25.11.1 +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 + +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 + +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 + +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 + + +%global _description %{expand: +Conda is a cross-platform, Python-agnostic binary package manager. It +is the package manager used by Anaconda installations, but it may be +used for other systems as well. Conda makes environments first-class +citizens, making it easy to create independent environments even for +C libraries. Conda is written entirely in Python. + +The Fedora conda base environment is special. Unlike a standard +anaconda install base environment it is essentially read-only. You +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. + + +%package -n python%{python3_pkgversion}-conda +Summary: %{summary} + +BuildRequires: python%{python3_pkgversion}-devel +# 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 + +%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 + +# Do not restrict upper bound of ruamel-yaml +sed -i -e '/ruamel.yaml/s/,<[0-9.]*//' pyproject.toml + +# pytest-split/xdoctest not packaged, store-duration not needed +sed -i -e '/splitting-algorithm/d' -e '/store-durations/d' -e '/xdoctest/d' pyproject.toml + +# Unpackaged - really only applicable for macOS/Windows? +sed -i -e '/"truststore *>/d' pyproject.toml + +%ifnarch x86_64 +# Tests on 32-bit +cp -a tests/data/conda_format_repo/linux-{64,32} +sed -i -e s/linux-64/linux-32/ tests/data/conda_format_repo/linux-32/*json +# Tests on non-x86_64 +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 + +%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 + +%install +%pyproject_install +#py3_shebang_fix %{buildroot}%{python3_sitelib}/conda/shell/bin/conda +%pyproject_save_files conda* + +mkdir -p %{buildroot}%{_sysconfdir}/conda/condarc.d +mkdir -p %{buildroot}%{_datadir}/conda/condarc.d +cat >%{buildroot}%{_datadir}/conda/condarc.d/defaults.yaml <