File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 33from pathlib import Path
44import shutil
55import os
6+ import re
67
78from typing import Sequence , Dict , Union
89
@@ -103,7 +104,28 @@ def install_any(session,
103104 # use the provided versions dictionary to update the versions
104105 if versions_dct is None :
105106 versions_dct = dict ()
106- pkgs = [pkg + versions_dct .get (pkg , "" ) for pkg in pkgs if versions_dct .get (pkg , "" ) != DONT_INSTALL ]
107+
108+ _pkgs = pkgs
109+ pkgs = []
110+ for pkg in _pkgs :
111+ # Find version specifiers if any
112+ try :
113+ separator = next (re .finditer (r"[>=<~!]" , pkg )).start ()
114+ p_name , p_version = pkg [:separator ], pkg [separator :]
115+ except StopIteration :
116+ p_name , p_version = pkg , ""
117+
118+ # Is there something to override them in our versions_dct ?
119+ specifier_override = versions_dct .get (p_name , "" )
120+ if specifier_override == DONT_INSTALL :
121+ print (f"NOT INSTALLING { p_name } { p_version } as described in the nox parametrization grid" )
122+ continue
123+ if specifier_override :
124+ print (f"OVERRIDING { p_name } { p_version } to { p_name } { specifier_override } as described in the nox parametrization grid" )
125+ p_version = specifier_override
126+
127+ # Store the definitive package name and version specifier
128+ pkgs .append (f"{ p_name } { p_version } " )
107129
108130 nox_logger .debug ("\n About to install *%s* requirements: %s.\n "
109131 "Conda pkgs are %s" % (phase_name , pkgs , use_conda_for ))
You can’t perform that action at this time.
0 commit comments