[Python-apps-commits] r14440 - in packages/bundlewrap/trunk (8 files)

jcc at users.alioth.debian.org jcc at users.alioth.debian.org
Fri Oct 27 09:36:03 UTC 2017


    Date: Friday, October 27, 2017 @ 09:36:02
  Author: jcc
Revision: 14440

New upstream release 3.1.1

Modified:
  packages/bundlewrap/trunk/CHANGELOG.md
  packages/bundlewrap/trunk/bundlewrap/__init__.py
  packages/bundlewrap/trunk/bundlewrap/bundle.py
  packages/bundlewrap/trunk/bundlewrap/cmdline/plot.py
  packages/bundlewrap/trunk/bundlewrap/plugins.py
  packages/bundlewrap/trunk/bundlewrap/utils/ui.py
  packages/bundlewrap/trunk/debian/changelog
  packages/bundlewrap/trunk/setup.py

Modified: packages/bundlewrap/trunk/CHANGELOG.md
===================================================================
--- packages/bundlewrap/trunk/CHANGELOG.md	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/CHANGELOG.md	2017-10-27 09:36:02 UTC (rev 14440)
@@ -1,3 +1,12 @@
+# 3.1.1
+
+2017-10-24
+
+* will now detect bad wrappers around metadata processors
+* fixed crash in `bw plot`
+* fixed cut off status lines
+
+
 # 3.1.0
 
 2017-10-10

Modified: packages/bundlewrap/trunk/bundlewrap/__init__.py
===================================================================
--- packages/bundlewrap/trunk/bundlewrap/__init__.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/bundlewrap/__init__.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-VERSION = (3, 1, 0)
+VERSION = (3, 1, 1)
 VERSION_STRING = ".".join([str(v) for v in VERSION])

Modified: packages/bundlewrap/trunk/bundlewrap/bundle.py
===================================================================
--- packages/bundlewrap/trunk/bundlewrap/bundle.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/bundlewrap/bundle.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -3,7 +3,7 @@
 
 from os.path import exists, join
 
-from .exceptions import NoSuchBundle, RepositoryError
+from .exceptions import BundleError, NoSuchBundle, RepositoryError
 from .metadata import DEFAULTS, DONE, RUN_ME_AGAIN, OVERWRITE
 from .utils import cached_property, get_all_attrs_from_file
 from .utils.text import bold, mark_for_translation as _
@@ -96,6 +96,7 @@
             if not exists(self.metadata_file):
                 return []
             result = []
+            internal_names = set()
             for name, attr in get_all_attrs_from_file(
                 self.metadata_file,
                 base_env={
@@ -109,5 +110,21 @@
                 },
             ).items():
                 if getattr(attr, '__is_a_metadata_processor', False):
+                    internal_name = getattr(attr, '__name__', name)
+                    if internal_name in internal_names:
+                        raise BundleError(_(
+                            "Metadata processor '{name}' in bundle {bundle} for node {node} has "
+                            "__name__ '{internal_name}', which was previously used by another "
+                            "metadata processor in the same metadata.py. BundleWrap uses __name__ "
+                            "internally to tell metadata processors apart, so this is a problem. "
+                            "Perhaps you used a decorator on your metadata processors that "
+                            "doesn't use functools.wraps? You should use that."
+                        ).format(
+                            bundle=self.name,
+                            node=self.node.name,
+                            internal_name=internal_name,
+                            name=name,
+                        ))
+                    internal_names.add(internal_name)
                     result.append(attr)
             return result

Modified: packages/bundlewrap/trunk/bundlewrap/cmdline/plot.py
===================================================================
--- packages/bundlewrap/trunk/bundlewrap/cmdline/plot.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/bundlewrap/cmdline/plot.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -29,7 +29,7 @@
     node = get_node(repo, args['node'], adhoc_nodes=args['adhoc_nodes'])
     for line in graph_for_items(
         node.name,
-        prepare_dependencies(node.items, node.os, node.os_version),
+        prepare_dependencies(node.items, node.name, node.os, node.os_version),
         cluster=args['cluster'],
         concurrency=args['depends_concurrency'],
         static=args['depends_static'],

Modified: packages/bundlewrap/trunk/bundlewrap/plugins.py
===================================================================
--- packages/bundlewrap/trunk/bundlewrap/plugins.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/bundlewrap/plugins.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -186,3 +186,4 @@
     def write_db(self):
         with open(join(self.path, "plugins.json"), 'w') as f:
             f.write(dumps(self.plugin_db, indent=4, sort_keys=True))
+            f.write("\n")

Modified: packages/bundlewrap/trunk/bundlewrap/utils/ui.py
===================================================================
--- packages/bundlewrap/trunk/bundlewrap/utils/ui.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/bundlewrap/utils/ui.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -417,15 +417,18 @@
     def _write_current_job(self):
         if self.jobs and TTY:
             line = "{} ".format(blue(self._spinner_character()))
+            # must track line length manually as len() will count ANSI escape codes
+            visible_length = 2
             try:
                 progress = (self.progress / float(self.progress_total))
             except ZeroDivisionError:
                 pass
             else:
-                line += bold("{:.1f}%  ".format(progress * 100))
-            line += self.jobs[-1]
-            line += "  "
-            write_to_stream(STDOUT_WRITER, line[:term_width() - 1])
+                progress_text = "{:.1f}%  ".format(progress * 100)
+                line += bold(progress_text)
+                visible_length += len(progress_text)
+            line += self.jobs[-1][:term_width() - 1 - visible_length]
+            write_to_stream(STDOUT_WRITER, line)
             self._status_line_present = True
 
 

Modified: packages/bundlewrap/trunk/debian/changelog
===================================================================
--- packages/bundlewrap/trunk/debian/changelog	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/debian/changelog	2017-10-27 09:36:02 UTC (rev 14440)
@@ -1,3 +1,9 @@
+bundlewrap (3.1.1-1) unstable; urgency=medium
+
+  * New upstream release
+
+ -- Jonathan Carter <jcc at debian.org>  Fri, 27 Oct 2017 11:32:30 +0200
+
 bundlewrap (3.1.0-1) unstable; urgency=medium
 
   * New upstream release

Modified: packages/bundlewrap/trunk/setup.py
===================================================================
--- packages/bundlewrap/trunk/setup.py	2017-10-27 07:02:38 UTC (rev 14439)
+++ packages/bundlewrap/trunk/setup.py	2017-10-27 09:36:02 UTC (rev 14440)
@@ -16,7 +16,7 @@
 
 setup(
     name="bundlewrap",
-    version="3.1.0",
+    version="3.1.1",
     description="Config management with Python",
     long_description=(
         "By allowing for easy and low-overhead config management, BundleWrap fills the gap between complex deployments using Chef or Puppet and old school system administration over SSH.\n"




More information about the Python-apps-commits mailing list