mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
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._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")
|
||||
|
||||
def __enter__(self):
|
||||
|
@ -12,7 +12,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import re
|
||||
from zipfile import ZipFile
|
||||
|
||||
import click
|
||||
import requests
|
||||
@ -37,11 +39,8 @@ def cli(dev):
|
||||
shutdown_servers()
|
||||
|
||||
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
|
||||
cmds = ([
|
||||
"pip", "install", "--upgrade",
|
||||
"https://github.com/platformio/platformio-core/archive/develop.zip"
|
||||
if to_develop else "platformio"
|
||||
], ["platformio", "--version"])
|
||||
cmds = (["pip", "install", "--upgrade",
|
||||
get_pip_package(to_develop)], ["platformio", "--version"])
|
||||
|
||||
cmd = None
|
||||
r = None
|
||||
@ -92,6 +91,33 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands.
|
||||
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():
|
||||
try:
|
||||
if not str(VERSION[2]).isdigit():
|
||||
|
@ -253,6 +253,11 @@ def get_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():
|
||||
curpath = abspath(__file__)
|
||||
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"])
|
||||
validate_cliresult(result)
|
||||
assert "upgraded to 3"
|
||||
assert isolated_pio_home.join("platforms", "native",
|
||||
"platform.json").check()
|
||||
assert "upgraded to 3" in result.output
|
||||
|
||||
# check PlatformIO 3.0 boards
|
||||
assert board_ids == set([p.basename[:-5] for p in boards.listdir()])
|
||||
|
Reference in New Issue
Block a user