forked from platformio/platformio-core
Fix GitHub's "TLSV1_ALERT_PROTOCOL_VERSION" issue when upgrading PIO Core to development version
This commit is contained in:
@ -141,7 +141,7 @@ class ContentCache(object):
|
|||||||
self._db_path = None
|
self._db_path = None
|
||||||
self._lockfile = None
|
self._lockfile = None
|
||||||
|
|
||||||
self.cache_dir = cache_dir or join(util.get_home_dir(), ".cache")
|
self.cache_dir = cache_dir or util.get_cache_dir()
|
||||||
self._db_path = join(self.cache_dir, "db.data")
|
self._db_path = join(self.cache_dir, "db.data")
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
# 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 re
|
import re
|
||||||
|
from zipfile import ZipFile
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
@ -37,11 +39,8 @@ def cli(dev):
|
|||||||
shutdown_servers()
|
shutdown_servers()
|
||||||
|
|
||||||
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
|
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
|
||||||
cmds = ([
|
cmds = (["pip", "install", "--upgrade",
|
||||||
"pip", "install", "--upgrade",
|
get_pip_package(to_develop)], ["platformio", "--version"])
|
||||||
"https://github.com/platformio/platformio-core/archive/develop.zip"
|
|
||||||
if to_develop else "platformio"
|
|
||||||
], ["platformio", "--version"])
|
|
||||||
|
|
||||||
cmd = None
|
cmd = None
|
||||||
r = None
|
r = None
|
||||||
@ -92,6 +91,33 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands.
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def get_pip_package(to_develop):
|
||||||
|
pkg_name = "platformio"
|
||||||
|
if not to_develop:
|
||||||
|
return pkg_name
|
||||||
|
cache_dir = util.get_cache_dir()
|
||||||
|
if not os.path.isdir(cache_dir):
|
||||||
|
os.makedirs(cache_dir)
|
||||||
|
pkg_name = os.path.join(cache_dir, "piocoredevelop.zip")
|
||||||
|
try:
|
||||||
|
with open(pkg_name, "w") as fp:
|
||||||
|
r = util.exec_command(
|
||||||
|
[
|
||||||
|
"curl", "-fsSL", "https://github.com/platformio/"
|
||||||
|
"platformio-core/archive/develop.zip"
|
||||||
|
],
|
||||||
|
stdout=fp,
|
||||||
|
universal_newlines=True)
|
||||||
|
assert r['returncode'] == 0
|
||||||
|
# check ZIP structure
|
||||||
|
with ZipFile(pkg_name) as zp:
|
||||||
|
assert zp.testzip() is None
|
||||||
|
return pkg_name
|
||||||
|
except: # pylint: disable=bare-except
|
||||||
|
pass
|
||||||
|
return "platformio"
|
||||||
|
|
||||||
|
|
||||||
def get_latest_version():
|
def get_latest_version():
|
||||||
try:
|
try:
|
||||||
if not str(VERSION[2]).isdigit():
|
if not str(VERSION[2]).isdigit():
|
||||||
|
@ -253,6 +253,11 @@ def get_home_dir():
|
|||||||
return home_dir
|
return home_dir
|
||||||
|
|
||||||
|
|
||||||
|
def get_cache_dir():
|
||||||
|
return get_project_optional_dir("cache_dir", join(get_home_dir(),
|
||||||
|
".cache"))
|
||||||
|
|
||||||
|
|
||||||
def get_source_dir():
|
def get_source_dir():
|
||||||
curpath = abspath(__file__)
|
curpath = abspath(__file__)
|
||||||
if not isfile(curpath):
|
if not isfile(curpath):
|
||||||
|
@ -44,9 +44,7 @@ def test_after_upgrade_2_to_3(clirunner, validate_cliresult,
|
|||||||
|
|
||||||
result = clirunner.invoke(cli_pio, ["settings", "get"])
|
result = clirunner.invoke(cli_pio, ["settings", "get"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "upgraded to 3"
|
assert "upgraded to 3" in result.output
|
||||||
assert isolated_pio_home.join("platforms", "native",
|
|
||||||
"platform.json").check()
|
|
||||||
|
|
||||||
# check PlatformIO 3.0 boards
|
# check PlatformIO 3.0 boards
|
||||||
assert board_ids == set([p.basename[:-5] for p in boards.listdir()])
|
assert board_ids == set([p.basename[:-5] for p in boards.listdir()])
|
||||||
|
Reference in New Issue
Block a user