Skip to content

Commit c46d14c

Browse files
committed
Added support for project-based Zephyr manifest files
Resolves #825 Changes tracked in platformio/zephyr#23
1 parent 4d46eda commit c46d14c

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

platform.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import subprocess
1818

1919
from platformio.managers.platform import PlatformBase
20+
from platformio.project.helpers import get_project_dir
2021

2122

2223
IS_WINDOWS = sys.platform.startswith("win")
@@ -116,16 +117,26 @@ def install_package(self, name, *args, **kwargs):
116117
if name != "framework-zephyr":
117118
return pkg
118119

119-
if not os.path.isfile(os.path.join(pkg.path, "_pio", "state.json")):
120-
self.pm.log.info("Installing Zephyr project dependencies...")
121-
try:
122-
subprocess.run([
123-
os.path.normpath(sys.executable),
124-
os.path.join(pkg.path, "scripts", "platformio", "install-deps.py"),
125-
"--platform", self.name
126-
])
127-
except subprocess.CalledProcessError:
128-
self.pm.log.info("Failed to install Zephyr dependencies!")
120+
prj_west_manifest = os.path.join(get_project_dir(), "west.yml")
121+
try:
122+
(
123+
subprocess.run(
124+
[
125+
os.path.normpath(sys.executable),
126+
os.path.join(
127+
pkg.path, "scripts", "platformio", "install-deps.py"
128+
),
129+
"--platform",
130+
self.name,
131+
] + (
132+
["--manifest", prj_west_manifest]
133+
if os.path.isfile(prj_west_manifest)
134+
else []
135+
)
136+
)
137+
)
138+
except subprocess.CalledProcessError:
139+
self.pm.log.info("Failed to install Zephyr dependencies!")
129140

130141
return pkg
131142

0 commit comments

Comments
 (0)