forked from platformio/platformio-core
Move FS related helpers to fs.py module
This commit is contained in:
1 parent
1b2e410f12
commit
6a90388649
26 files changed
+209
-182
No files matched your search
@@ -26,7 +26,7 @@ from twisted.internet import reactor # pylint: disable=import-error
|
||||
from twisted.internet import stdio # pylint: disable=import-error
|
||||
from twisted.internet import task # pylint: disable=import-error
|
||||
|
||||
from platformio import app, exception, util
|
||||
from platformio import app, exception, fs, proc, util
|
||||
from platformio.commands.debug import helpers, initcfgs
|
||||
from platformio.commands.debug.process import BaseProcess
|
||||
from platformio.commands.debug.server import DebugServer
|
||||
@@ -198,7 +198,7 @@ class GDBClient(BaseProcess): # pylint: disable=too-many-instance-attributes
|
||||
def processEnded(self, reason): # pylint: disable=unused-argument
|
||||
self._unlock_session()
|
||||
if self._gdbsrc_dir and isdir(self._gdbsrc_dir):
|
||||
util.rmtree_(self._gdbsrc_dir)
|
||||
fs.rmtree(self._gdbsrc_dir)
|
||||
if self._debug_server:
|
||||
self._debug_server.terminate()
|
||||
|
||||
@@ -274,7 +274,7 @@ class GDBClient(BaseProcess): # pylint: disable=too-many-instance-attributes
|
||||
else:
|
||||
kill = ["kill", pid]
|
||||
try:
|
||||
util.exec_command(kill)
|
||||
proc.exec_command(kill)
|
||||
except: # pylint: disable=bare-except
|
||||
pass
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from os.path import isfile, join
|
||||
|
||||
import click
|
||||
|
||||
from platformio import exception, util
|
||||
from platformio import exception, fs, proc, util
|
||||
from platformio.commands.debug import helpers
|
||||
from platformio.managers.core import inject_contrib_pysite
|
||||
from platformio.project.config import ProjectConfig
|
||||
@@ -61,7 +61,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface,
|
||||
if os.getenv(sysenv):
|
||||
project_dir = os.getenv(sysenv)
|
||||
|
||||
with util.cd(project_dir):
|
||||
with fs.cd(project_dir):
|
||||
config = ProjectConfig.get_instance(
|
||||
project_conf or join(project_dir, "platformio.ini"))
|
||||
config.validate(envs=[environment] if environment else None)
|
||||
@@ -83,16 +83,14 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface,
|
||||
"Could not load debug configuration")
|
||||
|
||||
if "--version" in __unprocessed:
|
||||
result = util.exec_command([configuration['gdb_path'], "--version"])
|
||||
result = proc.exec_command([configuration['gdb_path'], "--version"])
|
||||
if result['returncode'] == 0:
|
||||
return click.echo(result['out'])
|
||||
raise exception.PlatformioException("\n".join(
|
||||
[result['out'], result['err']]))
|
||||
|
||||
try:
|
||||
util.ensure_udev_rules()
|
||||
except NameError:
|
||||
pass
|
||||
fs.ensure_udev_rules()
|
||||
except exception.InvalidUdevRules as e:
|
||||
for line in str(e).split("\n") + [""]:
|
||||
click.echo(
|
||||
|
||||
Reference in new issue
Block a user