From 40c87d87b8a91bc004a13e7f2c0ffdcb2a9d24b7 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sun, 15 Dec 2019 20:19:19 -0700 Subject: [PATCH 1/4] Update 4.6.14 Make "conda shell.bash hook" work (bz#1737165) Use system py-cpuinfo Unbundle more libraries --- conda-cpuinfo.patch | 12 ++++ conda.spec | 149 ++++++++++++++++---------------------------- 2 files changed, 64 insertions(+), 97 deletions(-) create mode 100644 conda-cpuinfo.patch diff --git a/conda-cpuinfo.patch b/conda-cpuinfo.patch new file mode 100644 index 0000000..506333b --- /dev/null +++ b/conda-cpuinfo.patch @@ -0,0 +1,12 @@ +diff -up conda-4.7.11/conda/base/context.py.cpuinfo conda-4.7.11/conda/base/context.py +--- conda-4.7.11/conda/base/context.py.cpuinfo 2019-08-06 13:23:55.000000000 -0600 ++++ conda-4.7.11/conda/base/context.py 2019-08-16 21:31:01.947610667 -0600 +@@ -1328,7 +1328,7 @@ conda_tests_ctxt_mgmt_def_pol = replace_ + @memoize + 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.spec b/conda.spec index 443436a..6cc1002 100644 --- a/conda.spec +++ b/conda.spec @@ -1,8 +1,7 @@ %{!?_with_bootstrap: %global bootstrap 0} -%global with_python2 0%{?fedora} && 0%{?fedora} < 30 Name: conda -Version: 4.6.13 +Version: 4.6.14 Release: 1%{?dist} Summary: Cross-platform, Python-agnostic binary package manager @@ -19,6 +18,8 @@ Patch0: conda_sys_prefix.patch Patch1: conda_gateways_disk_create.patch Patch2: setup.patch Patch3: conda-tests.patch +# Use system cpuinfo +Patch4: conda-cpuinfo.patch Patch10001: 0001-Fix-toolz-imports.patch Patch10002: 0002-Adjust-ruamel.yaml-imports.patch @@ -30,10 +31,11 @@ BuildArch: noarch 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 +Obsoletes: conda-activate < 4.4 %?python_enable_dependency_generator +BuildRequires: /usr/bin/pathfix.py BuildRequires: sed %global _description \ @@ -45,61 +47,16 @@ entirely in Python. %description %_description -%global _py2_reqs \ - python2-crypto \ - python2-pycosat >= 0.6.3 \ - python2-ruamel-yaml \ - python2-mock \ - python2-responses - -%global _py2_bund \ - bundled(python2-appdirs) = 1.2.0 \ - bundled(python2-auxlib) \ - bundled(python2-boltons) = 16.5.1 \ - bundled(python2-six) = 1.10.0 \ - bundled(python2-toolz) = 0.8.2 \ - bundled(python2-urllib3) = 1.19.1 - -%global py2_reqs %(c="%_py2_reqs"; echo "$c" | xargs) -%global py3_reqs %(c="%_py2_reqs"; echo "$c" | sed s/python2/python%{python3_pkgversion}/ | xargs) - -%global py2_bund %(c="%_py2_bund"; echo "$c" | xargs) -%global py3_bund %(c="%_py2_bund"; echo "$c" | sed s/python2/python%{python3_pkgversion}/ | xargs) - -%if %with_python2 -%package -n python2-conda -Summary: %{summary} - -BuildRequires: python2-devel -BuildRequires: python2-setuptools -BuildRequires: %py2_reqs -BuildRequires: python2-requests -# When this is present, vendored toolz should not be used -%if 0%{?fedora} -# EPEL does not have new enough cytoolz -BuildRequires: python2-cytoolz -%endif -# For tests -BuildRequires: python2-enum34 -BuildRequires: python2-futures -BuildRequires: python2-pytest-cov - -# Keep manual Requires for now: -# automatically generated Requires are missing a few modules. -# Having both is still useful because the automatic ones have -# version requirements. -Requires: %py2_reqs -Requires: python2-enum34 -Requires: python2-futures -%if 0%{?fedora} -# EPEL does not have new enough cytoolz -Requires: python2-cytoolz -%endif -Provides: %py2_bund -%{?python_provide:%python_provide python2-conda} - -%description -n python2-conda %_description -%endif +%global _py3_reqs \ + python%{python3_pkgversion}-cpuinfo \ + python%{python3_pkgversion}-crypto \ + python%{python3_pkgversion}-distro >= 1.0.4 \ + python%{python3_pkgversion}-frozendict >= 1.2 \ + python%{python3_pkgversion}-pycosat >= 0.6.3 \ + python%{python3_pkgversion}-requests \ + python%{python3_pkgversion}-ruamel-yaml \ + python%{python3_pkgversion}-tqdm >= 4.22.0 +%global py3_reqs %(c="%_py3_reqs"; echo "$c" | xargs) %package -n python%{python3_pkgversion}-conda Summary: %{summary} @@ -107,24 +64,30 @@ Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: %py3_reqs -BuildRequires: python%{python3_pkgversion}-requests BuildRequires: python%{python3_pkgversion}-yaml # When this is present, vendored toolz should not be used -%if 0%{?fedora} -# EPEL does not have new enough cytoolz +%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%{python3_pkgversion}-mock BuildRequires: python%{python3_pkgversion}-pytest-cov +BuildRequires: python%{python3_pkgversion}-responses Requires: %py3_reqs -Requires: python%{python3_pkgversion}-requests Requires: python%{python3_pkgversion}-yaml -%if 0%{?fedora} -# EPEL does not have new enough cytoolz +%if 0%{?fedora} || 0%{?rhel} >= 8 +# EPEL7 does not have new enough cytoolz Requires: python%{python3_pkgversion}-cytoolz >= 0.8.2 %endif -Provides: %py3_bund +Provides: bundled(python%{python3_pkgversion}-appdirs) = 1.2.0 +Provides: bundled(python%{python3_pkgversion}-auxlib) +Provides: bundled(python%{python3_pkgversion}-boltons) = 16.5.1 +Provides: bundled(python%{python3_pkgversion}-six) = 1.10.0 +Provides: bundled(python%{python3_pkgversion}-toolz) = 0.8.2 +Provides: bundled(python%{python3_pkgversion}-urllib3) = 1.19.1 + %{?python_provide:%python_provide python%{python3_pkgversion}-conda} %description -n python%{python3_pkgversion}-conda %_description @@ -146,35 +109,30 @@ sed -r -i 's/\btest_list\b/_disabled_\0/' tests/test_cli.py # or so. sed -r -i '1 {/#![/]usr[/]bin[/]env/d}' conda/_vendor/appdirs.py +# Use Fedora's cpuinfo since it supports more arches +rm conda/_vendor/cpuinfo.py + # Replaced by cytools, byte compilation fails under python3.7 -%if 0%{?fedora} -# EPEL does not have new enough cytoolz +%if 0%{?fedora} || 0%{?rhel} >= 8 +# EPEL7 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 +rm -r conda/_vendor/{distro.py,frozendict.py,tqdm} +find conda -name \*.py | xargs sed -i -e 's/^\( *\)from .*_vendor\.\(\(distro\|frozendict\|tqdm\).*\) import/\1from \2 import/' + + %build # build conda executable %define py_setup utils/setup-testing.py -%if %with_python2 -%py2_build -%endif %py3_build %install # install conda executable %define py_setup utils/setup-testing.py -%if 0%{?fedora} -%if %with_python2 -%py2_install -%endif %py3_install -%else -%py3_install -%if %with_python2 -%py2_install -%endif -%endif mkdir -p %{buildroot}%{_datadir}/conda/condarc.d cat >%{buildroot}%{_datadir}/conda/condarc.d/defaults.yaml < - 4.6.14-1 +- Update 4.6.14 +- Make "conda shell.bash hook" work (bz#1737165) +- Use system py-cpuinfo +- Unbundle more libraries + * Tue Apr 16 2019 Orion Poplawski - 4.6.13-1 - Update to 4.6.13 From fe4f3921b7f09c4bf46bac0449281facf07f4cb4 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sun, 15 Dec 2019 20:22:22 -0700 Subject: [PATCH 2/4] Upload source --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index d7e13c0..9c0ebc3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (conda-4.6.13.tar.gz) = 8f0ad3cac26e88740ffc94f980546827388151746d8fad133b131dc893d8bb4a2840fb4f08e6c98759b1d919e8d24b05c93acd76bfc16ae5d487f699ea5ce20d +SHA512 (conda-4.6.14.tar.gz) = 046faac0f82e3cd2f417725fe6074ccc561e126c0af11a3a46a3f32f7a535d11d3d337fbdc1f5a61ca8dc2235f6421ac8425b1a7aa7ce326cb9e2e6c18ce5a10 From 2d66c05852677f54accc46c8622cad2803eb8c18 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 16 Dec 2019 20:58:25 -0700 Subject: [PATCH 3/4] Revert unbundling of packages on in EPEL7 --- conda-cpuinfo.patch | 12 ------------ conda.spec | 15 +++------------ 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 conda-cpuinfo.patch diff --git a/conda-cpuinfo.patch b/conda-cpuinfo.patch deleted file mode 100644 index 506333b..0000000 --- a/conda-cpuinfo.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up conda-4.7.11/conda/base/context.py.cpuinfo conda-4.7.11/conda/base/context.py ---- conda-4.7.11/conda/base/context.py.cpuinfo 2019-08-06 13:23:55.000000000 -0600 -+++ conda-4.7.11/conda/base/context.py 2019-08-16 21:31:01.947610667 -0600 -@@ -1328,7 +1328,7 @@ conda_tests_ctxt_mgmt_def_pol = replace_ - @memoize - 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.spec b/conda.spec index 6cc1002..0b8901a 100644 --- a/conda.spec +++ b/conda.spec @@ -18,8 +18,6 @@ Patch0: conda_sys_prefix.patch Patch1: conda_gateways_disk_create.patch Patch2: setup.patch Patch3: conda-tests.patch -# Use system cpuinfo -Patch4: conda-cpuinfo.patch Patch10001: 0001-Fix-toolz-imports.patch Patch10002: 0002-Adjust-ruamel.yaml-imports.patch @@ -48,14 +46,11 @@ entirely in Python. %description %_description %global _py3_reqs \ - python%{python3_pkgversion}-cpuinfo \ python%{python3_pkgversion}-crypto \ python%{python3_pkgversion}-distro >= 1.0.4 \ - python%{python3_pkgversion}-frozendict >= 1.2 \ python%{python3_pkgversion}-pycosat >= 0.6.3 \ python%{python3_pkgversion}-requests \ - python%{python3_pkgversion}-ruamel-yaml \ - python%{python3_pkgversion}-tqdm >= 4.22.0 + python%{python3_pkgversion}-ruamel-yaml %global py3_reqs %(c="%_py3_reqs"; echo "$c" | xargs) %package -n python%{python3_pkgversion}-conda @@ -109,9 +104,6 @@ sed -r -i 's/\btest_list\b/_disabled_\0/' tests/test_cli.py # or so. sed -r -i '1 {/#![/]usr[/]bin[/]env/d}' conda/_vendor/appdirs.py -# Use Fedora's cpuinfo since it supports more arches -rm conda/_vendor/cpuinfo.py - # Replaced by cytools, byte compilation fails under python3.7 %if 0%{?fedora} || 0%{?rhel} >= 8 # EPEL7 does not have new enough cytoolz @@ -120,8 +112,8 @@ rm conda/_vendor/toolz/[a-zA-Z]* %endif # Use system versions -rm -r conda/_vendor/{distro.py,frozendict.py,tqdm} -find conda -name \*.py | xargs sed -i -e 's/^\( *\)from .*_vendor\.\(\(distro\|frozendict\|tqdm\).*\) import/\1from \2 import/' +rm -r conda/_vendor/distro.py +find conda -name \*.py | xargs sed -i -e 's/^\( *\)from .*_vendor\.\(\(distro\).*\) import/\1from \2 import/' %build @@ -190,7 +182,6 @@ py.test-%{python3_version} -vv -m "not integration" \ * Sun Dec 15 2019 Orion Poplawski - 4.6.14-1 - Update 4.6.14 - Make "conda shell.bash hook" work (bz#1737165) -- Use system py-cpuinfo - Unbundle more libraries * Tue Apr 16 2019 Orion Poplawski - 4.6.13-1 From fe713a5e1a8a1068c63b1d2cbe30dc2ac8f693dd Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 9 Mar 2022 13:46:19 -0700 Subject: [PATCH 4/4] Backport fix for python 3.10 support --- conda-py3.10.patch | 72 ++++++++++++++++++++++++++++++++++++++++++++++ conda.spec | 17 +++++++---- 2 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 conda-py3.10.patch diff --git a/conda-py3.10.patch b/conda-py3.10.patch new file mode 100644 index 0000000..0ca895e --- /dev/null +++ b/conda-py3.10.patch @@ -0,0 +1,72 @@ +diff -up conda-4.6.14/conda/common/path.py.~1~ conda-4.6.14/conda/common/path.py +--- conda-4.6.14/conda/common/path.py.~1~ 2022-03-09 12:35:19.791274886 -0700 ++++ conda-4.6.14/conda/common/path.py 2022-03-09 12:35:34.386212879 -0700 +@@ -180,6 +180,8 @@ def get_python_site_packages_short_path( + return 'lib/python%s/site-packages' % py_ver + + ++_VERSION_REGEX = re.compile(r"[0-9]+\.[0-9]+") ++ + def get_major_minor_version(string, with_dot=True): + # returns None if not found, otherwise two digits as a string + # should work for +@@ -189,10 +191,31 @@ def get_major_minor_version(string, with + # - lib/python34/site-packages/ + # the last two are dangers because windows doesn't have version information there + assert isinstance(string, string_types) +- digits = tuple(take(2, (c for c in string if c.isdigit()))) +- if len(digits) == 2: +- return '.'.join(digits) if with_dot else ''.join(digits) +- return None ++ if string.startswith("lib/python"): ++ pythonstr = string.split("/")[1] ++ start = len("python") ++ if len(pythonstr) < start + 2: ++ return None ++ maj_min = pythonstr[start], pythonstr[start+1:] ++ elif string.startswith("bin/python"): ++ pythonstr = string.split("/")[1] ++ start = len("python") ++ if len(pythonstr) < start + 3: ++ return None ++ assert pythonstr[start+1] == "." ++ maj_min = pythonstr[start], pythonstr[start+2:] ++ else: ++ match = _VERSION_REGEX.match(string) ++ if match: ++ version = match.group(0).split(".") ++ maj_min = version[0], version[1] ++ else: ++ digits = "".join([c for c in string if c.isdigit()]) ++ if len(digits) < 2: ++ return None ++ maj_min = digits[0], digits[1:] ++ ++ return ".".join(maj_min) if with_dot else "".join(maj_min) + + + def get_bin_directory_short_path(): +diff -up conda-4.6.14/tests/common/test_path.py.~1~ conda-4.6.14/tests/common/test_path.py +--- conda-4.6.14/tests/common/test_path.py.~1~ 2019-04-17 14:21:14.000000000 -0600 ++++ conda-4.6.14/tests/common/test_path.py 2022-03-09 12:35:34.361212985 -0700 +@@ -118,8 +118,20 @@ def test_get_major_minor_version_no_dot( + assert get_major_minor_version("lib/python34/site-packages/") == "3.4" + assert get_major_minor_version("python3") is None + ++ assert get_major_minor_version("3.10.0") == "3.10" ++ assert get_major_minor_version("310") == "3.10" ++ assert get_major_minor_version("bin/python3.10") == "3.10" ++ assert get_major_minor_version("lib/python310/site-packages/") == "3.10" ++ assert get_major_minor_version("python3") is None ++ + assert get_major_minor_version("3.5.2", False) == "35" + assert get_major_minor_version("27", False) == "27" + assert get_major_minor_version("bin/python2.7", False) == "27" + assert get_major_minor_version("lib/python34/site-packages/", False) == "34" + assert get_major_minor_version("python3", False) is None ++ ++ assert get_major_minor_version("3.10.0", False) == "310" ++ assert get_major_minor_version("310", False) == "310" ++ assert get_major_minor_version("bin/python3.10", False) == "310" ++ assert get_major_minor_version("lib/python310/site-packages/", False) == "310" ++ assert get_major_minor_version("python3", False) is None diff --git a/conda.spec b/conda.spec index 0b8901a..4211c75 100644 --- a/conda.spec +++ b/conda.spec @@ -2,7 +2,7 @@ Name: conda Version: 4.6.14 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Cross-platform, Python-agnostic binary package manager License: BSD and ASL 2.0 and LGPLv2+ and MIT @@ -19,11 +19,13 @@ Patch1: conda_gateways_disk_create.patch Patch2: setup.patch Patch3: conda-tests.patch -Patch10001: 0001-Fix-toolz-imports.patch -Patch10002: 0002-Adjust-ruamel.yaml-imports.patch -Patch10003: 0003-Drop-fs-path-encoding-manipulation-under-python2.patch -Patch10004: 0004-Do-not-try-to-run-usr-bin-python.patch -Patch10005: 0005-Fix-failing-tests-in-test_api.py.patch +Patch11: 0001-Fix-toolz-imports.patch +Patch12: 0002-Adjust-ruamel.yaml-imports.patch +Patch13: 0003-Drop-fs-path-encoding-manipulation-under-python2.patch +Patch14: 0004-Do-not-try-to-run-usr-bin-python.patch +Patch15: 0005-Fix-failing-tests-in-test_api.py.patch +# Backport https://github.com/conda/conda/pull/10970 +Patch16: conda-py3.10.patch BuildArch: noarch @@ -179,6 +181,9 @@ py.test-%{python3_version} -vv -m "not integration" \ %changelog +* Wed Mar 09 2022 Orion Poplawski - 4.6.14-2 +- Backport fix for python 3.10 support + * Sun Dec 15 2019 Orion Poplawski - 4.6.14-1 - Update 4.6.14 - Make "conda shell.bash hook" work (bz#1737165)