forked from platformio/platformio-core
Override default “platformio.ini” with a custom using "-c, --project-conf" option // Resolve #1913
This commit is contained in:
@ -11,8 +11,10 @@ PlatformIO 4.0
|
||||
(`issue #895 <https://github.com/platformio/platformio-core/issues/895>`_)
|
||||
* Share common (global) options between declared build environments using ``[env]`` section in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #1643 <https://github.com/platformio/platformio-core/issues/1643>`_)
|
||||
* Include external configuration files with `extra_configs <http://docs.platformio.org/page/projectconf/section_platformio.html#extra-configs>`__ option
|
||||
* Include external configuration files in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with `extra_configs <http://docs.platformio.org/page/projectconf/section_platformio.html#extra-configs>`__ option
|
||||
(`issue #1590 <https://github.com/platformio/platformio-core/issues/1590>`_)
|
||||
* Override default `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with a custom using ``-c, --project-conf`` option for `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__, `platformio debug <http://docs.platformio.org/page/userguide/cmd_debug.html>`__, or `platformio test <http://docs.platformio.org/page/userguide/cmd_test.html>`__ commands
|
||||
(`issue #1913 <https://github.com/platformio/platformio-core/issues/1913>`_)
|
||||
* Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
|
||||
* Added support for the latest Python "Click" package (CLI Builder)
|
||||
(`issue #349 <https://github.com/platformio/platformio-core/issues/349>`_)
|
||||
|
2
docs
2
docs
Submodule docs updated: 45a3b5a365...c5a33bc006
@ -59,7 +59,7 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
|
||||
file_okay=False, dir_okay=True, writable=True, resolve_path=True))
|
||||
@click.option("--keep-build-dir", is_flag=True)
|
||||
@click.option(
|
||||
"-C",
|
||||
"-c",
|
||||
"--project-conf",
|
||||
type=click.Path(
|
||||
exists=True,
|
||||
|
@ -47,12 +47,21 @@ from platformio.project.helpers import (
|
||||
dir_okay=True,
|
||||
writable=True,
|
||||
resolve_path=True))
|
||||
@click.option(
|
||||
"-c",
|
||||
"--project-conf",
|
||||
type=click.Path(
|
||||
exists=True,
|
||||
file_okay=True,
|
||||
dir_okay=False,
|
||||
readable=True,
|
||||
resolve_path=True))
|
||||
@click.option("-s", "--silent", is_flag=True)
|
||||
@click.option("-v", "--verbose", is_flag=True)
|
||||
@click.option("--disable-auto-clean", is_flag=True)
|
||||
@click.pass_context
|
||||
def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
disable_auto_clean):
|
||||
def cli(ctx, environment, target, upload_port, project_dir, project_conf,
|
||||
silent, verbose, disable_auto_clean):
|
||||
# find project directory on upper level
|
||||
if isfile(project_dir):
|
||||
project_dir = find_project_dir_above(project_dir)
|
||||
@ -70,7 +79,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
fg="yellow")
|
||||
|
||||
config = ProjectConfig.get_instance(
|
||||
join(project_dir, "platformio.ini"))
|
||||
project_conf or join(project_dir, "platformio.ini"))
|
||||
config.validate()
|
||||
|
||||
results = []
|
||||
|
@ -27,7 +27,7 @@ CORE_PACKAGES = {
|
||||
"contrib-piohome": "^2.0.1",
|
||||
"contrib-pysite":
|
||||
"~2.%d%d.190418" % (sys.version_info[0], sys.version_info[1]),
|
||||
"tool-pioplus": "^2.1.5",
|
||||
"tool-pioplus": "^2.2.0",
|
||||
"tool-unity": "~1.20403.0",
|
||||
"tool-scons": "~2.20501.7" if util.PY2 else "~3.30005.0"
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ def test_global_install_archive(clirunner, validate_cliresult,
|
||||
isolated_pio_home):
|
||||
result = clirunner.invoke(cmd_lib, [
|
||||
"-g", "install",
|
||||
"http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.62.zip",
|
||||
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip",
|
||||
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip@5.8.2",
|
||||
"SomeLib=http://dl.platformio.org/libraries/archives/0/9540.tar.gz",
|
||||
@ -77,10 +76,7 @@ def test_global_install_archive(clirunner, validate_cliresult,
|
||||
assert result.exit_code != 0
|
||||
|
||||
items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()]
|
||||
items2 = [
|
||||
"RadioHead-1.62", "ArduinoJson", "SomeLib_ID54",
|
||||
"OneWire_ID1", "ESP32WebServer"
|
||||
]
|
||||
items2 = ["ArduinoJson", "SomeLib_ID54", "OneWire_ID1", "ESP32WebServer"]
|
||||
assert set(items1) >= set(items2)
|
||||
|
||||
|
||||
@ -126,7 +122,7 @@ def test_install_duplicates(clirunner, validate_cliresult, without_internet):
|
||||
# archive
|
||||
result = clirunner.invoke(cmd_lib, [
|
||||
"-g", "install",
|
||||
"http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.62.zip"
|
||||
"https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip"
|
||||
])
|
||||
validate_cliresult(result)
|
||||
assert "is already installed" in result.output
|
||||
@ -148,7 +144,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
||||
("Source: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip",
|
||||
"Version: 5.10.1",
|
||||
"Source: git+https://github.com/gioblu/PJON.git#3.0",
|
||||
"Version: 1fb26fd", "RadioHead-1.62")
|
||||
"Version: 1fb26fd")
|
||||
])
|
||||
|
||||
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
|
||||
@ -161,10 +157,9 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
||||
items1 = [i['name'] for i in json.loads(result.output)]
|
||||
items2 = [
|
||||
"ESP32WebServer", "ArduinoJson", "ArduinoJson", "ArduinoJson",
|
||||
"ArduinoJson", "AsyncMqttClient", "AsyncTCP", "SomeLib",
|
||||
"ESPAsyncTCP", "NeoPixelBus", "OneWire", "PJON", "PJON",
|
||||
"PubSubClient", "RFcontrol", "RadioHead-1.62", "platformio-libmirror",
|
||||
"rs485-nodeproto"
|
||||
"ArduinoJson", "AsyncMqttClient", "AsyncTCP", "SomeLib", "ESPAsyncTCP",
|
||||
"NeoPixelBus", "OneWire", "PJON", "PJON", "PubSubClient", "RFcontrol",
|
||||
"platformio-libmirror", "rs485-nodeproto"
|
||||
]
|
||||
assert sorted(items1) == sorted(items2)
|
||||
|
||||
@ -172,9 +167,9 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
||||
"{name}@{version}".format(**item) for item in json.loads(result.output)
|
||||
]
|
||||
versions2 = [
|
||||
'ArduinoJson@5.8.2', 'ArduinoJson@5.10.1', 'AsyncMqttClient@0.8.2',
|
||||
'NeoPixelBus@2.2.4', 'PJON@07fe9aa', 'PJON@1fb26fd',
|
||||
'PubSubClient@bef5814', 'RFcontrol@77d4eb3f8a', 'RadioHead-1.62@0.0.0'
|
||||
"ArduinoJson@5.8.2", "ArduinoJson@5.10.1", "AsyncMqttClient@0.8.2",
|
||||
"NeoPixelBus@2.2.4", "PJON@07fe9aa", "PJON@1fb26fd",
|
||||
"PubSubClient@bef5814", "RFcontrol@77d4eb3f8a"
|
||||
]
|
||||
assert set(versions1) >= set(versions2)
|
||||
|
||||
@ -205,7 +200,7 @@ def test_global_lib_update(clirunner, validate_cliresult):
|
||||
# update rest libraries
|
||||
result = clirunner.invoke(cmd_lib, ["-g", "update"])
|
||||
validate_cliresult(result)
|
||||
assert result.output.count("[Detached]") == 6
|
||||
assert result.output.count("[Detached]") == 5
|
||||
assert result.output.count("[Up-to-date]") == 11
|
||||
assert "Uninstalling RFcontrol @ 77d4eb3f8a" in result.output
|
||||
|
||||
@ -235,10 +230,10 @@ def test_global_lib_uninstall(clirunner, validate_cliresult,
|
||||
|
||||
items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()]
|
||||
items2 = [
|
||||
"RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror",
|
||||
"rs485-nodeproto", "platformio-libmirror",
|
||||
"PubSubClient", "ArduinoJson@src-69ebddd821f771debe7ee734d3c7fa81",
|
||||
"ESPAsyncTCP_ID305", "SomeLib_ID54", "NeoPixelBus_ID547",
|
||||
"PJON", "AsyncMqttClient_ID346", "ArduinoJson_ID64",
|
||||
"ESPAsyncTCP_ID305", "SomeLib_ID54", "NeoPixelBus_ID547", "PJON",
|
||||
"AsyncMqttClient_ID346", "ArduinoJson_ID64",
|
||||
"PJON@src-79de467ebe19de18287becff0a1fb42d", "ESP32WebServer"
|
||||
]
|
||||
assert set(items1) == set(items2)
|
||||
|
@ -18,6 +18,12 @@ import requests
|
||||
from platformio import exception, util
|
||||
|
||||
|
||||
def test_platformio_cli():
|
||||
result = util.exec_command(["pio", "--help"])
|
||||
assert result['returncode'] == 0
|
||||
assert "Usage: pio [OPTIONS] COMMAND [ARGS]..." in result['out']
|
||||
|
||||
|
||||
def test_ping_internet_ips():
|
||||
for ip in util.PING_INTERNET_IPS:
|
||||
requests.get("http://%s" % ip, allow_redirects=False, timeout=2)
|
||||
|
Reference in New Issue
Block a user