forked from platformio/platformio-core
Merge branch 'feature/prepend-python-pioplus' into develop
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
from email.utils import parsedate_tz
|
||||
from math import ceil
|
||||
from os.path import getsize, join
|
||||
from sys import version_info
|
||||
from time import mktime
|
||||
|
||||
import click
|
||||
@ -30,9 +31,13 @@ class FileDownloader(object):
|
||||
CHUNK_SIZE = 1024
|
||||
|
||||
def __init__(self, url, dest_dir=None):
|
||||
self._request = None
|
||||
# make connection
|
||||
self._request = requests.get(
|
||||
url, stream=True, headers=util.get_request_defheaders())
|
||||
url,
|
||||
stream=True,
|
||||
headers=util.get_request_defheaders(),
|
||||
verify=version_info >= (2, 7, 9))
|
||||
if self._request.status_code != 200:
|
||||
raise FDUnrecognizedStatusCode(self._request.status_code, url)
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from os.path import join
|
||||
from os.path import dirname, join
|
||||
|
||||
from platformio import __version__, exception, util
|
||||
from platformio.managers.package import PackageManager
|
||||
@ -100,7 +100,10 @@ def pioplus_call(args, **kwargs):
|
||||
sys.version.split()[0]))
|
||||
|
||||
pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus")
|
||||
os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path()
|
||||
pythonexe_path = util.get_pythonexe_path()
|
||||
os.environ['PATH'] = (os.pathsep).join(
|
||||
[dirname(pythonexe_path), os.environ['PATH']])
|
||||
os.environ['PYTHONEXEPATH'] = pythonexe_path
|
||||
os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("pysite-pioplus")
|
||||
util.copy_pythonpath_to_osenv()
|
||||
code = subprocess.call([pioplus_path] + args, **kwargs)
|
||||
|
@ -504,7 +504,7 @@ def _get_api_result(
|
||||
|
||||
result = None
|
||||
r = None
|
||||
disable_ssl_check = sys.version_info < (2, 7, 9)
|
||||
verify_ssl = sys.version_info >= (2, 7, 9)
|
||||
|
||||
headers = get_request_defheaders()
|
||||
if not url.startswith("http"):
|
||||
@ -520,14 +520,14 @@ def _get_api_result(
|
||||
data=data,
|
||||
headers=headers,
|
||||
auth=auth,
|
||||
verify=not disable_ssl_check)
|
||||
verify=verify_ssl)
|
||||
else:
|
||||
r = _api_request_session().get(
|
||||
url,
|
||||
params=params,
|
||||
headers=headers,
|
||||
auth=auth,
|
||||
verify=not disable_ssl_check)
|
||||
verify=verify_ssl)
|
||||
result = r.json()
|
||||
r.raise_for_status()
|
||||
except requests.exceptions.HTTPError as e:
|
||||
|
Reference in New Issue
Block a user