mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
Merge branch 'fix/setuptools_constraint_v5.0' into 'release/v5.0'
fix: ensure the constraint file is followed also for setuptools (v5.0) See merge request espressif/esp-idf!32551
This commit is contained in:
@ -2063,16 +2063,10 @@ def action_install_python_env(args): # type: ignore
|
|||||||
warn('Removing the existing Python environment in {}'.format(idf_python_env_path))
|
warn('Removing the existing Python environment in {}'.format(idf_python_env_path))
|
||||||
shutil.rmtree(idf_python_env_path)
|
shutil.rmtree(idf_python_env_path)
|
||||||
|
|
||||||
venv_can_upgrade = False
|
|
||||||
|
|
||||||
if not os.path.exists(virtualenv_python):
|
if not os.path.exists(virtualenv_python):
|
||||||
if subprocess.run([sys.executable, '-m', 'venv', '-h'], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0:
|
if subprocess.run([sys.executable, '-m', 'venv', '-h'], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0:
|
||||||
# venv available
|
# venv available
|
||||||
virtualenv_options = ['--clear'] # delete environment if already exists
|
virtualenv_options = ['--clear'] # delete environment if already exists
|
||||||
if sys.version_info[:2] >= (3, 9):
|
|
||||||
# upgrade pip & setuptools
|
|
||||||
virtualenv_options += ['--upgrade-deps']
|
|
||||||
venv_can_upgrade = True
|
|
||||||
|
|
||||||
info('Creating a new Python environment in {}'.format(idf_python_env_path))
|
info('Creating a new Python environment in {}'.format(idf_python_env_path))
|
||||||
subprocess.check_call([sys.executable, '-m', 'venv',
|
subprocess.check_call([sys.executable, '-m', 'venv',
|
||||||
@ -2088,17 +2082,19 @@ def action_install_python_env(args): # type: ignore
|
|||||||
warn('Found PIP_USER="yes" in the environment. Disabling PIP_USER in this shell to install packages into a virtual environment.')
|
warn('Found PIP_USER="yes" in the environment. Disabling PIP_USER in this shell to install packages into a virtual environment.')
|
||||||
env_copy['PIP_USER'] = 'no'
|
env_copy['PIP_USER'] = 'no'
|
||||||
|
|
||||||
if not venv_can_upgrade:
|
constraint_file = get_constraints(idf_version) if use_constraints else None
|
||||||
info('Upgrading pip and setuptools...')
|
|
||||||
subprocess.check_call([virtualenv_python, '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools'],
|
info('Upgrading pip and setuptools...')
|
||||||
stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
|
run_args = [virtualenv_python, '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools']
|
||||||
|
if constraint_file:
|
||||||
|
run_args += ['--constraint', constraint_file]
|
||||||
|
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
|
||||||
|
|
||||||
run_args = [virtualenv_python, '-m', 'pip', 'install', '--no-warn-script-location']
|
run_args = [virtualenv_python, '-m', 'pip', 'install', '--no-warn-script-location']
|
||||||
requirements_file_list = get_requirements(args.features)
|
requirements_file_list = get_requirements(args.features)
|
||||||
for requirement_file in requirements_file_list:
|
for requirement_file in requirements_file_list:
|
||||||
run_args += ['-r', requirement_file]
|
run_args += ['-r', requirement_file]
|
||||||
if use_constraints:
|
if constraint_file:
|
||||||
constraint_file = get_constraints(idf_version)
|
|
||||||
run_args += ['--upgrade', '--constraint', constraint_file]
|
run_args += ['--upgrade', '--constraint', constraint_file]
|
||||||
if args.extra_wheels_dir:
|
if args.extra_wheels_dir:
|
||||||
run_args += ['--find-links', args.extra_wheels_dir]
|
run_args += ['--find-links', args.extra_wheels_dir]
|
||||||
@ -2112,8 +2108,8 @@ def action_install_python_env(args): # type: ignore
|
|||||||
run_args += ['--find-links', wheels_dir]
|
run_args += ['--find-links', wheels_dir]
|
||||||
|
|
||||||
info('Installing Python packages')
|
info('Installing Python packages')
|
||||||
if use_constraints:
|
if constraint_file:
|
||||||
info(' Constraint file: {}'.format(constraint_file))
|
info(f' Constraint file: {constraint_file}')
|
||||||
info(' Requirement files:')
|
info(' Requirement files:')
|
||||||
info(os.linesep.join(' - {}'.format(path) for path in requirements_file_list))
|
info(os.linesep.join(' - {}'.format(path) for path in requirements_file_list))
|
||||||
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
|
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
|
||||||
|
Reference in New Issue
Block a user