|
7 | 7 | import os |
8 | 8 | from shutil import copytree, rmtree |
9 | 9 | import time |
| 10 | +import sys |
| 11 | +import warnings |
10 | 12 |
|
11 | 13 | from knack.log import get_logger |
12 | 14 | from knack.util import CLIError |
@@ -71,37 +73,37 @@ def _install_cli(cli_path): |
71 | 73 | ) |
72 | 74 | pip_cmd("install -q {}".format(whl_list), "Installing private whl files...") |
73 | 75 |
|
74 | | - # install general requirements |
75 | | - pip_cmd( |
76 | | - "install -q -r {}/requirements.txt".format(cli_path), |
77 | | - "Installing `requirements.txt`..." |
78 | | - ) |
79 | | - |
80 | | - # command modules have dependency on azure-cli-core so install this first |
81 | | - pip_cmd( |
82 | | - "install -q -e {}/src/azure-cli-nspkg".format(cli_path), |
83 | | - "Installing `azure-cli-nspkg`..." |
84 | | - ) |
85 | | - pip_cmd( |
86 | | - "install -q -e {}/src/azure-cli-telemetry".format(cli_path), |
87 | | - "Installing `azure-cli-telemetry`..." |
88 | | - ) |
89 | | - pip_cmd( |
90 | | - "install -q -e {}/src/azure-cli-core".format(cli_path), |
91 | | - "Installing `azure-cli-core`..." |
92 | | - ) |
93 | | - |
94 | | - # azure cli has dependencies on the above packages so install this one last |
95 | | - pip_cmd("install -q -e {}/src/azure-cli".format(cli_path), "Installing `azure-cli`...") |
96 | | - pip_cmd( |
97 | | - "install -q -e {}/src/azure-cli-testsdk".format(cli_path), |
98 | | - "Installing `azure-cli-testsdk`..." |
99 | | - ) |
100 | | - |
101 | | - # Ensure that the site package's azure/__init__.py has the old style namespace |
102 | | - # package declaration by installing the old namespace package |
103 | | - pip_cmd("install -q -I azure-nspkg==1.0.0", "Installing `azure-nspkg`...") |
104 | | - pip_cmd("install -q -I azure-mgmt-nspkg==1.0.0", "Installing `azure-mgmt-nspkg`...") |
| 76 | + src_path = '{}/src/'.format(cli_path) |
| 77 | + local_distributables = ' '.join( |
| 78 | + root |
| 79 | + for root, dirs, files in os.walk(src_path) |
| 80 | + if 'setup.py' in files) |
| 81 | + |
| 82 | + python_major_version = sys.version_info[0] |
| 83 | + |
| 84 | + if sys.platform.startswith('darwin'): |
| 85 | + requirements_file = "{}/src/azure-cli/requirements.py{}.Darwin.txt".format(cli_path, python_major_version) |
| 86 | + elif sys.platform.startswith('win32'): |
| 87 | + requirements_file = "{}/src/azure-cli/requirements.py{}.Windows.txt".format(cli_path, python_major_version) |
| 88 | + elif sys.platform.startswith('linux'): |
| 89 | + requirements_file = "{}/src/azure-cli/requirements.py{}.Linux.txt".format(cli_path, python_major_version) |
| 90 | + |
| 91 | + if requirements_file: |
| 92 | + pip_cmd( |
| 93 | + "install -q --no-deps -e {}".format(local_distributables), |
| 94 | + "Installing packages found in this repository..." |
| 95 | + ) |
| 96 | + |
| 97 | + pip_cmd( |
| 98 | + "install -q -r {}".format(requirements_file), |
| 99 | + "Installing external dependencies...", |
| 100 | + ) |
| 101 | + else: |
| 102 | + warnings.warn('platform {} does not have pinned dependencies, using latest compatible from PyPI.') |
| 103 | + pip_cmd( |
| 104 | + "install -q -e {}".format(local_distributables), |
| 105 | + "Installing all packages...", |
| 106 | + ) |
105 | 107 |
|
106 | 108 |
|
107 | 109 | def _copy_config_files(): |
|
0 commit comments