Skip to content

Commit 7d1203d

Browse files
committed
Merge branch 'release/v1.2.2'
2 parents 923523d + 30e73f7 commit 7d1203d

File tree

5 files changed

+36
-23
lines changed

5 files changed

+36
-23
lines changed

Diff for: get-platformio.py

+1-1
Large diffs are not rendered by default.

Diff for: pioinstaller/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import logging.config
1616

17-
VERSION = (1, 2, 1)
17+
VERSION = (1, 2, 2)
1818
__version__ = ".".join([str(s) for s in VERSION])
1919

2020
__title__ = "platformio-installer"

Diff for: pioinstaller/core.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ def get_core_dir(force_to_root=False):
5757
return core_dir
5858

5959

60-
def get_cache_dir(path=None):
61-
core_dir = path or get_core_dir()
62-
path = os.path.join(core_dir, ".cache")
63-
if not os.path.isdir(path):
64-
os.makedirs(path)
65-
return path
60+
def get_cache_dir():
61+
cache_dir = (
62+
os.getenv("PLATFORMIO_CACHE_DIR")
63+
if os.getenv("PLATFORMIO_CACHE_DIR")
64+
else os.path.join(get_core_dir(), ".cache")
65+
)
66+
if not os.path.isdir(cache_dir):
67+
os.makedirs(cache_dir)
68+
return cache_dir
6669

6770

6871
def install_platformio_core(shutdown_piohome=True, develop=False, ignore_pythons=None):

Diff for: pioinstaller/penv.py

+23-13
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def create_core_penv(penv_dir=None, ignore_pythons=None):
6969
get_penv_bin_dir(penv_dir), "python.exe" if util.IS_WINDOWS else "python"
7070
)
7171
init_state(python_exe, penv_dir)
72-
install_pip(python_exe, penv_dir)
72+
update_pip(python_exe, penv_dir)
7373
click.echo("Virtual environment has been successfully created!")
7474
return result_dir
7575

@@ -107,7 +107,7 @@ def create_with_local_venv(python_exe, penv_dir):
107107
util.safe_remove_dir(penv_dir)
108108
log.debug("Creating virtual environment: %s", " ".join(command))
109109
try:
110-
subprocess.check_output(command, stderr=subprocess.PIPE)
110+
subprocess.run(command, check=True)
111111
return penv_dir
112112
except Exception as e: # pylint:disable=broad-except
113113
last_error = e
@@ -128,7 +128,7 @@ def create_with_remote_venv(python_exe, penv_dir):
128128
raise exception.PIOInstallerException("Could not find virtualenv script")
129129
command = [python_exe, venv_script_path, penv_dir]
130130
log.debug("Creating virtual environment: %s", " ".join(command))
131-
subprocess.check_output(command, stderr=subprocess.PIPE)
131+
subprocess.run(command, check=True)
132132
return penv_dir
133133

134134

@@ -178,26 +178,36 @@ def save_state(state, penv_dir=None):
178178
return state_path
179179

180180

181-
def install_pip(python_exe, penv_dir):
182-
click.echo("Updating Python package manager (PIP) in a virtual environment")
181+
def update_pip(python_exe, penv_dir):
182+
click.echo("Updating Python package manager (PIP) in the virtual environment")
183183
try:
184184
log.debug("Creating pip.conf file in %s", penv_dir)
185185
with open(os.path.join(penv_dir, "pip.conf"), "w") as fp:
186186
fp.write("\n".join(["[global]", "user=no"]))
187187

188-
log.debug("Downloading 'get-pip.py' installer...")
189-
get_pip_path = os.path.join(
190-
os.path.dirname(penv_dir), ".cache", "tmp", os.path.basename(PIP_URL)
191-
)
192-
util.download_file(PIP_URL, get_pip_path)
188+
try:
189+
log.debug("Updating PIP ...")
190+
subprocess.run(
191+
[python_exe, "-m", "pip", "install", "-U", "pip"], check=True
192+
)
193+
except subprocess.CalledProcessError as e:
194+
log.debug(
195+
"Could not update PIP. Error: %s",
196+
str(e),
197+
)
198+
log.debug("Downloading 'get-pip.py' installer...")
199+
get_pip_path = os.path.join(
200+
os.path.dirname(penv_dir), ".cache", "tmp", os.path.basename(PIP_URL)
201+
)
202+
util.download_file(PIP_URL, get_pip_path)
203+
log.debug("Installing PIP ...")
204+
subprocess.run([python_exe, get_pip_path], check=True)
193205

194-
log.debug("Installing pip")
195-
subprocess.check_output([python_exe, get_pip_path], stderr=subprocess.PIPE)
196206
click.echo("PIP has been successfully updated!")
197207
return True
198208
except Exception as e: # pylint:disable=broad-except
199209
log.debug(
200-
"Could not install pip. Error: %s",
210+
"Could not install PIP. Error: %s",
201211
str(e),
202212
)
203213
return False

Diff for: setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
"requests==2.31.0",
4141
"colorama==0.4.6",
4242
"semantic-version==2.8.5", # >2.8.5 does not support Python 3.6
43-
"certifi==2023.7.22",
43+
"certifi==2023.11.17",
4444
# Misc
45-
"wheel==0.41.0",
45+
"wheel==0.42.0",
4646
],
4747
packages=find_packages(),
4848
entry_points={

0 commit comments

Comments
 (0)