* [PATCH 00/11] devtool: code style fixes
@ 2015-05-11 13:17 Markus Lehtonen
2015-05-11 13:17 ` [PATCH 01/11] devtool: standard plugins: add missing docstrings Markus Lehtonen
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
This patchset contains numerous small non-functional changes to fix some style
errors and to improve the readability of the devtool code.
Markus Lehtonen (11):
devtool: standard plugins: add missing docstrings
devtool: standard plugins: remove unused import
devtool: standard plugins: rename usunused variable
devtool: lib: add missing docstrings
devtool: lib: remove unnecessary re-import
devtool: lib: wrap long lines in code
devtool: deploy plugin: fix bad indentation
devtool: deploy plugin: add missing docstrings
devtool: deploy plugin: remove unnecessary re-import
devtool: deploy plugin: rename unused variables
devtool: deploy plugin: wrap long lines in code
scripts/lib/devtool/__init__.py | 15 ++++--
scripts/lib/devtool/deploy.py | 112 ++++++++++++++++++++++++++++------------
scripts/lib/devtool/standard.py | 23 +++++++--
3 files changed, 110 insertions(+), 40 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/11] devtool: standard plugins: add missing docstrings
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 02/11] devtool: standard plugins: remove unused import Markus Lehtonen
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/standard.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 81a44d4..55580ee 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""Devtool standard plugins"""
import os
import sys
@@ -29,10 +30,12 @@ from devtool import exec_build_env_command, setup_tinfoil
logger = logging.getLogger('devtool')
def plugin_init(pluginlist):
+ """Plugin initialization"""
pass
def add(args, config, basepath, workspace):
+ """Entry point for the devtool 'add' subcommand"""
import bb
import oe.recipeutils
@@ -120,6 +123,7 @@ def add(args, config, basepath, workspace):
def _check_compatible_recipe(pn, d):
+ """Check if the recipe is supported by devtool"""
if pn == 'perf':
logger.error("The perf recipe does not actually check out source and thus cannot be supported by this tool")
return False
@@ -152,6 +156,7 @@ def _check_compatible_recipe(pn, d):
def _get_recipe_file(cooker, pn):
+ """Find recipe file corresponding a package name"""
import oe.recipeutils
recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
if not recipefile:
@@ -178,6 +183,7 @@ def _parse_recipe(config, tinfoil, pn, appends):
tinfoil.config_data)
def extract(args, config, basepath, workspace):
+ """Entry point for the devtool 'extract' subcommand"""
import bb
tinfoil = setup_tinfoil()
@@ -195,9 +201,11 @@ def extract(args, config, basepath, workspace):
def _extract_source(srctree, keep_temp, devbranch, d):
+ """Extract sources of a recipe"""
import bb.event
def eventfilter(name, handler, event, d):
+ """Bitbake event filter for devtool extract operation"""
if name == 'base_eventhandler':
return True
else:
@@ -247,6 +255,7 @@ def _extract_source(srctree, keep_temp, devbranch, d):
# are to handle e.g. linux-yocto's extra tasks
executed = []
def exec_task_func(func, report):
+ """Run specific bitbake task for a recipe"""
if not func in executed:
deps = crd.getVarFlag(func, 'deps')
if deps:
@@ -319,12 +328,15 @@ def _extract_source(srctree, keep_temp, devbranch, d):
return initial_rev
def _add_md5(config, recipename, filename):
+ """Record checksum of a recipe to the md5-file of the workspace"""
import bb.utils
md5 = bb.utils.md5_file(filename)
with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5))
def _check_preserve(config, recipename):
+ """Check if a recipe was manually changed and needs to be saved in 'attic'
+ directory"""
import bb.utils
origfile = os.path.join(config.workspace_path, '.devtool_md5')
newfile = os.path.join(config.workspace_path, '.devtool_md5_new')
@@ -358,6 +370,7 @@ def _check_preserve(config, recipename):
def modify(args, config, basepath, workspace):
+ """Entry point for the devtool 'modify' subcommand"""
import bb
import oe.recipeutils
@@ -457,6 +470,7 @@ def modify(args, config, basepath, workspace):
def update_recipe(args, config, basepath, workspace):
+ """Entry point for the devtool 'update-recipe' subcommand"""
if not args.recipename in workspace:
logger.error("no recipe named %s in your workspace" % args.recipename)
return -1
@@ -487,7 +501,7 @@ def update_recipe(args, config, basepath, workspace):
mode = args.mode
def remove_patches(srcuri, patchlist):
- # Remove any patches that we don't need
+ """Remove patches"""
updated = False
for patch in patchlist:
patchfile = os.path.basename(patch)
@@ -639,6 +653,7 @@ def update_recipe(args, config, basepath, workspace):
def status(args, config, basepath, workspace):
+ """Entry point for the devtool 'status' subcommand"""
if workspace:
for recipe, value in workspace.iteritems():
print("%s: %s" % (recipe, value))
@@ -648,6 +663,7 @@ def status(args, config, basepath, workspace):
def reset(args, config, basepath, workspace):
+ """Entry point for the devtool 'reset' subcommand"""
import bb.utils
if args.recipename:
if args.all:
@@ -689,6 +705,7 @@ def reset(args, config, basepath, workspace):
def build(args, config, basepath, workspace):
+ """Entry point for the devtool 'build' subcommand"""
import bb
if not args.recipename in workspace:
logger.error("no recipe named %s in your workspace" % args.recipename)
@@ -700,6 +717,7 @@ def build(args, config, basepath, workspace):
def register_commands(subparsers, context):
+ """Register devtool subcommands from this plugin"""
parser_add = subparsers.add_parser('add', help='Add a new recipe',
description='Adds a new recipe')
parser_add.add_argument('recipename', help='Name for new recipe to add')
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/11] devtool: standard plugins: remove unused import
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
2015-05-11 13:17 ` [PATCH 01/11] devtool: standard plugins: add missing docstrings Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 03/11] devtool: standard plugins: rename usunused variable Markus Lehtonen
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/standard.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 55580ee..614bcdb 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -20,7 +20,6 @@ import os
import sys
import re
import shutil
-import glob
import tempfile
import logging
import argparse
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/11] devtool: standard plugins: rename usunused variable
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
2015-05-11 13:17 ` [PATCH 01/11] devtool: standard plugins: add missing docstrings Markus Lehtonen
2015-05-11 13:17 ` [PATCH 02/11] devtool: standard plugins: remove unused import Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 04/11] devtool: lib: add missing docstrings Markus Lehtonen
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/standard.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 614bcdb..2a483cf 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -97,7 +97,7 @@ def add(args, config, basepath, workspace):
source = srctree
if args.version:
extracmdopts += ' -V %s' % args.version
- stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts))
+ stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts))
logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile)
_add_md5(config, args.recipename, recipefile)
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/11] devtool: lib: add missing docstrings
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (2 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 03/11] devtool: standard plugins: rename usunused variable Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 05/11] devtool: lib: remove unnecessary re-import Markus Lehtonen
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/__init__.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 78ae0aa..00594eb 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
+"""Devtool plugins module"""
import os
import sys
@@ -26,6 +26,7 @@ import logging
logger = logging.getLogger('devtool')
def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
+ """Run a program in bitbake build context"""
import bb
if not 'cwd' in options:
options["cwd"] = builddir
@@ -49,6 +50,7 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
return bb.process.run('%s%s' % (init_prefix, cmd), **options)
def exec_watch(cmd, **options):
+ """Run program with stdout shown on sys.stdout"""
if isinstance(cmd, basestring) and not "shell" in options:
options["shell"] = True
@@ -68,6 +70,7 @@ def exec_watch(cmd, **options):
return buf
def setup_tinfoil():
+ """Initialize tinfoil api from bitbake"""
import scriptpath
bitbakepath = scriptpath.add_bitbake_lib_path()
if not bitbakepath:
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/11] devtool: lib: remove unnecessary re-import
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (3 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 04/11] devtool: lib: add missing docstrings Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 06/11] devtool: lib: wrap long lines in code Markus Lehtonen
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/__init__.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 00594eb..8866512 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -78,7 +78,6 @@ def setup_tinfoil():
sys.exit(1)
import bb.tinfoil
- import logging
tinfoil = bb.tinfoil.Tinfoil()
tinfoil.prepare(False)
tinfoil.logger.setLevel(logging.WARNING)
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/11] devtool: lib: wrap long lines in code
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (4 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 05/11] devtool: lib: remove unnecessary re-import Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 07/11] devtool: deploy plugin: fix bad indentation Markus Lehtonen
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/__init__.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 8866512..676bc52 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -36,14 +36,16 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
# the executable to bash to correctly set things up
if not 'executable' in options:
options['executable'] = 'bash'
- logger.debug('Executing command: "%s" using init path %s' % (cmd, init_path))
+ logger.debug('Executing command: "%s" using init path %s' %
+ (cmd, init_path))
init_prefix = '. %s %s > /dev/null && ' % (init_path, builddir)
else:
logger.debug('Executing command "%s"' % cmd)
init_prefix = ''
if watch:
if sys.stdout.isatty():
- # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly)
+ # Fool bitbake into thinking it's outputting to a terminal
+ # (because it is, indirectly)
cmd = 'script -q -c "%s" /dev/null' % cmd
return exec_watch('%s%s' % (init_prefix, cmd), **options)
else:
@@ -74,7 +76,8 @@ def setup_tinfoil():
import scriptpath
bitbakepath = scriptpath.add_bitbake_lib_path()
if not bitbakepath:
- logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
+ logger.error("Unable to find bitbake by searching parent directory of "
+ "this script or PATH")
sys.exit(1)
import bb.tinfoil
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/11] devtool: deploy plugin: fix bad indentation
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (5 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 06/11] devtool: lib: wrap long lines in code Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 08/11] devtool: deploy plugin: add missing docstrings Markus Lehtonen
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/deploy.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index f016b23..62c97fb 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -91,8 +91,8 @@ def undeploy(args, config, basepath, workspace):
deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list')
if not os.path.exists(deploy_file):
- logger.error('%s has not been deployed' % args.recipename)
- return -1
+ logger.error('%s has not been deployed' % args.recipename)
+ return -1
if args.dry_run:
print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target))
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/11] devtool: deploy plugin: add missing docstrings
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (6 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 07/11] devtool: deploy plugin: fix bad indentation Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 09/11] devtool: deploy plugin: remove unnecessary re-import Markus Lehtonen
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/deploy.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 62c97fb..b569398 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""Devtool plugin containing the deploy subcommands"""
import os
import subprocess
@@ -23,10 +24,12 @@ from devtool import exec_build_env_command
logger = logging.getLogger('devtool')
def plugin_init(pluginlist):
+ """Plugin initialization"""
pass
def deploy(args, config, basepath, workspace):
+ """Entry point for the devtool 'deploy' subcommand"""
import re
from devtool import exec_build_env_command
@@ -88,7 +91,7 @@ def deploy(args, config, basepath, workspace):
return 0
def undeploy(args, config, basepath, workspace):
-
+ """Entry point for the devtool 'undeploy' subcommand"""
deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list')
if not os.path.exists(deploy_file):
logger.error('%s has not been deployed' % args.recipename)
@@ -123,6 +126,7 @@ def undeploy(args, config, basepath, workspace):
def register_commands(subparsers, context):
+ """Register devtool subcommands from the deploy plugin"""
parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine')
parser_deploy.add_argument('recipename', help='Recipe to deploy')
parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]')
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/11] devtool: deploy plugin: remove unnecessary re-import
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (7 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 08/11] devtool: deploy plugin: add missing docstrings Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 10/11] devtool: deploy plugin: rename unused variables Markus Lehtonen
2015-05-11 13:17 ` [PATCH 11/11] devtool: deploy plugin: wrap long lines in code Markus Lehtonen
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/deploy.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index b569398..8637f19 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -31,7 +31,6 @@ def plugin_init(pluginlist):
def deploy(args, config, basepath, workspace):
"""Entry point for the devtool 'deploy' subcommand"""
import re
- from devtool import exec_build_env_command
if not args.recipename in workspace:
logger.error("no recipe named %s in your workspace" % args.recipename)
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/11] devtool: deploy plugin: rename unused variables
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (8 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 09/11] devtool: deploy plugin: remove unnecessary re-import Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-11 13:17 ` [PATCH 11/11] devtool: deploy plugin: wrap long lines in code Markus Lehtonen
10 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/deploy.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 8637f19..078c74b 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -45,7 +45,7 @@ def deploy(args, config, basepath, workspace):
deploy_dir = os.path.join(basepath, 'target_deploy', args.target)
deploy_file = os.path.join(deploy_dir, args.recipename + '.list')
- stdout, stderr = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True)
+ stdout, _ = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True)
recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1)
if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename)
@@ -53,7 +53,7 @@ def deploy(args, config, basepath, workspace):
if args.dry_run:
print('Files to be deployed for %s on target %s:' % (args.recipename, args.target))
- for root, dirs, files in os.walk(recipe_outdir):
+ for root, _, files in os.walk(recipe_outdir):
for fn in files:
print(' %s' % os.path.join(destdir, os.path.relpath(root, recipe_outdir), fn))
return 0
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/11] devtool: deploy plugin: wrap long lines in code
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
` (9 preceding siblings ...)
2015-05-11 13:17 ` [PATCH 10/11] devtool: deploy plugin: rename unused variables Markus Lehtonen
@ 2015-05-11 13:17 ` Markus Lehtonen
2015-05-12 15:20 ` Paul Eggleton
10 siblings, 1 reply; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-11 13:17 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
scripts/lib/devtool/deploy.py | 99 +++++++++++++++++++++++++++++++------------
1 file changed, 72 insertions(+), 27 deletions(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 078c74b..f6ae433 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -45,17 +45,23 @@ def deploy(args, config, basepath, workspace):
deploy_dir = os.path.join(basepath, 'target_deploy', args.target)
deploy_file = os.path.join(deploy_dir, args.recipename + '.list')
- stdout, _ = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True)
+ stdout, _ = exec_build_env_command(config.init_path, basepath,
+ 'bitbake -e %s' % args.recipename,
+ shell=True)
recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1)
if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
- logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename)
+ logger.error('No files to deploy - have you built the %s recipe? If '
+ 'so, the install step has not installed any files.' %
+ args.recipename)
return -1
if args.dry_run:
- print('Files to be deployed for %s on target %s:' % (args.recipename, args.target))
+ print('Files to be deployed for %s on target %s:' %
+ (args.recipename, args.target))
for root, _, files in os.walk(recipe_outdir):
for fn in files:
- print(' %s' % os.path.join(destdir, os.path.relpath(root, recipe_outdir), fn))
+ print(' %s' % os.path.join(
+ destdir, os.path.relpath(root, recipe_outdir), fn))
return 0
if os.path.exists(deploy_file):
@@ -65,12 +71,16 @@ def deploy(args, config, basepath, workspace):
extraoptions = ''
if args.no_host_check:
- extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ extraoptions += '-o UserKnownHostsFile=/dev/null'
+ extraoptions += ' -o StrictHostKeyChecking=no'
if not args.show_status:
extraoptions += ' -q'
- ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True)
+ ret = subprocess.call('scp -r %s %s/* %s:%s' %
+ (extraoptions, recipe_outdir, args.target, destdir),
+ shell=True)
if ret != 0:
- logger.error('Deploy failed - rerun with -s to get a complete error message')
+ logger.error('Deploy failed - rerun with -s to get a complete error '
+ 'message')
return ret
logger.info('Successfully deployed %s' % recipe_outdir)
@@ -81,7 +91,8 @@ def deploy(args, config, basepath, workspace):
files_list = []
for root, _, files in os.walk(recipe_outdir):
for filename in files:
- filename = os.path.relpath(os.path.join(root, filename), recipe_outdir)
+ filename = os.path.relpath(os.path.join(root, filename),
+ recipe_outdir)
files_list.append(os.path.join(destdir, filename))
with open(deploy_file, 'w') as fobj:
@@ -91,13 +102,15 @@ def deploy(args, config, basepath, workspace):
def undeploy(args, config, basepath, workspace):
"""Entry point for the devtool 'undeploy' subcommand"""
- deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list')
+ deploy_file = os.path.join(basepath, 'target_deploy', args.target,
+ args.recipename + '.list')
if not os.path.exists(deploy_file):
logger.error('%s has not been deployed' % args.recipename)
return -1
if args.dry_run:
- print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target))
+ print('Previously deployed files to be un-deployed for %s on target '
+ '%s:' % (args.recipename, args.target))
with open(deploy_file, 'r') as f:
for line in f:
print(' %s' % line.rstrip())
@@ -105,39 +118,71 @@ def undeploy(args, config, basepath, workspace):
extraoptions = ''
if args.no_host_check:
- extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ extraoptions += '-o UserKnownHostsFile=/dev/null '
+ extraoptions += ' -o StrictHostKeyChecking=no'
if not args.show_status:
extraoptions += ' -q'
- ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True)
+ ret = subprocess.call("scp %s %s %s:/tmp" %
+ (extraoptions, deploy_file, args.target), shell=True)
if ret != 0:
- logger.error('Failed to copy file list to %s - rerun with -s to get a complete error message' % args.target)
+ logger.error('Failed to copy file list to %s - rerun with -s to get a '
+ 'complete error message' % args.target)
return -1
- ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True)
+ ret = subprocess.call(
+ "ssh %s %s 'xargs -n1 rm -f </tmp/%s'" %
+ (extraoptions, args.target, os.path.basename(deploy_file)),
+ shell=True)
if ret == 0:
logger.info('Successfully undeployed %s' % args.recipename)
os.remove(deploy_file)
else:
- logger.error('Undeploy failed - rerun with -s to get a complete error message')
+ logger.error('Undeploy failed - rerun with -s to get a complete error '
+ 'message')
return ret
def register_commands(subparsers, context):
"""Register devtool subcommands from the deploy plugin"""
- parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine')
- parser_deploy.add_argument('recipename', help='Recipe to deploy')
- parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]')
- parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true')
- parser_deploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
- parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true')
+ parser_deploy = subparsers.add_parser(
+ 'deploy-target',
+ help='Deploy recipe output files to live target machine')
+ parser_deploy.add_argument(
+ 'recipename',
+ help='Recipe to deploy')
+ parser_deploy.add_argument(
+ 'target',
+ help='Live target machine running an ssh server: '
+ 'user@hostname[:destdir]')
+ parser_deploy.add_argument(
+ '-c', '--no-host-check',
+ help='Disable ssh host key checking', action='store_true')
+ parser_deploy.add_argument(
+ '-s', '--show-status',
+ help='Show progress/status output', action='store_true')
+ parser_deploy.add_argument(
+ '-n', '--dry-run',
+ help='List files to be deployed only', action='store_true')
parser_deploy.set_defaults(func=deploy)
- parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine')
- parser_undeploy.add_argument('recipename', help='Recipe to undeploy')
- parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname')
- parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true')
- parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
- parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true')
+ parser_undeploy = subparsers.add_parser(
+ 'undeploy-target',
+ help='Undeploy recipe output files in live target machine')
+ parser_undeploy.add_argument(
+ 'recipename',
+ help='Recipe to undeploy')
+ parser_undeploy.add_argument(
+ 'target',
+ help='Live target machine running an ssh server: user@hostname')
+ parser_undeploy.add_argument(
+ '-c', '--no-host-check',
+ help='Disable ssh host key checking', action='store_true')
+ parser_undeploy.add_argument(
+ '-s', '--show-status',
+ help='Show progress/status output', action='store_true')
+ parser_undeploy.add_argument(
+ '-n', '--dry-run',
+ help='List files to be undeployed only', action='store_true')
parser_undeploy.set_defaults(func=undeploy)
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 11/11] devtool: deploy plugin: wrap long lines in code
2015-05-11 13:17 ` [PATCH 11/11] devtool: deploy plugin: wrap long lines in code Markus Lehtonen
@ 2015-05-12 15:20 ` Paul Eggleton
2015-05-18 13:05 ` Markus Lehtonen
0 siblings, 1 reply; 14+ messages in thread
From: Paul Eggleton @ 2015-05-12 15:20 UTC (permalink / raw)
To: Markus Lehtonen; +Cc: openembedded-core
On Monday 11 May 2015 16:17:11 Markus Lehtonen wrote:
> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> ---
> scripts/lib/devtool/deploy.py | 99
> +++++++++++++++++++++++++++++++------------ 1 file changed, 72
> insertions(+), 27 deletions(-)
>
> diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
> index 078c74b..f6ae433 100644
> --- a/scripts/lib/devtool/deploy.py
> +++ b/scripts/lib/devtool/deploy.py
> @@ -45,17 +45,23 @@ def deploy(args, config, basepath, workspace):
> deploy_dir = os.path.join(basepath, 'target_deploy', args.target)
> deploy_file = os.path.join(deploy_dir, args.recipename + '.list')
>
> - stdout, _ = exec_build_env_command(config.init_path, basepath, 'bitbake
> -e %s' % args.recipename, shell=True) + stdout, _ =
> exec_build_env_command(config.init_path, basepath, +
> 'bitbake -e %s' % args.recipename, +
> shell=True)
> recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1)
> if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
> - logger.error('No files to deploy - have you built the %s recipe? If
> so, the install step has not installed any files.' % args.recipename) +
> logger.error('No files to deploy - have you built the %s recipe? If ' +
> 'so, the install step has not installed any files.' % +
> args.recipename)
> return -1
>
> if args.dry_run:
> - print('Files to be deployed for %s on target %s:' %
> (args.recipename, args.target)) + print('Files to be deployed for %s
> on target %s:' %
> + (args.recipename, args.target))
> for root, _, files in os.walk(recipe_outdir):
> for fn in files:
> - print(' %s' % os.path.join(destdir, os.path.relpath(root,
> recipe_outdir), fn)) + print(' %s' % os.path.join(
> + destdir, os.path.relpath(root, recipe_outdir), fn))
> return 0
>
> if os.path.exists(deploy_file):
> @@ -65,12 +71,16 @@ def deploy(args, config, basepath, workspace):
>
> extraoptions = ''
> if args.no_host_check:
> - extraoptions += '-o UserKnownHostsFile=/dev/null -o
> StrictHostKeyChecking=no' + extraoptions += '-o
> UserKnownHostsFile=/dev/null'
> + extraoptions += ' -o StrictHostKeyChecking=no'
> if not args.show_status:
> extraoptions += ' -q'
> - ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions,
> recipe_outdir, args.target, destdir), shell=True) + ret =
> subprocess.call('scp -r %s %s/* %s:%s' %
> + (extraoptions, recipe_outdir, args.target,
> destdir), + shell=True)
> if ret != 0:
> - logger.error('Deploy failed - rerun with -s to get a complete error
> message') + logger.error('Deploy failed - rerun with -s to get a
> complete error ' + 'message')
> return ret
>
> logger.info('Successfully deployed %s' % recipe_outdir)
> @@ -81,7 +91,8 @@ def deploy(args, config, basepath, workspace):
> files_list = []
> for root, _, files in os.walk(recipe_outdir):
> for filename in files:
> - filename = os.path.relpath(os.path.join(root, filename),
> recipe_outdir) + filename = os.path.relpath(os.path.join(root,
> filename), + recipe_outdir)
> files_list.append(os.path.join(destdir, filename))
>
> with open(deploy_file, 'w') as fobj:
> @@ -91,13 +102,15 @@ def deploy(args, config, basepath, workspace):
>
> def undeploy(args, config, basepath, workspace):
> """Entry point for the devtool 'undeploy' subcommand"""
> - deploy_file = os.path.join(basepath, 'target_deploy', args.target,
> args.recipename + '.list') + deploy_file = os.path.join(basepath,
> 'target_deploy', args.target, +
> args.recipename + '.list')
> if not os.path.exists(deploy_file):
> logger.error('%s has not been deployed' % args.recipename)
> return -1
>
> if args.dry_run:
> - print('Previously deployed files to be un-deployed for %s on target
> %s:' % (args.recipename, args.target)) + print('Previously deployed
> files to be un-deployed for %s on target ' + '%s:' %
> (args.recipename, args.target))
> with open(deploy_file, 'r') as f:
> for line in f:
> print(' %s' % line.rstrip())
> @@ -105,39 +118,71 @@ def undeploy(args, config, basepath, workspace):
>
> extraoptions = ''
> if args.no_host_check:
> - extraoptions += '-o UserKnownHostsFile=/dev/null -o
> StrictHostKeyChecking=no' + extraoptions += '-o
> UserKnownHostsFile=/dev/null '
> + extraoptions += ' -o StrictHostKeyChecking=no'
> if not args.show_status:
> extraoptions += ' -q'
>
> - ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file,
> args.target), shell=True) + ret = subprocess.call("scp %s %s %s:/tmp" %
> + (extraoptions, deploy_file, args.target),
> shell=True) if ret != 0:
> - logger.error('Failed to copy file list to %s - rerun with -s to get
> a complete error message' % args.target) + logger.error('Failed to
> copy file list to %s - rerun with -s to get a ' +
> 'complete error message' % args.target)
> return -1
>
> - ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" %
> (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) +
> ret = subprocess.call(
> + "ssh %s %s 'xargs -n1 rm -f </tmp/%s'" %
> + (extraoptions, args.target, os.path.basename(deploy_file)),
> + shell=True)
> if ret == 0:
> logger.info('Successfully undeployed %s' % args.recipename)
> os.remove(deploy_file)
> else:
> - logger.error('Undeploy failed - rerun with -s to get a complete
> error message') + logger.error('Undeploy failed - rerun with -s to
> get a complete error ' + 'message')
>
> return ret
>
>
> def register_commands(subparsers, context):
> """Register devtool subcommands from the deploy plugin"""
> - parser_deploy = subparsers.add_parser('deploy-target', help='Deploy
> recipe output files to live target machine') -
> parser_deploy.add_argument('recipename', help='Recipe to deploy') -
> parser_deploy.add_argument('target', help='Live target machine running an
> ssh server: user@hostname[:destdir]') - parser_deploy.add_argument('-c',
> '--no-host-check', help='Disable ssh host key checking',
> action='store_true') - parser_deploy.add_argument('-s', '--show-status',
> help='Show progress/status output', action='store_true') -
> parser_deploy.add_argument('-n', '--dry-run', help='List files to be
> deployed only', action='store_true') + parser_deploy =
> subparsers.add_parser(
> + 'deploy-target',
> + help='Deploy recipe output files to live target machine')
> + parser_deploy.add_argument(
> + 'recipename',
> + help='Recipe to deploy')
> + parser_deploy.add_argument(
> + 'target',
> + help='Live target machine running an ssh server: '
> + 'user@hostname[:destdir]')
> + parser_deploy.add_argument(
> + '-c', '--no-host-check',
> + help='Disable ssh host key checking', action='store_true')
> + parser_deploy.add_argument(
> + '-s', '--show-status',
> + help='Show progress/status output', action='store_true')
> + parser_deploy.add_argument(
> + '-n', '--dry-run',
> + help='List files to be deployed only', action='store_true')
> parser_deploy.set_defaults(func=deploy)
>
> - parser_undeploy = subparsers.add_parser('undeploy-target',
> help='Undeploy recipe output files in live target machine') -
> parser_undeploy.add_argument('recipename', help='Recipe to undeploy') -
> parser_undeploy.add_argument('target', help='Live target machine running an
> ssh server: user@hostname') - parser_undeploy.add_argument('-c',
> '--no-host-check', help='Disable ssh host key checking',
> action='store_true') - parser_undeploy.add_argument('-s',
> '--show-status', help='Show progress/status output', action='store_true') -
> parser_undeploy.add_argument('-n', '--dry-run', help='List files to be
> undeployed only', action='store_true') + parser_undeploy =
> subparsers.add_parser(
> + 'undeploy-target',
> + help='Undeploy recipe output files in live target machine')
> + parser_undeploy.add_argument(
> + 'recipename',
> + help='Recipe to undeploy')
> + parser_undeploy.add_argument(
> + 'target',
> + help='Live target machine running an ssh server:
> user@hostname') + parser_undeploy.add_argument(
> + '-c', '--no-host-check',
> + help='Disable ssh host key checking', action='store_true')
> + parser_undeploy.add_argument(
> + '-s', '--show-status',
> + help='Show progress/status output', action='store_true')
> + parser_undeploy.add_argument(
> + '-n', '--dry-run',
> + help='List files to be undeployed only', action='store_true')
> parser_undeploy.set_defaults(func=undeploy)
I have to be honest and say I don't find that all of these line wrapping
changes improve readability. Maybe I am biased because I use a fairly large
editing window - what's your editing setup?
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 11/11] devtool: deploy plugin: wrap long lines in code
2015-05-12 15:20 ` Paul Eggleton
@ 2015-05-18 13:05 ` Markus Lehtonen
0 siblings, 0 replies; 14+ messages in thread
From: Markus Lehtonen @ 2015-05-18 13:05 UTC (permalink / raw)
To: Paul Eggleton; +Cc: openembedded-core
Hi,
On Tue, 2015-05-12 at 16:20 +0100, Paul Eggleton wrote:
> On Monday 11 May 2015 16:17:11 Markus Lehtonen wrote:
> > Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> > ---
> > scripts/lib/devtool/deploy.py | 99
> > +++++++++++++++++++++++++++++++------------ 1 file changed, 72
> > insertions(+), 27 deletions(-)
> >
> > diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
> > index 078c74b..f6ae433 100644
> > --- a/scripts/lib/devtool/deploy.py
> > +++ b/scripts/lib/devtool/deploy.py
> > @@ -45,17 +45,23 @@ def deploy(args, config, basepath, workspace):
> > deploy_dir = os.path.join(basepath, 'target_deploy', args.target)
> > deploy_file = os.path.join(deploy_dir, args.recipename + '.list')
> >
> > - stdout, _ = exec_build_env_command(config.init_path, basepath, 'bitbake
> > -e %s' % args.recipename, shell=True) + stdout, _ =
> > exec_build_env_command(config.init_path, basepath, +
> > 'bitbake -e %s' % args.recipename, +
> > shell=True)
> > recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1)
> > if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
> > - logger.error('No files to deploy - have you built the %s recipe? If
> > so, the install step has not installed any files.' % args.recipename) +
> > logger.error('No files to deploy - have you built the %s recipe? If ' +
> > 'so, the install step has not installed any files.' % +
> > args.recipename)
> > return -1
> >
> > if args.dry_run:
> > - print('Files to be deployed for %s on target %s:' %
> > (args.recipename, args.target)) + print('Files to be deployed for %s
> > on target %s:' %
> > + (args.recipename, args.target))
> > for root, _, files in os.walk(recipe_outdir):
> > for fn in files:
> > - print(' %s' % os.path.join(destdir, os.path.relpath(root,
> > recipe_outdir), fn)) + print(' %s' % os.path.join(
> > + destdir, os.path.relpath(root, recipe_outdir), fn))
> > return 0
> >
> > if os.path.exists(deploy_file):
> > @@ -65,12 +71,16 @@ def deploy(args, config, basepath, workspace):
> >
> > extraoptions = ''
> > if args.no_host_check:
> > - extraoptions += '-o UserKnownHostsFile=/dev/null -o
> > StrictHostKeyChecking=no' + extraoptions += '-o
> > UserKnownHostsFile=/dev/null'
> > + extraoptions += ' -o StrictHostKeyChecking=no'
> > if not args.show_status:
> > extraoptions += ' -q'
> > - ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions,
> > recipe_outdir, args.target, destdir), shell=True) + ret =
> > subprocess.call('scp -r %s %s/* %s:%s' %
> > + (extraoptions, recipe_outdir, args.target,
> > destdir), + shell=True)
> > if ret != 0:
> > - logger.error('Deploy failed - rerun with -s to get a complete error
> > message') + logger.error('Deploy failed - rerun with -s to get a
> > complete error ' + 'message')
> > return ret
> >
> > logger.info('Successfully deployed %s' % recipe_outdir)
> > @@ -81,7 +91,8 @@ def deploy(args, config, basepath, workspace):
> > files_list = []
> > for root, _, files in os.walk(recipe_outdir):
> > for filename in files:
> > - filename = os.path.relpath(os.path.join(root, filename),
> > recipe_outdir) + filename = os.path.relpath(os.path.join(root,
> > filename), + recipe_outdir)
> > files_list.append(os.path.join(destdir, filename))
> >
> > with open(deploy_file, 'w') as fobj:
> > @@ -91,13 +102,15 @@ def deploy(args, config, basepath, workspace):
> >
> > def undeploy(args, config, basepath, workspace):
> > """Entry point for the devtool 'undeploy' subcommand"""
> > - deploy_file = os.path.join(basepath, 'target_deploy', args.target,
> > args.recipename + '.list') + deploy_file = os.path.join(basepath,
> > 'target_deploy', args.target, +
> > args.recipename + '.list')
> > if not os.path.exists(deploy_file):
> > logger.error('%s has not been deployed' % args.recipename)
> > return -1
> >
> > if args.dry_run:
> > - print('Previously deployed files to be un-deployed for %s on target
> > %s:' % (args.recipename, args.target)) + print('Previously deployed
> > files to be un-deployed for %s on target ' + '%s:' %
> > (args.recipename, args.target))
> > with open(deploy_file, 'r') as f:
> > for line in f:
> > print(' %s' % line.rstrip())
> > @@ -105,39 +118,71 @@ def undeploy(args, config, basepath, workspace):
> >
> > extraoptions = ''
> > if args.no_host_check:
> > - extraoptions += '-o UserKnownHostsFile=/dev/null -o
> > StrictHostKeyChecking=no' + extraoptions += '-o
> > UserKnownHostsFile=/dev/null '
> > + extraoptions += ' -o StrictHostKeyChecking=no'
> > if not args.show_status:
> > extraoptions += ' -q'
> >
> > - ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file,
> > args.target), shell=True) + ret = subprocess.call("scp %s %s %s:/tmp" %
> > + (extraoptions, deploy_file, args.target),
> > shell=True) if ret != 0:
> > - logger.error('Failed to copy file list to %s - rerun with -s to get
> > a complete error message' % args.target) + logger.error('Failed to
> > copy file list to %s - rerun with -s to get a ' +
> > 'complete error message' % args.target)
> > return -1
> >
> > - ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" %
> > (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) +
> > ret = subprocess.call(
> > + "ssh %s %s 'xargs -n1 rm -f </tmp/%s'" %
> > + (extraoptions, args.target, os.path.basename(deploy_file)),
> > + shell=True)
> > if ret == 0:
> > logger.info('Successfully undeployed %s' % args.recipename)
> > os.remove(deploy_file)
> > else:
> > - logger.error('Undeploy failed - rerun with -s to get a complete
> > error message') + logger.error('Undeploy failed - rerun with -s to
> > get a complete error ' + 'message')
> >
> > return ret
> >
> >
> > def register_commands(subparsers, context):
> > """Register devtool subcommands from the deploy plugin"""
> > - parser_deploy = subparsers.add_parser('deploy-target', help='Deploy
> > recipe output files to live target machine') -
> > parser_deploy.add_argument('recipename', help='Recipe to deploy') -
> > parser_deploy.add_argument('target', help='Live target machine running an
> > ssh server: user@hostname[:destdir]') - parser_deploy.add_argument('-c',
> > '--no-host-check', help='Disable ssh host key checking',
> > action='store_true') - parser_deploy.add_argument('-s', '--show-status',
> > help='Show progress/status output', action='store_true') -
> > parser_deploy.add_argument('-n', '--dry-run', help='List files to be
> > deployed only', action='store_true') + parser_deploy =
> > subparsers.add_parser(
> > + 'deploy-target',
> > + help='Deploy recipe output files to live target machine')
> > + parser_deploy.add_argument(
> > + 'recipename',
> > + help='Recipe to deploy')
> > + parser_deploy.add_argument(
> > + 'target',
> > + help='Live target machine running an ssh server: '
> > + 'user@hostname[:destdir]')
> > + parser_deploy.add_argument(
> > + '-c', '--no-host-check',
> > + help='Disable ssh host key checking', action='store_true')
> > + parser_deploy.add_argument(
> > + '-s', '--show-status',
> > + help='Show progress/status output', action='store_true')
> > + parser_deploy.add_argument(
> > + '-n', '--dry-run',
> > + help='List files to be deployed only', action='store_true')
> > parser_deploy.set_defaults(func=deploy)
> >
> > - parser_undeploy = subparsers.add_parser('undeploy-target',
> > help='Undeploy recipe output files in live target machine') -
> > parser_undeploy.add_argument('recipename', help='Recipe to undeploy') -
> > parser_undeploy.add_argument('target', help='Live target machine running an
> > ssh server: user@hostname') - parser_undeploy.add_argument('-c',
> > '--no-host-check', help='Disable ssh host key checking',
> > action='store_true') - parser_undeploy.add_argument('-s',
> > '--show-status', help='Show progress/status output', action='store_true') -
> > parser_undeploy.add_argument('-n', '--dry-run', help='List files to be
> > undeployed only', action='store_true') + parser_undeploy =
> > subparsers.add_parser(
> > + 'undeploy-target',
> > + help='Undeploy recipe output files in live target machine')
> > + parser_undeploy.add_argument(
> > + 'recipename',
> > + help='Recipe to undeploy')
> > + parser_undeploy.add_argument(
> > + 'target',
> > + help='Live target machine running an ssh server:
> > user@hostname') + parser_undeploy.add_argument(
> > + '-c', '--no-host-check',
> > + help='Disable ssh host key checking', action='store_true')
> > + parser_undeploy.add_argument(
> > + '-s', '--show-status',
> > + help='Show progress/status output', action='store_true')
> > + parser_undeploy.add_argument(
> > + '-n', '--dry-run',
> > + help='List files to be undeployed only', action='store_true')
> > parser_undeploy.set_defaults(func=undeploy)
>
> I have to be honest and say I don't find that all of these line wrapping
> changes improve readability. Maybe I am biased because I use a fairly large
> editing window - what's your editing setup?
On my laptop I usually have quite narrow windows (I guess around 100 or
so). This also has to do with PEP8 (the Python style guide):
https://www.python.org/dev/peps/pep-0008/#id14
Thanks,
Markus
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-05-18 13:05 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 13:17 [PATCH 00/11] devtool: code style fixes Markus Lehtonen
2015-05-11 13:17 ` [PATCH 01/11] devtool: standard plugins: add missing docstrings Markus Lehtonen
2015-05-11 13:17 ` [PATCH 02/11] devtool: standard plugins: remove unused import Markus Lehtonen
2015-05-11 13:17 ` [PATCH 03/11] devtool: standard plugins: rename usunused variable Markus Lehtonen
2015-05-11 13:17 ` [PATCH 04/11] devtool: lib: add missing docstrings Markus Lehtonen
2015-05-11 13:17 ` [PATCH 05/11] devtool: lib: remove unnecessary re-import Markus Lehtonen
2015-05-11 13:17 ` [PATCH 06/11] devtool: lib: wrap long lines in code Markus Lehtonen
2015-05-11 13:17 ` [PATCH 07/11] devtool: deploy plugin: fix bad indentation Markus Lehtonen
2015-05-11 13:17 ` [PATCH 08/11] devtool: deploy plugin: add missing docstrings Markus Lehtonen
2015-05-11 13:17 ` [PATCH 09/11] devtool: deploy plugin: remove unnecessary re-import Markus Lehtonen
2015-05-11 13:17 ` [PATCH 10/11] devtool: deploy plugin: rename unused variables Markus Lehtonen
2015-05-11 13:17 ` [PATCH 11/11] devtool: deploy plugin: wrap long lines in code Markus Lehtonen
2015-05-12 15:20 ` Paul Eggleton
2015-05-18 13:05 ` Markus Lehtonen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.