mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Fix "FileExistsError" when "platformio ci" command is used in pair with "--keep-build-dir" option
This commit is contained in:
@ -4,6 +4,11 @@ Release Notes
|
|||||||
PlatformIO 3.0
|
PlatformIO 3.0
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
3.6.6 (2019-??-??)
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Fixed "FileExistsError" when `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ command is used in pair with ``--keep-build-dir`` option
|
||||||
|
|
||||||
3.6.5 (2019-03-07)
|
3.6.5 (2019-03-07)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
"--build-dir",
|
"--build-dir",
|
||||||
default=mkdtemp,
|
default=mkdtemp,
|
||||||
type=click.Path(
|
type=click.Path(
|
||||||
exists=True,
|
|
||||||
file_okay=False,
|
file_okay=False,
|
||||||
dir_okay=True,
|
dir_okay=True,
|
||||||
writable=True,
|
writable=True,
|
||||||
@ -134,7 +133,8 @@ def _copy_contents(dst_dir, contents):
|
|||||||
if dst_dir_name == "src" and len(items['dirs']) == 1:
|
if dst_dir_name == "src" and len(items['dirs']) == 1:
|
||||||
copytree(list(items['dirs']).pop(), dst_dir, symlinks=True)
|
copytree(list(items['dirs']).pop(), dst_dir, symlinks=True)
|
||||||
else:
|
else:
|
||||||
makedirs(dst_dir)
|
if not isdir(dst_dir):
|
||||||
|
makedirs(dst_dir)
|
||||||
for d in items['dirs']:
|
for d in items['dirs']:
|
||||||
copytree(d, join(dst_dir, basename(d)), symlinks=True)
|
copytree(d, join(dst_dir, basename(d)), symlinks=True)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from os.path import join
|
from os.path import isfile, join
|
||||||
|
|
||||||
from platformio.commands.ci import cli as cmd_ci
|
from platformio.commands.ci import cli as cmd_ci
|
||||||
from platformio.commands.lib import cli as cmd_lib
|
from platformio.commands.lib import cli as cmd_lib
|
||||||
@ -32,6 +32,36 @@ def test_ci_boards(clirunner, validate_cliresult):
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
|
|
||||||
|
|
||||||
|
def test_ci_build_dir(clirunner, tmpdir_factory, validate_cliresult):
|
||||||
|
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
||||||
|
result = clirunner.invoke(cmd_ci, [
|
||||||
|
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno",
|
||||||
|
"--build-dir", build_dir
|
||||||
|
])
|
||||||
|
validate_cliresult(result)
|
||||||
|
assert not isfile(join(build_dir, "platformio.ini"))
|
||||||
|
|
||||||
|
|
||||||
|
def test_ci_keep_build_dir(clirunner, tmpdir_factory, validate_cliresult):
|
||||||
|
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
||||||
|
result = clirunner.invoke(cmd_ci, [
|
||||||
|
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno",
|
||||||
|
"--build-dir", build_dir, "--keep-build-dir"
|
||||||
|
])
|
||||||
|
validate_cliresult(result)
|
||||||
|
assert isfile(join(build_dir, "platformio.ini"))
|
||||||
|
|
||||||
|
# 2nd attempt
|
||||||
|
result = clirunner.invoke(cmd_ci, [
|
||||||
|
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "metro",
|
||||||
|
"--build-dir", build_dir, "--keep-build-dir"
|
||||||
|
])
|
||||||
|
validate_cliresult(result)
|
||||||
|
|
||||||
|
assert "board: uno" in result.output
|
||||||
|
assert "board: metro" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_ci_project_conf(clirunner, validate_cliresult):
|
def test_ci_project_conf(clirunner, validate_cliresult):
|
||||||
project_dir = join("examples", "wiring-blink")
|
project_dir = join("examples", "wiring-blink")
|
||||||
result = clirunner.invoke(cmd_ci, [
|
result = clirunner.invoke(cmd_ci, [
|
||||||
|
Reference in New Issue
Block a user