1717from pypi_tools .pypi import PyPIClient
1818from packaging .specifiers import SpecifierSet
1919from packaging .version import Version , parse
20- import pdb
2120
2221from ci_tools .parsing import ParsedSetup , parse_require
2322from ci_tools .functions import compare_python_version
2423
25-
2624from typing import List
2725
2826DEV_REQ_FILE = "dev_requirements.txt"
@@ -104,7 +102,7 @@ def install_dependent_packages(setup_py_file_path, dependency_type, temp_dir):
104102
105103 logging .info ("%s released packages: %s" , dependency_type , released_packages )
106104 # filter released packages from dev_requirements and create a new file "new_dev_requirements.txt"
107- dev_req_file_path = filter_dev_requirements (setup_py_file_path , released_packages , temp_dir )
105+ dev_req_file_path = filter_dev_requirements (setup_py_file_path , released_packages , temp_dir , dependency_type )
108106
109107 if override_added_packages :
110108 logging .info (f"Expanding the requirement set by the packages { override_added_packages } ." )
@@ -303,8 +301,17 @@ def check_req_against_exclusion(req, req_to_exclude):
303301
304302 return req_id == req_to_exclude
305303
304+ # todo: remove when merging #37450
305+ def replace_identity (dev_requirement_line ) -> str :
306+ regex = r"azure[-_]identity"
307+
308+ if re .search (regex , dev_requirement_line ):
309+ return "azure-identity==1.17.0\n "
310+ else :
311+ return dev_requirement_line
306312
307- def filter_dev_requirements (setup_py_path , released_packages , temp_dir ):
313+
314+ def filter_dev_requirements (setup_py_path , released_packages , temp_dir , dependency_type ):
308315 # This method returns list of requirements from dev_requirements by filtering out packages in given list
309316 dev_req_path = os .path .join (os .path .dirname (setup_py_path ), DEV_REQ_FILE )
310317 requirements = []
@@ -327,6 +334,10 @@ def filter_dev_requirements(setup_py_path, released_packages, temp_dir):
327334 and not any ([check_req_against_exclusion (req , i ) for i in req_to_exclude ])
328335 ]
329336
337+ if dependency_type == "Minimum" :
338+ # replace identity with the minimum version of the package
339+ filtered_req = [replace_identity (req ) for req in filtered_req ]
340+
330341 logging .info ("Filtered dev requirements: %s" , filtered_req )
331342
332343 new_dev_req_path = ""
0 commit comments