Skip to content

Commit

Permalink
python3Packages.conda: 4.3.16 -> 24.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EricTheMagician authored and SuperSandro2000 committed Apr 25, 2024
1 parent 14d5b95 commit f4ab775
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 23 deletions.
51 changes: 51 additions & 0 deletions pkgs/development/python-modules/conda/0001-conda_exe.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -754,7 +754,7 @@

@property
def conda_prefix(self):
- return abspath(sys.prefix)
+ return expand("~/.conda")

@property
@deprecated(
@@ -787,28 +787,17 @@
The vars can refer to each other if necessary since the dict is ordered.
None means unset it.
"""
- if context.dev:
- return {
- "CONDA_EXE": sys.executable,
- # do not confuse with os.path.join, we are joining paths with ; or : delimiters
- "PYTHONPATH": os.pathsep.join(
- (CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", ""))
- ),
- "_CE_M": "-m",
- "_CE_CONDA": "conda",
- "CONDA_PYTHON_EXE": sys.executable,
- }
- else:
- bin_dir = "Scripts" if on_win else "bin"
- exe = "conda.exe" if on_win else "conda"
- # I was going to use None to indicate a variable to unset, but that gets tricky with
- # error-on-undefined.
- return {
- "CONDA_EXE": os.path.join(sys.prefix, bin_dir, exe),
- "_CE_M": "",
- "_CE_CONDA": "",
- "CONDA_PYTHON_EXE": sys.executable,
- }
+ import sys
+ return {
+ "CONDA_EXE": sys.executable,
+ # do not confuse with os.path.join, we are joining paths with ; or : delimiters
+ "PYTHONPATH": os.pathsep.join(
+ [CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", "")] + [path for path in sys.path if "site-packages" in path]
+ ),
+ "_CE_M": "-m",
+ "_CE_CONDA": "conda",
+ "CONDA_PYTHON_EXE": sys.executable,
+ }

@memoizedproperty
def channel_alias(self):
91 changes: 68 additions & 23 deletions pkgs/development/python-modules/conda/default.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,83 @@
{ lib
, buildPythonPackage
, pythonAtLeast
, fetchPypi
, pycosat
, requests
, ruamel-yaml
, isPy3k
, enum34
{
lib,
buildPythonPackage,
pythonRelaxDepsHook,
hostPlatform,
fetchFromGitHub,
# build dependencies
hatchling,
hatch-vcs,
# runtime dependencies
archspec,
conda-libmamba-solver,
conda-package-handling,
distro,
jsonpatch,
packaging,
platformdirs,
pluggy,
pycosat,
requests,
ruamel-yaml,
tqdm,
truststore,
# runtime options
defaultEnvPath ? "~/.conda/envs", # default path to store conda environments
defaultPkgPath ? "~/.conda/pkgs", # default path to store download conda packages
}:

# Note: this installs conda as a library. The application cannot be used.
# This is likely therefore NOT what you're looking for.

buildPythonPackage rec {
pname = "conda";
version = "4.3.16";
format = "setuptools";
version = "24.1.2";
pyproject = true;

# this is a very outdated version of conda that isn't compatible with python 3.10+
disabled = pythonAtLeast "3.10";

src = fetchPypi {
src = fetchFromGitHub {
inherit pname version;
sha256 = "a91ef821343dea3ba9670f3d10b36c1ace4f4c36d70c175d8fc8886e94285953";
owner = "conda";
repo = "conda";
rev = version;
hash = "sha256-L/Y7Bb3R5YqXbjTN4CRPFnkgymVLrxuFmjVzpvt28dE=";
};

propagatedBuildInputs = [ pycosat requests ruamel-yaml ] ++ lib.optional (!isPy3k) enum34;
nativeBuildInputs = [ pythonRelaxDepsHook ];

build-system = [
hatchling
hatch-vcs
];

dependencies = [
archspec
conda-libmamba-solver
conda-package-handling
distro
jsonpatch
packaging
platformdirs
pluggy
pycosat
requests
ruamel-yaml
tqdm
truststore
];

patches = [ ./0001-conda_exe.patch ];

makeWrapperArgs = [
"--set CONDA_EXE ${placeholder "out"}/bin/conda"
''--set-default CONDA_ENVS_PATH "${defaultEnvPath}"''
''--set-default CONDA_PKGS_DIRS "${defaultPkgPath}"''
];

pythonImportsCheck = [ "conda" ];

# No tests
doCheck = false;
# menuinst is currently not packaged
pythonRemoveDeps = lib.optionals (!hostPlatform.isWindows) [ "menuinst" ];

meta = {
description = "OS-agnostic, system-level binary package manager";
homepage = "https://github.com/conda/conda";
license = lib.licenses.bsd3;
maintainers = [ lib.maintainers.ericthemagician ];
};
}

0 comments on commit f4ab775

Please sign in to comment.