Skip to contentSkip to conversation

python3-jsmin: Fix ptests to run with python 3.12+

PATCH Superseded Khem Raj 1 participant 1 message Feb 22, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 python3-jsmin: Fix ptests to run with python 3.12+

---
 ...d76c2d6bfb917f30ced8f5c0a9a4157f7819.patch | 82 +++++++++++++++++++
 .../python/python3-jsmin_3.0.1.bb             |  1 +
 2 files changed, 83 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-jsmin/7a75d76c2d6bfb917f30ced8f5c0a9a4157f7819.patch
meta-python/recipes-devtools/python/python3-jsmin/7a75d76c2d6bfb917f30ced8f5c0a9a4157f7819.patch new file +82 -0
new file mode 100644
index 0000000000..2646e2f5a0
@@ -0,0 +1,82 @@
+From 7a75d76c2d6bfb917f30ced8f5c0a9a4157f7819 Mon Sep 17 00:00:00 2001
+From: aekoroglu <[email protected]>
+Date: Fri, 24 Jun 2022 14:12:59 +0300
+Subject: [PATCH] DeprecationWarning invalid escape sequence fix
+
+Upstream-Status: Submitted [https://github.com/tikitu/jsmin/pull/38]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ jsmin/test.py | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/jsmin/test.py b/jsmin/test.py
+index 173ac65..afea4e7 100644
+--- a/jsmin/test.py
++++ b/jsmin/test.py
+@@ -337,8 +337,8 @@ def testImplicitSemicolon3(self):
+         self.assertMinified("return//comment...\r\na", "return\na")
+ 
+     def testSingleComment2(self):
+-        self.assertMinified('x.replace(/\//, "_")// slash to underscore',
+-                'x.replace(/\//,"_")')
++        self.assertMinified('x.replace(/\\//, "_")// slash to underscore',
++                'x.replace(/\\//,"_")')
+ 
+     def testSlashesNearComments(self):
+         original = '''
+@@ -383,8 +383,8 @@ def test_space_in_regex(self):
+         self.assertMinified(original, original)
+ 
+     def test_brackets_around_slashed_regex(self):
+-        original = 'function a() { /\//.test("a") }'
+-        expected = 'function a(){/\//.test("a")}'
++        original = 'function a() { /\\//.test("a") }'
++        expected = 'function a(){/\\//.test("a")}'
+         self.assertMinified(original, expected)
+ 
+     def test_angular_1(self):
+@@ -455,12 +455,12 @@ def testBackticksTagged(self):
+     def test_issue_bitbucket_16(self):
+         original = """
+             f = function() {
+-                return /DataTree\/(.*)\//.exec(this._url)[1];
++                return /DataTree\\/(.*)\\//.exec(this._url)[1];
+             }
+         """
+         self.assertMinified(
+             original,
+-            'f=function(){return /DataTree\/(.*)\//.exec(this._url)[1];}')
++            'f=function(){return /DataTree\\/(.*)\\//.exec(this._url)[1];}')
+ 
+     def test_issue_bitbucket_17(self):
+         original = "// hi\n/^(get|post|head|put)$/i.test('POST')"
+@@ -470,7 +470,7 @@ def test_issue_bitbucket_17(self):
+     def test_issue_6(self):
+         original = '''
+             respond.regex = {
+-                comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
++                comments: /\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//gi,
+                 urls: 'whatever'
+             };
+         '''
+@@ -548,16 +548,16 @@ def test_issue_9_multi_comments(self):
+ 
+     def test_issue_12_re_nl_if(self):
+         original = '''
+-            var re = /\d{4}/
++            var re = /\\d{4}/
+             if (1) { console.log(2); }'''
+         self.assertMinified(
+-            original, 'var re=/\d{4}/\nif(1){console.log(2);}')
++            original, 'var re=/\\d{4}/\nif(1){console.log(2);}')
+ 
+     def test_issue_12_re_nl_other(self):
+         original = '''
+-            var re = /\d{4}/
++            var re = /\\d{4}/
+             g = 10'''
+-        self.assertMinified(original , 'var re=/\d{4}/\ng=10')
++        self.assertMinified(original , 'var re=/\\d{4}/\ng=10')
+ 
+     def test_preserve_copyright(self):
+         original = '''
meta-python/recipes-devtools/python/python3-jsmin_3.0.1.bb +1 -0
index 15c9b14595..c3129e7b53 100644
@@ -10,6 +10,7 @@ SRC_URI[sha256sum] = "c0959a121ef94542e807a674142606f7e90214a2b3d1eb17300244bbb5
 BBCLASSEXTEND = "native nativesdk"
 
 SRC_URI += " \
+  file://7a75d76c2d6bfb917f30ced8f5c0a9a4157f7819.patch \
 	file://run-ptest \
 "
 
Signature · 1 line
2.43.2