Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-commentjson for 
openSUSE:Factory checked in at 2021-04-08 21:32:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-commentjson (Old)
 and      /work/SRC/openSUSE:Factory/.python-commentjson.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-commentjson"

Thu Apr  8 21:32:22 2021 rev:2 rq:883727 version:0.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-commentjson/python-commentjson.changes    
2020-04-16 23:04:43.227753136 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-commentjson.new.2401/python-commentjson.changes
  2021-04-08 21:32:33.267832736 +0200
@@ -1,0 +2,10 @@
+Thu Apr  8 05:26:44 UTC 2021 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 0.9.0:
+  * Speed up by using the faster LALR parser.
+  * Support for trailing comma in JSON to support more developer workflows
+    of working with JSON files with comments as config files.
+  * Fixes the compatibility issue with lark-parser after a new version was
+    released. 
+
+-------------------------------------------------------------------

Old:
----
  commentjson-0.8.2.tar.gz

New:
----
  commentjson-0.9.0.tar.gz

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

Other differences:
------------------
++++++ python-commentjson.spec ++++++
--- /var/tmp/diff_new_pack.9ILW5H/_old  2021-04-08 21:32:33.799833320 +0200
+++ /var/tmp/diff_new_pack.9ILW5H/_new  2021-04-08 21:32:33.803833324 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-commentjson
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,11 +18,10 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-commentjson
-Version:        0.8.2
+Version:        0.9.0
 Release:        0
 Summary:        Add Python and JavaScript style comments in your JSON files
 License:        MIT
-Group:          Development/Languages/Python
 URL:            https://github.com/vaidik/commentjson
 Source:         
https://github.com/vaidik/commentjson/archive/v%{version}.tar.gz#/commentjson-%{version}.tar.gz
 BuildRequires:  %{python_module lark-parser >= 0.7.1}

++++++ commentjson-0.8.2.tar.gz -> commentjson-0.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/.travis.yml 
new/commentjson-0.9.0/.travis.yml
--- old/commentjson-0.8.2/.travis.yml   2019-09-02 19:05:44.000000000 +0200
+++ new/commentjson-0.9.0/.travis.yml   2020-10-05 20:18:00.000000000 +0200
@@ -22,12 +22,14 @@
       os: osx
       osx_image: xcode10.2
       language: shell
-    - name: "Python 3.7 on Windows"
-      python: 3.7
+    - name: "Python 3.8 on Windows"
+      python: 3.8
       os: windows
       language: shell
-      before_install: choco install python
-      env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
+      before_install:
+        - choco install python --version 3.8.0
+        - python -m pip install setuptools
+      env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
 
 # command to run tests
 script: python setup.py test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/MANIFEST.in 
new/commentjson-0.9.0/MANIFEST.in
--- old/commentjson-0.8.2/MANIFEST.in   1970-01-01 01:00:00.000000000 +0100
+++ new/commentjson-0.9.0/MANIFEST.in   2020-10-05 20:18:00.000000000 +0200
@@ -0,0 +1 @@
+include *.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/Makefile 
new/commentjson-0.9.0/Makefile
--- old/commentjson-0.8.2/Makefile      1970-01-01 01:00:00.000000000 +0100
+++ new/commentjson-0.9.0/Makefile      2020-10-05 20:18:00.000000000 +0200
@@ -0,0 +1,12 @@
+# commentjson Makefile
+# ~~~~~~~~~~~~~~~~~~~~
+#
+# Shortcuts for various tasks.
+
+bump-version:
+       dephell deps convert --from=setup.py --to=requirements.txt
+       python tools/bump-version.py --get-current
+       python tools/bump-version.py --set-version
+
+sdist:
+       python setup.py sdist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/commentjson/commentjson.py 
new/commentjson-0.9.0/commentjson/commentjson.py
--- old/commentjson-0.8.2/commentjson/commentjson.py    2019-09-02 
19:05:44.000000000 +0200
+++ new/commentjson-0.9.0/commentjson/commentjson.py    2020-10-05 
20:18:00.000000000 +0200
@@ -26,7 +26,9 @@
 import lark
 
 from lark import Lark
+from lark.lexer import Token
 from lark.reconstruct import Reconstructor
+from lark.tree import Tree
 
 
 parser = Lark('''
@@ -38,19 +40,20 @@
           | "true"             -> true
           | "false"            -> false
           | "null"             -> null
-    array  : "[" [value ("," value)*] "]"
-    object : "{" [pair ("," pair)*] "}"
+    array  : "[" [value ("," value)*] TRAILING_COMMA? "]"
+    object : "{" [pair ("," pair)*]  TRAILING_COMMA? "}"
     pair   : string ":" value
     string : ESCAPED_STRING
 
-    COMMENT: /(#|\/\/)[^\\n]*/
+    COMMENT: /(#|\\/\\/)[^\\n]*/
+    TRAILING_COMMA: ","
 
     %import common.ESCAPED_STRING
     %import common.SIGNED_NUMBER
     %import common.WS
     %ignore WS
     %ignore COMMENT
-''')
+''', maybe_placeholders=False, parser='lalr')
 
 serializer = Reconstructor(parser)
 
@@ -151,6 +154,15 @@
     library = 'json'
 
 
+def _remove_trailing_commas(tree):
+    if isinstance(tree, Tree):
+        tree.children = [
+            _remove_trailing_commas(ch) for ch in tree.children
+                if not (isinstance(ch, Token) and ch.type == 'TRAILING_COMMA')
+        ]
+    return tree
+
+
 def loads(text, *args, **kwargs):
     ''' Deserialize `text` (a `str` or `unicode` instance containing a JSON
     document with Python or JavaScript like comments) to a Python object.
