mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Move MISSING to the compat
This commit is contained in:
@ -14,7 +14,8 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from platformio.project.config import MISSING, ProjectConfig, ProjectOptions
|
||||
from platformio.compat import MISSING
|
||||
from platformio.project.config import ProjectConfig, ProjectOptions
|
||||
|
||||
|
||||
def GetProjectConfig(env):
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
# pylint: disable=unused-import,no-name-in-module
|
||||
|
||||
import importlib.util
|
||||
import inspect
|
||||
import locale
|
||||
import sys
|
||||
@ -32,6 +33,7 @@ PY2 = sys.version_info[0] == 2 # DO NOT REMOVE IT. ESP8266/ESP32 depend on it
|
||||
IS_CYGWIN = sys.platform.startswith("cygwin")
|
||||
IS_WINDOWS = WINDOWS = sys.platform.startswith("win")
|
||||
IS_MACOS = sys.platform.startswith("darwin")
|
||||
MISSING = object()
|
||||
string_types = (str,)
|
||||
|
||||
|
||||
@ -56,8 +58,6 @@ def hashlib_encode_data(data):
|
||||
|
||||
|
||||
def load_python_module(name, pathname):
|
||||
import importlib.util # pylint: disable=import-outside-toplevel
|
||||
|
||||
spec = importlib.util.spec_from_file_location(name, pathname)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
@ -15,6 +15,7 @@
|
||||
import os
|
||||
|
||||
from platformio import fs, telemetry, util
|
||||
from platformio.compat import MISSING
|
||||
from platformio.debug.exception import DebugInvalidOptionsError, DebugSupportError
|
||||
from platformio.exception import UserSideException
|
||||
from platformio.platform.exception import InvalidBoardManifest
|
||||
@ -34,14 +35,14 @@ class PlatformBoardConfig(object):
|
||||
"Please specify name, url and vendor fields for " + manifest_path
|
||||
)
|
||||
|
||||
def get(self, path, default=None):
|
||||
def get(self, path, default=MISSING):
|
||||
try:
|
||||
value = self._manifest
|
||||
for k in path.split("."):
|
||||
value = value[k]
|
||||
return value
|
||||
except KeyError:
|
||||
if default is not None:
|
||||
if default != MISSING:
|
||||
return default
|
||||
raise KeyError("Invalid board option '%s'" % path)
|
||||
|
||||
|
@ -21,7 +21,7 @@ import re
|
||||
import click
|
||||
|
||||
from platformio import fs
|
||||
from platformio.compat import string_types
|
||||
from platformio.compat import MISSING, string_types
|
||||
from platformio.project import exception
|
||||
from platformio.project.options import ProjectOptions
|
||||
|
||||
@ -38,9 +38,6 @@ CONFIG_HEADER = """
|
||||
"""
|
||||
|
||||
|
||||
MISSING = object()
|
||||
|
||||
|
||||
class ProjectConfigBase(object):
|
||||
|
||||
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
|
||||
|
Reference in New Issue
Block a user