potiuk commented on a change in pull request #19189:
URL: https://github.com/apache/airflow/pull/19189#discussion_r737961883
##########
File path: airflow/utils/python_virtualenv.py
##########
@@ -27,13 +28,22 @@
from airflow.utils.process_utils import execute_in_subprocess
-def _generate_virtualenv_cmd(tmp_dir: str, python_bin: str,
system_site_packages: bool) -> List[str]:
- cmd = [sys.executable, '-m', 'virtualenv', tmp_dir]
- if system_site_packages:
- cmd.append('--system-site-packages')
- if python_bin is not None:
- cmd.append(f'--python={python_bin}')
- return cmd
+def _generate_virtualenv_cmd(
+ tmp_dir: str, python_bin: str, system_site_packages: bool,
clone_virtualenv_packages: bool
+) -> List[str]:
+ if clone_virtualenv_packages and sys.prefix != sys.base_prefix and not
python_bin:
+ # Create virtualenv using virtualenv-clone command if we are in
virtualenv and
+ # clone_virtualenv_packages is set and we are using same version of
python
+ # as our virtualenv
+ cmd = ['virtualenv-clone', f'{sys.prefix}', tmp_dir]
+ return cmd
Review comment:
Virtualenv-clone will always clone all packages available. There is no
`system-site-packages` there I am afraid - this is just a clone of the venv -
it will automaticallly have all the system packages the original venv had
access to.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]