forked from platformio/platformio-core
Implemente automatic installation of missing dependencies when utilizing a SOCKS proxy // Resolve #4822
This commit is contained in:
@ -26,6 +26,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
|
|||||||
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)
|
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)
|
||||||
* Enhanced the handling of built-in variables in |PIOCONF| during |INTERPOLATION| (`issue #4695 <https://github.com/platformio/platformio-core/issues/4695>`_)
|
* Enhanced the handling of built-in variables in |PIOCONF| during |INTERPOLATION| (`issue #4695 <https://github.com/platformio/platformio-core/issues/4695>`_)
|
||||||
* Enhanced PIP dependency declarations for improved reliability and extended support to include Python 3.6 (`issue #4819 <https://github.com/platformio/platformio-core/issues/4819>`_)
|
* Enhanced PIP dependency declarations for improved reliability and extended support to include Python 3.6 (`issue #4819 <https://github.com/platformio/platformio-core/issues/4819>`_)
|
||||||
|
* Implemented automatic installation of missing dependencies when utilizing a SOCKS proxy (`issue #4822 <https://github.com/platformio/platformio-core/issues/4822>`_)
|
||||||
* Implemented a fail-safe mechanism to terminate a debugging session if an unknown CLI option is passed (`issue #4699 <https://github.com/platformio/platformio-core/issues/4699>`_)
|
* Implemented a fail-safe mechanism to terminate a debugging session if an unknown CLI option is passed (`issue #4699 <https://github.com/platformio/platformio-core/issues/4699>`_)
|
||||||
* Rectified an issue where ``${platformio.name}`` erroneously represented ``None`` as the default `project name <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/generic/name.html>`__ (`issue #4717 <https://github.com/platformio/platformio-core/issues/4717>`_)
|
* Rectified an issue where ``${platformio.name}`` erroneously represented ``None`` as the default `project name <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/generic/name.html>`__ (`issue #4717 <https://github.com/platformio/platformio-core/issues/4717>`_)
|
||||||
* Resolved an issue where the ``COMPILATIONDB_INCLUDE_TOOLCHAIN`` setting was not correctly applying to private libraries (`issue #4762 <https://github.com/platformio/platformio-core/issues/4762>`_)
|
* Resolved an issue where the ``COMPILATIONDB_INCLUDE_TOOLCHAIN`` setting was not correctly applying to private libraries (`issue #4762 <https://github.com/platformio/platformio-core/issues/4762>`_)
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import socket
|
import socket
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
@ -23,6 +22,7 @@ from urllib3.util.retry import Retry
|
|||||||
from platformio import __check_internet_hosts__, app, util
|
from platformio import __check_internet_hosts__, app, util
|
||||||
from platformio.cache import ContentCache, cleanup_content_cache
|
from platformio.cache import ContentCache, cleanup_content_cache
|
||||||
from platformio.exception import PlatformioException, UserSideException
|
from platformio.exception import PlatformioException, UserSideException
|
||||||
|
from platformio.pipdeps import is_proxy_set
|
||||||
|
|
||||||
__default_requests_timeout__ = (10, None) # (connect, read)
|
__default_requests_timeout__ = (10, None) # (connect, read)
|
||||||
|
|
||||||
@ -191,9 +191,7 @@ def _internet_on():
|
|||||||
socket.setdefaulttimeout(timeout)
|
socket.setdefaulttimeout(timeout)
|
||||||
for host in __check_internet_hosts__:
|
for host in __check_internet_hosts__:
|
||||||
try:
|
try:
|
||||||
for var in ("HTTP_PROXY", "HTTPS_PROXY"):
|
if is_proxy_set():
|
||||||
if not os.getenv(var) and not os.getenv(var.lower()):
|
|
||||||
continue
|
|
||||||
requests.get("http://%s" % host, allow_redirects=False, timeout=timeout)
|
requests.get("http://%s" % host, allow_redirects=False, timeout=timeout)
|
||||||
return True
|
return True
|
||||||
# try to resolve `host` for both AF_INET and AF_INET6, and then try to connect
|
# try to resolve `host` for both AF_INET and AF_INET6, and then try to connect
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ def get_pip_dependencies():
|
|||||||
"marshmallow == 3.*",
|
"marshmallow == 3.*",
|
||||||
"pyelftools == 0.30",
|
"pyelftools == 0.30",
|
||||||
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
|
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
|
||||||
"requests == 2.*",
|
"requests%s == 2.*" % ("[socks]" if is_proxy_set(socks=True) else ""),
|
||||||
"semantic_version == 2.10.*",
|
"semantic_version == 2.10.*",
|
||||||
"tabulate == 0.*",
|
"tabulate == 0.*",
|
||||||
]
|
]
|
||||||
@ -59,3 +60,12 @@ def get_pip_dependencies():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
return core + home + extra
|
return core + home + extra
|
||||||
|
|
||||||
|
|
||||||
|
def is_proxy_set(socks=False):
|
||||||
|
for var in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"):
|
||||||
|
value = os.getenv(var, os.getenv(var.lower()))
|
||||||
|
if not value or (socks and not value.startswith("socks5://")):
|
||||||
|
continue
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
Reference in New Issue
Block a user