Hello community,

here is the log from the commit of package python-pyaml for openSUSE:Factory 
checked in at 2020-03-27 00:27:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyaml (Old)
 and      /work/SRC/openSUSE:Factory/.python-pyaml.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pyaml"

Fri Mar 27 00:27:22 2020 rev:5 rq:786408 version:20.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyaml/python-pyaml.changes        
2019-05-16 22:08:55.254343656 +0200
+++ /work/SRC/openSUSE:Factory/.python-pyaml.new.3160/python-pyaml.changes      
2020-03-27 00:27:23.804320608 +0100
@@ -1,0 +2,6 @@
+Thu Mar 19 10:22:04 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com>
+
+- Update to version 20.3.1
+  * Add -r/--replace command-line option
+
+-------------------------------------------------------------------

Old:
----
  pyaml-19.4.1.tar.gz

New:
----
  pyaml-20.3.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pyaml.spec ++++++
--- /var/tmp/diff_new_pack.wbPZPm/_old  2020-03-27 00:27:24.344320882 +0100
+++ /var/tmp/diff_new_pack.wbPZPm/_new  2020-03-27 00:27:24.348320884 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pyaml
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pyaml
-Version:        19.4.1
+Version:        20.3.1
 Release:        0
 Summary:        Python module to produce formatted YAML-serialized data
 License:        WTFPL

++++++ pyaml-19.4.1.tar.gz -> pyaml-20.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/PKG-INFO new/pyaml-20.3.1/PKG-INFO
--- old/pyaml-19.4.1/PKG-INFO   2019-04-17 04:29:06.000000000 +0200
+++ new/pyaml-20.3.1/PKG-INFO   2020-03-09 21:21:37.987214600 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pyaml
-Version: 19.4.1
+Version: 20.3.1
 Summary: PyYAML-based module to produce pretty and readable YAML-serialized 
data
 Home-page: https://github.com/mk-fg/pretty-yaml
 Author: Mike Kazantsev
@@ -14,6 +14,8 @@
         This module is for serialization only, see `ruamel.yaml`_ module for 
literate
         YAML parsing (keeping track of comments, spacing, line/column numbers 
of values, etc).
         
+        [note: to dump stuff parsed by ruamel.yaml with this module, use only 
``YAML(typ='safe')`` there]
+        
         .. contents::
           :backlinks: none
         
@@ -216,8 +218,12 @@
         
         * Pretty-print any yaml or json (yaml subset) file from the shell::
         
-            python -m pyaml /path/to/some/file.yaml
-            curl -s https://status.github.com/api.json | python -m pyaml
+            % python -m pyaml /path/to/some/file.yaml
+            % curl -s https://www.githubstatus.com/api/v2/summary.json | 
python -m pyaml
+        
+        * Process and replace json/yaml file in-place::
+        
+            % python -m pyaml -r file-with-json.data
         
         * Easier "debug printf" for more complex data (all funcs below are 
aliases to
           same thing)::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/README new/pyaml-20.3.1/README
--- old/pyaml-19.4.1/README     2019-04-17 04:03:22.000000000 +0200
+++ new/pyaml-20.3.1/README     2020-03-09 21:21:14.000000000 +0100
@@ -6,6 +6,8 @@
 This module is for serialization only, see `ruamel.yaml`_ module for literate
 YAML parsing (keeping track of comments, spacing, line/column numbers of 
values, etc).
 
+[note: to dump stuff parsed by ruamel.yaml with this module, use only 
``YAML(typ='safe')`` there]
+
 .. contents::
   :backlinks: none
 
@@ -208,8 +210,12 @@
 
 * Pretty-print any yaml or json (yaml subset) file from the shell::
 
-    python -m pyaml /path/to/some/file.yaml
-    curl -s https://status.github.com/api.json | python -m pyaml
+    % python -m pyaml /path/to/some/file.yaml
+    % curl -s https://www.githubstatus.com/api/v2/summary.json | python -m 
pyaml
+
+* Process and replace json/yaml file in-place::
+
+    % python -m pyaml -r file-with-json.data
 
 * Easier "debug printf" for more complex data (all funcs below are aliases to
   same thing)::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/README.rst new/pyaml-20.3.1/README.rst
--- old/pyaml-19.4.1/README.rst 2019-04-17 04:03:22.000000000 +0200
+++ new/pyaml-20.3.1/README.rst 2020-03-09 21:21:14.000000000 +0100
@@ -6,6 +6,8 @@
 This module is for serialization only, see `ruamel.yaml`_ module for literate
 YAML parsing (keeping track of comments, spacing, line/column numbers of 
values, etc).
 
+[note: to dump stuff parsed by ruamel.yaml with this module, use only 
``YAML(typ='safe')`` there]
+
 .. contents::
   :backlinks: none
 
@@ -208,8 +210,12 @@
 
 * Pretty-print any yaml or json (yaml subset) file from the shell::
 
-    python -m pyaml /path/to/some/file.yaml
-    curl -s https://status.github.com/api.json | python -m pyaml
+    % python -m pyaml /path/to/some/file.yaml
+    % curl -s https://www.githubstatus.com/api/v2/summary.json | python -m 
pyaml
+
+* Process and replace json/yaml file in-place::
+
+    % python -m pyaml -r file-with-json.data
 
 * Easier "debug printf" for more complex data (all funcs below are aliases to
   same thing)::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/pyaml/__main__.py 