@@ -165,7 +177,7 @@
         text = text.decode(detect_encoding(text), 'surrogatepass')
 
     try:
-        parsed = parser.parse(text)
+        parsed = _remove_trailing_commas(parser.parse(text))
         final_text = serializer.reconstruct(parsed)
     except lark.exceptions.UnexpectedCharacters:
         raise ValueError('Unable to parse text', text)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/commentjson-0.8.2/commentjson/tests/test_commentjson.py 
new/commentjson-0.9.0/commentjson/tests/test_commentjson.py
--- old/commentjson-0.8.2/commentjson/tests/test_commentjson.py 2019-09-02 
19:05:44.000000000 +0200
+++ new/commentjson-0.9.0/commentjson/tests/test_commentjson.py 2020-10-05 
20:18:00.000000000 +0200
@@ -20,7 +20,8 @@
                       'string_with_inline_comment',
                       'inline_has_special_characters',
                       'array_with_hash',
-                      'inline_last_quote')
+                      'inline_last_quote',
+                      'trailing_comma')
 
         for file_ in self.files:
             fpath = os.path.join(self.path, file_)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/commentjson-0.8.2/commentjson/tests/trailing_comma-commented.json 
new/commentjson-0.9.0/commentjson/tests/trailing_comma-commented.json
--- old/commentjson-0.8.2/commentjson/tests/trailing_comma-commented.json       
1970-01-01 01:00:00.000000000 +0100
+++ new/commentjson-0.9.0/commentjson/tests/trailing_comma-commented.json       
2020-10-05 20:18:00.000000000 +0200
@@ -0,0 +1,15 @@
+{
+    "a": 1,
+    "c": {
+        # d is cool
+        "d": "4.3",
+        // e is cool
+        "e": {
+            "1": "1 # testing", # test comment
+            "2": "2", # some other stupid comment
+            "2.2": "2", // some other stupid comment
+            "3": "3",
+        },
+    },
+    "b": 2, # b inline comment
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/commentjson-0.8.2/commentjson/tests/trailing_comma-uncommented.json 
new/commentjson-0.9.0/commentjson/tests/trailing_comma-uncommented.json
--- old/commentjson-0.8.2/commentjson/tests/trailing_comma-uncommented.json     
1970-01-01 01:00:00.000000000 +0100
+++ new/commentjson-0.9.0/commentjson/tests/trailing_comma-uncommented.json     
2020-10-05 20:18:00.000000000 +0200
@@ -0,0 +1,13 @@
+{
+    "a": 1,
+    "c": {
+        "d": "4.3",
+        "e": {
+            "1": "1 # testing",
+            "2": "2",
+            "2.2": "2",
+            "3": "3"
+        }
+    },
+    "b": 2
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/requirements.txt 
new/commentjson-0.9.0/requirements.txt
--- old/commentjson-0.8.2/requirements.txt      1970-01-01 01:00:00.000000000 
+0100
+++ new/commentjson-0.9.0/requirements.txt      2020-10-05 20:18:00.000000000 
+0200
@@ -0,0 +1 @@
+lark-parser<0.8.0,>=0.7.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/setup.py 
new/commentjson-0.9.0/setup.py
--- old/commentjson-0.8.2/setup.py      2019-09-02 19:05:44.000000000 +0200
+++ new/commentjson-0.9.0/setup.py      2020-10-05 20:18:00.000000000 +0200
@@ -6,10 +6,10 @@
 from setuptools import setup, find_packages
 
 
-__version__ = '.'.join(map(str, (0, 8, 2)))
+__version__ = '0.9.0'
 
 install_requires = [
-    'lark-parser>=0.7.1'
+    'lark-parser>=0.7.1,<0.8.0'
 ]
 if sys.version_info <= (2, 6):
     install_requires.append('simplejson')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/commentjson-0.8.2/tools/bump-version.py 
new/commentjson-0.9.0/tools/bump-version.py
--- old/commentjson-0.8.2/tools/bump-version.py 1970-01-01 01:00:00.000000000 
+0100
+++ new/commentjson-0.9.0/tools/bump-version.py 2020-10-05 20:18:00.000000000 
+0200
@@ -0,0 +1,36 @@
+import re
+import sys
+
+
+VERSION_RE = r'\'(([0-9]+\.){2}[0-9])\''
+
+
+if __name__ == '__main__':
+    cmd = sys.argv[1]
+
+    if cmd == '--get-current':
+        with open('setup.py') as fp:
+            for line in fp.readlines():
+                if '__version__' in line:
+                    match = re.search(VERSION_RE, line)
+                    if match:
+                        print(match.groups()[0])
+    elif cmd == '--set-version':
+        stdin_input = input()
+        if not len(stdin_input):
+            print('No input provided on stdin.')
+            sys.exit(1)
+
+        lines = []
+        with open('setup.py') as fp:
+            for line in fp.readlines():
+                if '__version__' in line:
+                    line = re.sub(VERSION_RE, '\'%s\'' % stdin_input, line)
+                lines.append(line)
+
+        with open('setup.py', 'w') as fp:
+            fp.write(''.join(lines))
+
+    else:
+        print('Invalid command')
+        sys.exit(1)

Reply via email to