Requiring PIO >= 5.0.3
This commit is contained in:
parent
9fbce867ee
commit
96bdc4c830
|
@ -20,12 +20,14 @@ board = env.BoardConfig()
|
||||||
|
|
||||||
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple")
|
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple")
|
||||||
assert os.path.isdir(FRAMEWORK_DIR)
|
assert os.path.isdir(FRAMEWORK_DIR)
|
||||||
assert os.path.isdir("buildroot/share/PlatformIO/variants")
|
|
||||||
|
source_root = os.path.join("buildroot", "share", "PlatformIO", "variants")
|
||||||
|
assert os.path.isdir(source_root)
|
||||||
|
|
||||||
variant = board.get("build.variant")
|
variant = board.get("build.variant")
|
||||||
variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant)
|
variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant)
|
||||||
|
|
||||||
source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
|
source_dir = os.path.join(source_root, variant)
|
||||||
assert os.path.isdir(source_dir)
|
assert os.path.isdir(source_dir)
|
||||||
|
|
||||||
if os.path.isdir(variant_dir):
|
if os.path.isdir(variant_dir):
|
||||||
|
|
|
@ -4,19 +4,7 @@
|
||||||
import os,shutil
|
import os,shutil
|
||||||
from SCons.Script import DefaultEnvironment
|
from SCons.Script import DefaultEnvironment
|
||||||
from platformio import util
|
from platformio import util
|
||||||
try:
|
from platformio.package.meta import PackageSpec
|
||||||
# PIO < 4.4
|
|
||||||
from platformio.managers.package import PackageManager
|
|
||||||
except ImportError:
|
|
||||||
# PIO >= 4.4
|
|
||||||
from platformio.package.meta import PackageSpec as PackageManager
|
|
||||||
|
|
||||||
def parse_pkg_uri(spec):
|
|
||||||
if PackageManager.__name__ == 'PackageSpec':
|
|
||||||
return PackageManager(spec).name
|
|
||||||
else:
|
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(spec)
|
|
||||||
return name
|
|
||||||
|
|
||||||
def copytree(src, dst, symlinks=False, ignore=None):
|
def copytree(src, dst, symlinks=False, ignore=None):
|
||||||
for item in os.listdir(src):
|
for item in os.listdir(src):
|
||||||
|
@ -41,7 +29,7 @@ framewords = {
|
||||||
if len(platform_packages) == 0:
|
if len(platform_packages) == 0:
|
||||||
platform_name = framewords[platform.__class__.__name__]
|
platform_name = framewords[platform.__class__.__name__]
|
||||||
else:
|
else:
|
||||||
platform_name = parse_pkg_uri(platform_packages[0])
|
platform_name = PackageSpec(platform_packages[0]).name
|
||||||
|
|
||||||
FRAMEWORK_DIR = platform.get_package_dir(platform_name)
|
FRAMEWORK_DIR = platform.get_package_dir(platform_name)
|
||||||
assert os.path.isdir(FRAMEWORK_DIR)
|
assert os.path.isdir(FRAMEWORK_DIR)
|
||||||
|
|
Loading…
Reference in a new issue