new/pyaml-20.3.1/pyaml/__main__.py
--- old/pyaml-19.4.1/pyaml/__main__.py  2019-04-10 22:23:02.000000000 +0200
+++ new/pyaml-20.3.1/pyaml/__main__.py  2019-12-07 05:16:01.000000000 +0100
@@ -1,6 +1,24 @@
 # -*- coding: utf-8 -*-
 
-import sys, yaml, pyaml
+import os, sys, stat, tempfile, contextlib, yaml, pyaml
+
+
+@contextlib.contextmanager
+def safe_replacement(path, *open_args, **open_kws):
+       path = str(path)
+       try: mode = stat.S_IMODE(os.stat(path).st_mode)
+       except (OSError, IOError): mode = None
+       open_kws.update( delete=False,
+               dir=os.path.dirname(path), prefix=os.path.basename(path)+'.' )
+       with tempfile.NamedTemporaryFile(*open_args, **open_kws) as tmp:
+               try:
+                       if mode is not None: os.fchmod(tmp.fileno(), mode)
+                       yield tmp
+                       if not tmp.closed: tmp.flush()
+                       os.rename(tmp.name, path)
+               finally:
+                       try: os.unlink(tmp.name)
+                       except (OSError, IOError): pass
 
 
 def main(argv=None):
@@ -9,6 +27,8 @@
                description='Process and dump prettified YAML to stdout.')
        parser.add_argument('path', nargs='?', metavar='path',
                help='Path to YAML to read (default: use stdin).')
+       parser.add_argument('-r', '--replace', action='store_true',
+               help='Replace specified path with prettified version in-place.')
        parser.add_argument('-w', '--width', type=int, metavar='chars',
                help='Max line width hint to pass to pyyaml for the dump.'
                        ' Only used to format scalars and collections (e.g. 
lists).')
@@ -20,6 +40,9 @@
 
        pyaml_kwargs = dict()
        if opts.width: pyaml_kwargs['width'] = opts.width
-       pyaml.pprint(data, **pyaml_kwargs)
+       if opts.replace and opts.path:
+               with safe_replacement(opts.path) as tmp:
+                       pyaml.pprint(data, file=tmp, **pyaml_kwargs)
+       else: pyaml.pprint(data, **pyaml_kwargs)
 
 if __name__ == '__main__': sys.exit(main())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/pyaml/tests/dump.py 
new/pyaml-20.3.1/pyaml/tests/dump.py
--- old/pyaml-19.4.1/pyaml/tests/dump.py        2019-04-17 04:28:22.000000000 
+0200
+++ new/pyaml-20.3.1/pyaml/tests/dump.py        2020-03-09 21:20:02.000000000 
+0100
@@ -418,6 +418,12 @@
                docs_str = pyaml.dump(docs, multiple_docs=True, 
explicit_start=False)
                self.assertEqual(docs_str, docs_str2)
 
+       def test_ruamel_yaml(self):
+               try: from ruamel.yaml import YAML
+               except ImportError: return unittest.skip('No ruamel.yaml module 
to test it')
+               data = YAML(typ='safe').load(large_yaml)
+               yaml_str = pyaml.dump(data)
+
 
 if __name__ == '__main__':
        unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/pyaml.egg-info/PKG-INFO 
new/pyaml-20.3.1/pyaml.egg-info/PKG-INFO
--- old/pyaml-19.4.1/pyaml.egg-info/PKG-INFO    2019-04-17 04:29:06.000000000 
+0200
+++ new/pyaml-20.3.1/pyaml.egg-info/PKG-INFO    2020-03-09 21:21:37.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pyaml
-Version: 19.4.1
+Version: 20.3.1
 Summary: PyYAML-based module to produce pretty and readable YAML-serialized 
data
 Home-page: https://github.com/mk-fg/pretty-yaml
 Author: Mike Kazantsev
@@ -14,6 +14,8 @@
         This module is for serialization only, see `ruamel.yaml`_ module for 
literate
         YAML parsing (keeping track of comments, spacing, line/column numbers 
of values, etc).
         
+        [note: to dump stuff parsed by ruamel.yaml with this module, use only 
``YAML(typ='safe')`` there]
+        
         .. contents::
           :backlinks: none
         
@@ -216,8 +218,12 @@
         
         * Pretty-print any yaml or json (yaml subset) file from the shell::
         
-            python -m pyaml /path/to/some/file.yaml
-            curl -s https://status.github.com/api.json | python -m pyaml
+            % python -m pyaml /path/to/some/file.yaml
+            % curl -s https://www.githubstatus.com/api/v2/summary.json | 
python -m pyaml
+        
+        * Process and replace json/yaml file in-place::
+        
+            % python -m pyaml -r file-with-json.data
         
         * Easier "debug printf" for more complex data (all funcs below are 
aliases to
           same thing)::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyaml-19.4.1/setup.py new/pyaml-20.3.1/setup.py
--- old/pyaml-19.4.1/setup.py   2019-04-17 04:28:35.000000000 +0200
+++ new/pyaml-20.3.1/setup.py   2020-03-09 21:20:24.000000000 +0100
@@ -12,7 +12,7 @@
 setup(
 
        name = 'pyaml',
-       version = '19.4.1',
+       version = '20.3.1',
        author = 'Mike Kazantsev',
        author_email = 'mk.frag...@gmail.com',
        license = 'WTFPL',


Reply via email to