Fix typo and naming format for extensions

pull/4345/head
Sergei Silnov 2019-10-24 13:20:25 +02:00
rodzic 1c798393e2
commit 5e6aae3e04
10 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -593,8 +593,8 @@ def init_cli(verbose_output=None):
all_actions = {}
# Load extensions from components dir
idf_py_extensions_path = os.path.join(os.environ["IDF_PATH"], "tools", "idf_py_actions")
extra_pathes = os.environ.get("IDF_EXTRA_ACTIONS_PATH", "").split(';')
extension_dirs = [idf_py_extensions_path] + extra_pathes
extra_paths = os.environ.get("IDF_EXTRA_ACTIONS_PATH", "").split(';')
extension_dirs = [idf_py_extensions_path] + extra_paths
extensions = {}
for directory in extension_dirs:
@ -604,7 +604,7 @@ def init_cli(verbose_output=None):
sys.path.append(directory)
for _finder, name, _ispkg in sorted(iter_modules([directory])):
if name.startswith('idf_'):
if name.endswith('_ext'):
extensions[name] = import_module(name)
for name, extension in extensions.items():

Wyświetl plik

@ -1,5 +1,6 @@
# idf.py extensions
Python modules (subdirectories and files) in this directory named `idf_[your_extension]` will be loaded as idf.py extensions.
Python modules (subdirectories and files) in this directory named `[your_extension]_ext` will be loaded as idf.py extensions.
If you want to provide extra extensions just provide `;` separated list of directories with extensions in `IDF_EXTRA_ACTIONS_PATH`. Extensions will be loaded in alphanumeric order.
Command line arguments parsing and extension mechanism is implemented on top of [Click](https://click.palletsprojects.com/en/5.x/) (versions >=5.0 are supported).
They should define a function `action_extensions(base_actions, project_path)` where:

Wyświetl plik

@ -4,7 +4,7 @@ import sys
import click
from idf_py_actions.contstants import GENERATOR_CMDS, GENERATOR_VERBOSE, SUPPORTED_TARGETS
from idf_py_actions.constants import GENERATOR_CMDS, GENERATOR_VERBOSE, SUPPORTED_TARGETS
from idf_py_actions.errors import FatalError
from idf_py_actions.global_options import global_options
from idf_py_actions.tools import ensure_build_directory, idf_version, merge_action_lists, realpath, run_tool

Wyświetl plik

@ -3,7 +3,7 @@ import re
import subprocess
import sys
from .contstants import GENERATORS
from .constants import GENERATORS
from .errors import FatalError

Wyświetl plik

@ -32,8 +32,8 @@ except ImportError:
current_dir = os.path.dirname(os.path.realpath(__file__))
idf_py_path = os.path.join(current_dir, '..', 'idf.py')
extension_path = os.path.join(current_dir, 'test_idf_extensions', 'idf_test_extension')
link_path = os.path.join(current_dir, '..', 'idf_py_actions', 'idf_test_extension')
extension_path = os.path.join(current_dir, 'test_idf_extensions', 'test_ext')
link_path = os.path.join(current_dir, '..', 'idf_py_actions', 'test_ext')
class TestExtensions(unittest.TestCase):