Skip to content

Commit

Permalink
Update setup command to use platform appropriate requirements.txt fil…
Browse files Browse the repository at this point in the history
…e. (#102)

* Rewriting _install_cli

* Fix typo

* Fixing extra check that should have been deleted
  • Loading branch information
marstr authored and tjprescott committed Jul 1, 2019
1 parent dbc4dac commit f1fe18e
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions azdev/operations/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import os
from shutil import copytree, rmtree
import time
import sys
import warnings

from knack.log import get_logger
from knack.util import CLIError
Expand Down Expand Up @@ -71,37 +73,37 @@ def _install_cli(cli_path):
)
pip_cmd("install -q {}".format(whl_list), "Installing private whl files...")

# install general requirements
pip_cmd(
"install -q -r {}/requirements.txt".format(cli_path),
"Installing `requirements.txt`..."
)

# command modules have dependency on azure-cli-core so install this first
pip_cmd(
"install -q -e {}/src/azure-cli-nspkg".format(cli_path),
"Installing `azure-cli-nspkg`..."
)
pip_cmd(
"install -q -e {}/src/azure-cli-telemetry".format(cli_path),
"Installing `azure-cli-telemetry`..."
)
pip_cmd(
"install -q -e {}/src/azure-cli-core".format(cli_path),
"Installing `azure-cli-core`..."
)

# azure cli has dependencies on the above packages so install this one last
pip_cmd("install -q -e {}/src/azure-cli".format(cli_path), "Installing `azure-cli`...")
pip_cmd(
"install -q -e {}/src/azure-cli-testsdk".format(cli_path),
"Installing `azure-cli-testsdk`..."
)

# Ensure that the site package's azure/__init__.py has the old style namespace
# package declaration by installing the old namespace package
pip_cmd("install -q -I azure-nspkg==1.0.0", "Installing `azure-nspkg`...")
pip_cmd("install -q -I azure-mgmt-nspkg==1.0.0", "Installing `azure-mgmt-nspkg`...")
src_path = '{}/src/'.format(cli_path)
local_distributables = ' '.join(
root
for root, dirs, files in os.walk(src_path)
if 'setup.py' in files)

python_major_version = sys.version_info[0]

if sys.platform.startswith('darwin'):
requirements_file = "{}/src/azure-cli/requirements.py{}.Darwin.txt".format(cli_path, python_major_version)
elif sys.platform.startswith('win32'):
requirements_file = "{}/src/azure-cli/requirements.py{}.Windows.txt".format(cli_path, python_major_version)
elif sys.platform.startswith('linux'):
requirements_file = "{}/src/azure-cli/requirements.py{}.Linux.txt".format(cli_path, python_major_version)

if requirements_file:
pip_cmd(
"install -q --no-deps -e {}".format(local_distributables),
"Installing packages found in this repository..."
)

pip_cmd(
"install -q -r {}".format(requirements_file),
"Installing external dependencies...",
)
else:
warnings.warn('platform {} does not have pinned dependencies, using latest compatible from PyPI.')
pip_cmd(
"install -q -e {}".format(local_distributables),
"Installing all packages...",
)


def _copy_config_files():
Expand Down

0 comments on commit f1fe18e

Please sign in to comment.