From ac7743e217c36bd5660b4472a281c6ea976952e6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 12 Sep 2016 02:11:04 +0300 Subject: [PATCH] Rename setting DISABLE_SSL to ENABLE_DISABLE and set it to No by default --- docs/envvars.rst | 4 ++-- docs/userguide/cmd_settings.rst | 8 ++++---- platformio/__init__.py | 2 +- platformio/app.py | 7 +++---- platformio/managers/lib.py | 13 ++++--------- platformio/managers/platform.py | 2 +- platformio/util.py | 2 +- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 7749e9ce..b66813ee 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -163,6 +163,6 @@ Allows to override setting :ref:`setting_enable_telemetry`. Allows to override setting :ref:`setting_force_verbose`. -.. envvar:: PLATFORMIO_SETTING_DISABLE_SSL +.. envvar:: PLATFORMIO_SETTING_ENABLE_SSL -Allows to override setting :ref:`setting_disable_ssl`. +Allows to override setting :ref:`setting_enable_ssl`. diff --git a/docs/userguide/cmd_settings.rst b/docs/userguide/cmd_settings.rst index 2605ed74..ab8440bf 100644 --- a/docs/userguide/cmd_settings.rst +++ b/docs/userguide/cmd_settings.rst @@ -87,15 +87,15 @@ Check for the new PlatformIO interval. Check for the platform updates interval. -.. _setting_disable_ssl: +.. _setting_enable_ssl: -``disable_ssl`` -^^^^^^^^^^^^^^^ +``enable_ssl`` +^^^^^^^^^^^^^^ :Default: No :Values: Yes/No -Disable SSL for PlatformIO API (NOT RECOMMENDED, INSECURE) +Enable SSL for PlatformIO Services .. _setting_force_verbose: diff --git a/platformio/__init__.py b/platformio/__init__.py index 38506192..fc10a320 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 0, "2a1") +VERSION = (3, 0, "2a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/app.py b/platformio/app.py index 6ca23013..013c0745 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -14,7 +14,6 @@ import hashlib import json -import sys import uuid from copy import deepcopy from os import environ, getenv @@ -51,9 +50,9 @@ DEFAULT_SETTINGS = { "description": "Force verbose output when processing environments", "value": False }, - "disable_ssl": { - "description": "Disable SSL for PlatformIO services", - "value": sys.version_info < (2, 7, 9) + "enable_ssl": { + "description": "Enable SSL for PlatformIO Services", + "value": False }, "enable_telemetry": { "description": diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index e441aaf3..45ba61f2 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -196,15 +196,10 @@ class LibraryManager(BasePkgManager): dl_data = util.get_api_result( "/lib/download/" + str(name[3:]), dict(version=version)) assert dl_data - pkg_dir = None - try: - pkg_dir = self._install_from_url( - name, dl_data['url'] if app.get_setting("disable_ssl") else - dl_data['url'].replace("http://", "https://"), requirements) - except exception.APIRequestError: - pkg_dir = self._install_from_url(name, dl_data['url'], - requirements) - return pkg_dir + + return self._install_from_url( + name, dl_data['url'].replace("http://", "https://") + if app.get_setting("enable_ssl") else dl_data['url'], requirements) def install(self, # pylint: disable=too-many-arguments name, diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 817c4a0f..8e8e0329 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -31,7 +31,7 @@ class PlatformManager(BasePkgManager): if not repositories: repositories = [ "{0}://dl.platformio.org/platforms/manifest.json".format( - "http" if app.get_setting("disable_ssl") else "https") + "https" if app.get_setting("enable_ssl") else "http") ] BasePkgManager.__init__(self, package_dir or join(util.get_home_dir(), "platforms"), diff --git a/platformio/util.py b/platformio/util.py index faf6a6bf..69316d1f 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -382,7 +382,7 @@ def _get_api_result( headers = get_request_defheaders() url = __apiurl__ - if get_setting("disable_ssl"): + if not get_setting("enable_ssl"): url = url.replace("https://", "http://") try: