Skip to content

Commit

Permalink
Prevent the use of ‘component’ commands in dev mode
Browse files Browse the repository at this point in the history
- Also, the dev versions have all command modules installed by default
- If the user really wants to install another module, from some unknown location, they can use pip directly
- * pip doesn’t support mixing editable packages with regular packages *
pip install --editable and pip install clash for namespace packages #3
pypa/pip#3

And, Fix nightly build version patching as well
  • Loading branch information
derekbekoe committed Dec 1, 2016
1 parent 86df6b2 commit 1cf2775
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 25 deletions.
4 changes: 2 additions & 2 deletions scripts/nightly/nightly-build.sh
Expand Up @@ -5,10 +5,10 @@ cd azure-cli

# modify versions of the packages (__init__.py and setup.py files)
for initfile in src/azure-cli/azure/cli/__init__.py src/azure-cli-core/azure/cli/core/__init__.py; \
do sed -i 's/^__version__ = [\x22\x27]\(.*\)[\x22\x27]/__version__ = \x27\1+1.dev'$(date +%Y%m%d)'\x27/' $initfile; \
do sed -i 's/^__version__ = [\x22\x27]\(.*\)+dev[\x22\x27]/__version__ = \x27\1+1.dev'$(date +%Y%m%d)'\x27/' $initfile; \
done;
for d in src/azure-cli/ src/azure-cli-core/ src/azure-cli-nspkg/ src/command_modules/azure-cli-*/; \
do sed -i 's/^VERSION = [\x22\x27]\(.*\)[\x22\x27]/VERSION = \x27\1+1.dev'$(date +%Y%m%d)'\x27/' $d/setup.py; \
do sed -i 's/^VERSION = [\x22\x27]\(.*\)+dev[\x22\x27]/VERSION = \x27\1+1.dev'$(date +%Y%m%d)'\x27/' $d/setup.py; \
done;

pip install azure-storage==0.33.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/__init__.py
Expand Up @@ -5,4 +5,4 @@
import pkg_resources
pkg_resources.declare_namespace(__name__)

__version__ = "0.1.0b10"
__version__ = "0.1.0b10+dev"
2 changes: 1 addition & 1 deletion src/azure-cli-core/setup.py
Expand Up @@ -9,7 +9,7 @@
from codecs import open
from setuptools import setup

VERSION = "0.1.0b10"
VERSION = "0.1.0b10+dev"

# If we have source, validate that our version numbers match
# This should prevent uploading releases with mismatched versions.
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/__init__.py
Expand Up @@ -11,4 +11,4 @@
pkg_resources.declare_namespace(__name__)

__author__ = "Microsoft Corporation <python@microsoft.com>"
__version__ = "0.1.0b10"
__version__ = "0.1.0b10+dev"
2 changes: 1 addition & 1 deletion src/azure-cli/setup.py
Expand Up @@ -9,7 +9,7 @@
from codecs import open
from setuptools import setup

VERSION = "0.1.0b10"
VERSION = "0.1.0b10+dev"

# If we have source, validate that our version numbers match
# This should prevent uploading releases with mismatched versions.
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-acr/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-acs/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-appservice/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-cloud/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
Expand Up @@ -14,15 +14,23 @@
CLI_PACKAGE_NAME = 'azure-cli'
COMPONENT_PREFIX = 'azure-cli-'

def _verify_not_dev():
from azure.cli.core import __version__ as core_version
dev_version = core_version.endswith('+dev')
if dev_version:
raise CLIError('This operation is not available in the developer version of the CLI.')

def list_components():
""" List the installed components """
_verify_not_dev()
import pip
return sorted([{'name': dist.key.replace(COMPONENT_PREFIX, ''), 'version': dist.version}
for dist in pip.get_installed_distributions(local_only=True)
if dist.key.startswith(COMPONENT_PREFIX)], key=lambda x: x['name'])

def list_available_components():
""" List publicly available components that can be installed """
_verify_not_dev()
import pip
available_components = []
installed_component_names = [dist.key.replace(COMPONENT_PREFIX, '') \
Expand Down Expand Up @@ -51,6 +59,7 @@ def list_available_components():

def remove(component_name):
""" Remove a component """
_verify_not_dev()
if component_name in ['nspkg', 'core']:
raise CLIError("This component cannot be removed, it is required for the CLI to function.")
import pip
Expand Down Expand Up @@ -103,6 +112,7 @@ def _install_or_update(package_list, link, private, pre):

def update(private=False, pre=False, link=None, additional_components=None):
""" Update the CLI and all installed components """
_verify_not_dev()
import pip
# Update the CLI itself
package_list = [CLI_PACKAGE_NAME]
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-component/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-configure/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-container/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-context/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-feedback/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-iot/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-keyvault/setup.py
Expand Up @@ -9,7 +9,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-network/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-profile/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-redis/setup.py
Expand Up @@ -9,7 +9,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-resource/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-role/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-storage/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-taskhelp/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-vm/setup.py
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = '0.1.0b10'
VERSION = '0.1.0b10+dev'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 1cf2775

Please sign in to comment.