[dwarffortress] Updated to latest upstream release, 0.47.05.
by Leigh Scott
commit d6f312610adff34f61ba04d19de0dcf5f5fbb7a4
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Tue Jul 19 13:53:34 2022 +0100
Updated to latest upstream release, 0.47.05.
.gitignore | 43 ++---------------
6dcfe5ae869fddd51940c6c37a95f7bc639f4389.patch | 66 +++++++++++++++++++++++++
dwarffortress.spec | 67 ++++++++++++++------------
sources | 8 +--
4 files changed, 106 insertions(+), 78 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 15aa323..4ce2d48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,41 +1,4 @@
*.src.rpm
-/0.43.05.zip
-/df_43_05_linux.tar.bz2
-/df_43_05_linux32.tar.bz2
-/dwarffortress-launcher.tar.xz
-/0.44.02.zip
-/df_44_02_linux.tar.bz2
-/df_44_02_linux32.tar.bz2
-/0.44.03.zip
-/df_44_03_linux32.tar.bz2
-/df_44_03_linux.tar.bz2
-/df_44_04_linux.tar.bz2
-/df_44_04_linux32.tar.bz2
-/0.44.04.zip
-/df_44_05_linux.tar.bz2
-/df_44_05_linux32.tar.bz2
-/0.44.05.zip
-/0.44.07.zip
-/df_44_07_linux32.tar.bz2
-/df_44_07_linux.tar.bz2
-/0.44.09.zip
-/df_44_09_linux32.tar.bz2
-/df_44_09_linux.tar.bz2
-/0.44.10.zip
-/df_44_10_linux32.tar.bz2
-/df_44_10_linux.tar.bz2
-/df_44_11_linux32.tar.bz2
-/df_44_11_linux.tar.bz2
-/dwarffortress-libgraphics-0.44.11.zip
-/df_44_12_linux32.tar.bz2
-/df_44_12_linux.tar.bz2
-/dwarffortress-libgraphics-0.44.12.zip
-/df_47_01_linux32.tar.bz2
-/df_47_01_linux.tar.bz2
-/dwarffortress-libgraphics-0.47.01.zip
-/df_47_03_linux32.tar.bz2
-/df_47_03_linux.tar.bz2
-/dwarffortress-libgraphics-0.47.03.zip
-/df_47_04_linux.tar.bz2
-/df_47_04_linux32.tar.bz2
-/dwarffortress-libgraphics-0.47.04.zip
+/dwarffortress-libgraphics-*.zip
+/df_*_linux.tar.bz2
+
diff --git a/6dcfe5ae869fddd51940c6c37a95f7bc639f4389.patch b/6dcfe5ae869fddd51940c6c37a95f7bc639f4389.patch
new file mode 100644
index 0000000..eb3b45a
--- /dev/null
+++ b/6dcfe5ae869fddd51940c6c37a95f7bc639f4389.patch
@@ -0,0 +1,66 @@
+From 6dcfe5ae869fddd51940c6c37a95f7bc639f4389 Mon Sep 17 00:00:00 2001
+From: Finn Rayment <finn(a)rayment.fr>
+Date: Mon, 1 Feb 2021 19:17:50 +0100
+Subject: [PATCH] Added 0.47.04 bugfix
+
+Fixes audio bug causing segmentation fault and infinite loop on game close as
+described at https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
+---
+ g_src/enabler.cpp | 4 ++++
+ g_src/music_and_sound_openal.cpp | 14 +++++++++++---
+ 2 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/g_src/enabler.cpp b/g_src/enabler.cpp
+index c0cfda8..7db0142 100644
+--- a/g_src/enabler.cpp
++++ b/g_src/enabler.cpp
+@@ -590,6 +590,10 @@ int enablerst::loop(string cmdline) {
+
+ // Clean up graphical resources
+ delete renderer;
++
++ // FIX infinite loop
++ // https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
++ return 0;
+ }
+
+ void enablerst::override_grid_size(int x, int y) {
+diff --git a/g_src/music_and_sound_openal.cpp b/g_src/music_and_sound_openal.cpp
+index 1ee0941..75a8177 100644
+--- a/g_src/music_and_sound_openal.cpp
++++ b/g_src/music_and_sound_openal.cpp
+@@ -250,7 +250,9 @@ void musicsoundst::deinitsound() {
+ alDeleteBuffers(1, &buffer);
+ }
+ // Deinit OpenAL
+- alcMakeContextCurrent(NULL);
++ // FIX infinite loop
++ // https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
++ //alcMakeContextCurrent(NULL);
+ alcDestroyContext(context);
+ alcCloseDevice(device);
+
+@@ -480,7 +482,10 @@ static bool init_openal() {
+
+ void alEnable( ALenum capability ) { _alEnable(capability); }
+ void alDisable( ALenum capability ) { _alDisable(capability); }
+-ALboolean alIsEnabled( ALenum capability ) { _alIsEnabled(capability); }
++//ALboolean alIsEnabled( ALenum capability ) { _alIsEnabled(capability); }
++// FIX return statement
++// https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
++ALboolean alIsEnabled( ALenum capability ) { return _alIsEnabled(capability); }
+ const ALchar* alGetString( ALenum param ) { return _alGetString(param); }
+ void alGetBooleanv( ALenum param, ALboolean* data ) { _alGetBooleanv(param, data); }
+ void alGetIntegerv( ALenum param, ALint* data ) { _alGetIntegerv(param, data); }
+@@ -490,7 +495,10 @@ ALboolean alGetBoolean( ALenum param ) { return _alGetBoolean(param); }
+ ALint alGetInteger( ALenum param ) { return _alGetInteger(param); }
+ ALfloat alGetFloat( ALenum param ) { return _alGetFloat(param); }
+ ALdouble alGetDouble( ALenum param ) { return _alGetDouble(param); }
+-ALenum alGetError( void ) { _alGetError(); }
++//ALenum alGetError( void ) { _alGetError(); }
++// FIX return statement
++// https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
++ALenum alGetError( void ) { return _alGetError(); }
+ ALboolean alIsExtensionPresent( const ALchar* extname ) { return _alIsExtensionPresent(extname); }
+ void* alGetProcAddress( const ALchar* fname ) { return _alGetProcAddress(fname); }
+ ALenum alGetEnumValue( const ALchar* ename ) { return _alGetEnumValue(ename); }
diff --git a/dwarffortress.spec b/dwarffortress.spec
index 6ef1d77..32f4fff 100644
--- a/dwarffortress.spec
+++ b/dwarffortress.spec
@@ -4,8 +4,8 @@
%global __strip /bin/true
Name: dwarffortress
-Version: 0.47.04
-Release: 6%{?dist}
+Version: 0.47.05
+Release: 1%{?dist}
Summary: A single-player procedurally generated fantasy game
@@ -13,27 +13,29 @@ License: Dwarf Fortress
URL: http://www.bay12games.com/dwarves/
# Due to pre-compiled stuff, there is a separate 32 and 64 bit architecture.
-Source0: http://www.bay12games.com/dwarves/df_47_04_linux.tar.bz2
-Source1: http://www.bay12games.com/dwarves/df_47_04_linux32.tar.bz2
+Source0: http://www.bay12games.com/dwarves/df_47_05_linux.tar.bz2
# The libgraphics sources, as maintained by the Arch Linux packager.
-Source2: https://github.com/svenstaro/dwarf_fortress_unfuck/archive/%{version}/dwa...
+Source1: https://github.com/svenstaro/dwarf_fortress_unfuck/archive/%{version}/dwa...
# Desktop file.
-Source3: dwarffortress.desktop
+Source2: dwarffortress.desktop
# Appstream file.
-Source4: dwarffortress.appdata.xml
+Source3: dwarffortress.appdata.xml
# Launcher script.
-Source5: dwarffortress
+Source4: dwarffortress
# Icon.
-Source6: dwarffortress.png
+Source5: dwarffortress.png
+
+# https://github.com/svenstaro/dwarf_fortress_unfuck/commit/6dcfe5ae869fddd...
+Patch0: 6dcfe5ae869fddd51940c6c37a95f7bc639f4389.patch
# Only build for 32 and 64 bit x86 systems.
# (According to kwizart, just use i686 here).
-ExclusiveArch: x86_64 i686
+ExclusiveArch: x86_64
# BuildRequires from https://github.com/svenstaro/dwarf_fortress_unfuck/
BuildRequires: automake
@@ -80,31 +82,26 @@ have already been implemented.
Dwarf Fortress is free to redistribute, but is not open source.
%prep
-# Extract the 'sources' into the build directory.
-# This is architecture-dependent, because upstream distributes two tarballs.
-%ifarch x86_64
tar xfj %SOURCE0
-%else
-tar xfj %SOURCE1
-%endif
# Extract other sources.
cd df_linux/
-unzip -qo %SOURCE2
+unzip -qo %SOURCE1
# Fix some permissions.
find -type d -exec chmod 755 {} +
find -type f -exec chmod 644 {} +
dos2unix *.txt
-%build
-cd df_linux/
cd dwarf_fortress_unfuck*
-mkdir -p build && cd build
+%patch0 -p1
+
+%build
+cd df_linux/dwarf_fortress_unfuck*
# Something in the default make flags prevents dfhack from linking to DF.
-cmake ..
-%make_build
+%cmake -DOpenGL_GL_PREFERENCE=GLVND
+%cmake_build
%install
cd df_linux/
@@ -114,32 +111,38 @@ cp -ra data raw sdl %{buildroot}%{_datadir}/dwarffortress/
# Copy over the actual binary and compiled graphics library.
install -p -Dm755 libs/Dwarf_Fortress %{buildroot}%{_libexecdir}/dwarffortress/Dwarf_Fortress
-install -p -Dm755 dwarf_fortress_unfuck*/build/libgraphics.so %{buildroot}%{_libexecdir}/dwarffortress/libgraphics.so
+install -p -Dm755 dwarf_fortress_unfuck*/%{_vpath_builddir}/libgraphics.so %{buildroot}%{_libexecdir}/dwarffortress/libgraphics.so
strip %{buildroot}%{_libexecdir}/dwarffortress/libgraphics.so
# Install .desktop file and launcher script from Arch Linux package.
# Or, rather, the modified versions.
-install -p -Dm755 %SOURCE5 %{buildroot}%{_bindir}/dwarffortress
+install -p -Dm755 %SOURCE4 %{buildroot}%{_bindir}/dwarffortress
sed 's|prefix=/usr|prefix=%{_prefix}|' -i %{buildroot}%{_bindir}/dwarffortress
-install -p -Dm644 %SOURCE3 %{buildroot}%{_datadir}/applications/dwarffortress.desktop
-install -p -Dm644 %SOURCE6 %{buildroot}%{_datadir}/pixmaps/dwarffortress.png
+install -p -Dm644 %SOURCE2 %{buildroot}%{_datadir}/applications/dwarffortress.desktop
+install -p -Dm644 %SOURCE5 %{buildroot}%{_datadir}/pixmaps/dwarffortress.png
desktop-file-validate %{buildroot}%{_datadir}/applications/dwarffortress.desktop
# Install appdata file and validate it.
-mkdir -p %{buildroot}%{_datadir}/appdata
-cp -a %SOURCE4 %{buildroot}%{_datadir}/appdata/
-appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml
+mkdir -p %{buildroot}%{_metainfodir}/
+cp -a %SOURCE3 %{buildroot}%{_metainfodir}/
+appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml
%files
%doc df_linux/*.txt df_linux/README.linux
-%{_datadir}/dwarffortress
-%{_libexecdir}/dwarffortress
+%{_datadir}/dwarffortress/
+%{_libexecdir}/dwarffortress/
%{_bindir}/dwarffortress
%{_datadir}/applications/dwarffortress.desktop
%{_datadir}/pixmaps/dwarffortress.png
-%{_datadir}/appdata/dwarffortress.appdata.xml
+%{_metainfodir}/dwarffortress.appdata.xml
%changelog
+* Tue Jul 19 2022 Leigh Scott <leigh123linux(a)gmail.com> - 0.47.05-1
+- Updated to latest upstream release, 0.47.05.
+- Apply upstream fix for rfbz#6368
+- Use cmake macros
+- Remove i686 support
+
* Mon Feb 28 2022 Sérgio Basto <sergio(a)serjux.com> - 0.47.04-6
- Rebuid for glew-2.2.0
diff --git a/sources b/sources
index 7a81027..7ce55f5 100644
--- a/sources
+++ b/sources
@@ -1,6 +1,2 @@
-SHA512 (df_47_03_linux32.tar.bz2) = 76e841b86c699479833a044552ec902632420896f3618034a76f7a86b4d5a47073fa4c35a0ccecc246e44abe5500dfc9aa153d109a039e5a07546c58770468fa
-SHA512 (df_47_03_linux.tar.bz2) = a7122fb1f5433200f43344f7f905494184ba916d0316cd0bfde1f2d4f11685ec2e0bad0276b169ca34b4fb0774d62e6d1e03060c2d6ef79140ced62cba1fac95
-SHA512 (dwarffortress-libgraphics-0.47.03.zip) = ddd8bcdd7b94197755e13979925267f1d597c412ec138cc29a094c986453285a3a30369369e989e523e9ec4b0e6d177330604e59296eb026869573ca7e57e7b5
-SHA512 (df_47_04_linux.tar.bz2) = 65f6cd39187afbb7b60ba72d0caf23c39d95674615ab718ad55c25cad23c08e42c1b911cfde7015b05a280325504f3b931f2c7defb34ee2ee6b725101c536cea
-SHA512 (df_47_04_linux32.tar.bz2) = d76286957ed3f1e677519c45b9644463e45c07c226ce3200f2db6a776396e77fc8aa3f5fdd697fdbde5efa49b7d0dce47b98dfe0a880b666e227ccb8b288a6c0
-SHA512 (dwarffortress-libgraphics-0.47.04.zip) = 25e5386a1165786dc777d17ea6dd6eefb4fdc7c9d0677c1cd683468d8656ef093b89f84927a7df8ea9c1941e67b018e1cb95abf29f38782b0bf6289eab284529
+SHA512 (df_47_05_linux.tar.bz2) = 9ea46fa12a80266cd09363f1aea8cdd059a5ebeefb453c4a46ffbb1115486409003c3caca95a1b6010da4040d04b781182c59e57a6cc033cd7de4507299f7534
+SHA512 (dwarffortress-libgraphics-0.47.05.zip) = fd0eff0c86b943a6601c07aa867f17d3f55514a72215e91a8017465e03ed934b07ee72906ccbe6d6ecaf982f8b814d7dfcc222975abb7f70b72edf2583c25b6d
2 years, 4 months
[vdr-softhddevice] Update to 1.8.2
by Martin Gansser
commit 9b122799228fb69c054be4792b4565d2b950aa22
Author: Martin Gansser <mgansser(a)online.de>
Date: Mon Jul 18 19:13:51 2022 +0200
Update to 1.8.2
.gitignore | 1 +
sources | 2 +-
vdr-softhddevice.spec | 7 +++++--
3 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8b0344f..e70d9ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
/vdr-softhddevice-1.2.7.tar.gz
/vdr-softhddevice-1.2.8.tar.gz
/vdr-softhddevice-1.4.0.tar.gz
+/vdr-softhddevice-1.8.2.tar.gz
diff --git a/sources b/sources
index dabe170..cf83b5f 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (vdr-softhddevice-1.4.0.tar.gz) = 332a2782214f8eaa0941544a7d2514947e75c5447175699e2f9b7d705b47fb7d377d4c4e616acc7039552ec66003490310bef0e3a80968656ca04634e2ef7b15
+SHA512 (vdr-softhddevice-1.8.2.tar.gz) = 51c925352df54ca0b6d46aefdd8f7e6e3dd82b5344e18e2be095966ede4c6765131071fe7f4523d8c5adff77d5eaaea28b09adafbf2b7f309fa7299fb2a48dea
diff --git a/vdr-softhddevice.spec b/vdr-softhddevice.spec
index 54ea390..af5066f 100644
--- a/vdr-softhddevice.spec
+++ b/vdr-softhddevice.spec
@@ -9,8 +9,8 @@
Name: vdr-softhddevice
-Version: 1.4.0
-Release: 2%{?dist}
+Version: 1.8.2
+Release: 1%{?dist}
Summary: A software and GPU emulated HD output device plugin for VDR
License: AGPLv3
@@ -89,6 +89,9 @@ install -Dpm 644 %{SOURCE1} \
%license AGPL-3.0.txt
%changelog
+* Mon Jul 18 2022 Martin Gansser <martinkg(a)fedoraproject.org> - 1.8.2-1
+- Update to 1.8.2
+
* Fri Apr 22 2022 Sérgio Basto <sergio(a)serjux.com> - 1.4.0-2
- set minimum version of vdr for each branch
2 years, 4 months
[gstreamer1-libav] Fix rfbz#6354
by Leigh Scott
commit 78335dbaa11b3ed3eabf678b08d9b9e320f5537d
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Mon Jul 18 08:24:05 2022 +0100
Fix rfbz#6354
139.patch | 229 --------------------------------------------------
2074.patch | 45 ++++++++++
gstreamer1-libav.spec | 10 ++-
3 files changed, 52 insertions(+), 232 deletions(-)
---
diff --git a/2074.patch b/2074.patch
new file mode 100644
index 0000000..09865d0
--- /dev/null
+++ b/2074.patch
@@ -0,0 +1,45 @@
+From 530272850d00e29851c938f5c0d771e18e5223ac Mon Sep 17 00:00:00 2001
+From: Edward Hervey <edward(a)centricular.com>
+Date: Tue, 29 Mar 2022 09:36:06 +0200
+Subject: [PATCH] avviddec: Remove vc1/wmv3 override
+
+FFMPEG 5+ doesn't allow overriding the codec anymore (causes a segfault if you
+attempt to do that). But the best part is ... that with the current caps
+implementation in pad template and gst_ffmpeg_caps_to_codecid() we would never
+replace it by anything different than the existing codec id.
+
+Fixes #1054
+
+Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2074>
+---
+ ext/libav/gstavviddec.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
+index f5197fbe143..304dec5dfe1 100644
+--- a/ext/libav/gstavviddec.c
++++ b/ext/libav/gstavviddec.c
+@@ -477,10 +477,6 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
+ GST_DEBUG_OBJECT (ffmpegdec, "setcaps called");
+
+ GST_OBJECT_LOCK (ffmpegdec);
+- /* stupid check for VC1 */
+- if ((oclass->in_plugin->id == AV_CODEC_ID_WMV3) ||
+- (oclass->in_plugin->id == AV_CODEC_ID_VC1))
+- oclass->in_plugin->id = gst_ffmpeg_caps_to_codecid (state->caps, NULL);
+
+ /* close old session */
+ if (ffmpegdec->opened) {
+@@ -2553,8 +2549,7 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
+
+ /* (Ronald) MPEG-4 gets a higher priority because it has been well-
+ * tested and by far outperforms divxdec/xviddec - so we prefer it.
+- * msmpeg4v3 same, as it outperforms divxdec for divx3 playback.
+- * VC1/WMV3 are not working and thus unpreferred for now. */
++ * msmpeg4v3 same, as it outperforms divxdec for divx3 playback. */
+ switch (in_plugin->id) {
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
+--
+GitLab
+
diff --git a/gstreamer1-libav.spec b/gstreamer1-libav.spec
index 9531894..d82d20b 100644
--- a/gstreamer1-libav.spec
+++ b/gstreamer1-libav.spec
@@ -4,12 +4,12 @@
Name: gstreamer1-libav
Epoch: 1
Version: 1.20.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: GStreamer 1.0 libav-based plug-ins
License: LGPLv2+
URL: https://gstreamer.freedesktop.org/
Source0: %{url}/src/gst-libav/gst-libav-%{version}.tar.xz
-Patch0: https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/139.p...
+Patch0: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2074....
BuildRequires: gcc-c++
BuildRequires: meson
@@ -47,7 +47,8 @@ plug-in.
%prep
-%setup -n gst-libav-%{version}
+%setup -q -n gst-libav-%{version}
+%patch0 -p1
%build
%meson \
@@ -73,6 +74,9 @@ plug-in.
%endif
%changelog
+* Mon Jul 18 2022 Leigh Scott <leigh123linux(a)gmail.com> - 1:1.20.0-2
+- Fix rfbz#6354
+
* Sun Feb 06 2022 Sérgio Basto <sergio(a)serjux.com> - 1:1.20.0-1
- Update gstreamer1-libav to 1.20.0
2 years, 4 months
[pangzero] Fix "Can't call method "format" on an undefined value" errors (rf#6325)
by jwrdegoede
commit 6139332d1ffc440a98adb786a38cfaadd071ac69
Author: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat Jul 16 21:02:19 2022 +0200
Fix "Can't call method "format" on an undefined value" errors (rf#6325)
.gitignore | 1 +
pangzero.spec | 10 +++++++---
sources | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 65eda58..9985777 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
pangzero-master.tar.gz
/pangzero-737500d.tar.gz
/pangzero-259f967.tar.gz
+/pangzero-b3f9cb0.tar.gz
diff --git a/pangzero.spec b/pangzero.spec
index 41b0ec3..972d4ec 100644
--- a/pangzero.spec
+++ b/pangzero.spec
@@ -1,10 +1,10 @@
%global github_repo https://github.com/jwrdegoede/pangzero/archive/%{commit}
-%global commit 259f9679773273cb0b8ec5026046f5f27af1b0c0
+%global commit b3f9cb0b2e5634771446a9735a90ed9dfde1fd3c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: pangzero
Version: 1.4.1
-Release: 23%{?dist}
+Release: 24%{?dist}
Summary: A clone and enhancement of Super Pang
Group: Amusements/Games
License: GPLv2
@@ -71,7 +71,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
-%doc AUTHORS ChangeLog COPYING NEWS README
+%doc AUTHORS ChangeLog README
+%license COPYING
%{_bindir}/pangzero
%{perl_vendorlib}/Games/
%{perl_vendorlib}/auto/
@@ -83,6 +84,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog
+* Sat Jul 16 2022 Hans de Goede <hans(a)hansg.org> - 1.4.1-24
+- Fix "Can't call method "format" on an undefined value" errors (rf#6325)
+
* Tue Jun 21 2022 Paul Howarth <paul(a)city-fan.org> - 1.4.1-23
- Perl 5.36 rebuild
diff --git a/sources b/sources
index c8c6625..75ae201 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-0c4c6ac4d142e4c02892a1021a9c211f pangzero-259f967.tar.gz
+SHA512 (pangzero-b3f9cb0.tar.gz) = afdd1c48dc6a5bb62451564a4c0907b7354a4b3d2369d8302e25b6a2a55a7744e041722bf090f97f5c6185da088aa3e2f528cfc772acf16d3536e879640674d7
2 years, 4 months
[chromium-freeworld] fix python311
by Leigh Scott
commit 56841b068bd5899d06332c92d00e151477c47214
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Sat Jul 16 08:22:27 2022 +0100
fix python311
chromium-freeworld.spec | 2 +
chromium-python-six-1.16.0.patch | 360 +++++++
chromium-update-rjsmin-to-1.2.0.patch | 1700 +++++++++++++++++++++++++++++++++
3 files changed, 2062 insertions(+)
---
diff --git a/chromium-freeworld.spec b/chromium-freeworld.spec
index 8c100da..c9775c9 100644
--- a/chromium-freeworld.spec
+++ b/chromium-freeworld.spec
@@ -186,6 +186,8 @@ Patch300: chromium-py3-bootstrap.patch
Patch301: chromium-gcc11.patch
Patch302: chromium-java-only-allowed-in-android-builds.patch
Patch303: chromium-aarch64-cxxflags-addition.patch
+Patch304: chromium-python-six-1.16.0.patch
+Patch305: chromium-update-rjsmin-to-1.2.0.patch
# RPM Fusion patches [free/chromium-freeworld]:
Patch401: chromium-fix-vaapi-on-intel.patch
diff --git a/chromium-python-six-1.16.0.patch b/chromium-python-six-1.16.0.patch
new file mode 100644
index 0000000..1213e3f
--- /dev/null
+++ b/chromium-python-six-1.16.0.patch
@@ -0,0 +1,360 @@
+diff -up chromium-103.0.5060.53/third_party/catapult/third_party/six/six.py.116 chromium-103.0.5060.53/third_party/catapult/third_party/six/six.py
+--- chromium-103.0.5060.53/third_party/catapult/third_party/six/six.py.116 2022-07-05 13:31:29.434673638 +0000
++++ chromium-103.0.5060.53/third_party/catapult/third_party/six/six.py 2022-07-05 21:52:01.884578748 +0000
+@@ -29,7 +29,7 @@ import sys
+ import types
+
+ __author__ = "Benjamin Peterson <benjamin(a)python.org>"
+-__version__ = "1.15.0"
++__version__ = "1.16.0"
+
+
+ # Useful for very coarse version differentiation.
+@@ -71,6 +71,11 @@ else:
+ MAXSIZE = int((1 << 63) - 1)
+ del X
+
++if PY34:
++ from importlib.util import spec_from_loader
++else:
++ spec_from_loader = None
++
+
+ def _add_doc(func, doc):
+ """Add documentation to a function."""
+@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
+ return self
+ return None
+
++ def find_spec(self, fullname, path, target=None):
++ if fullname in self.known_modules:
++ return spec_from_loader(fullname, self)
++ return None
++
+ def __get_module(self, fullname):
+ try:
+ return self.known_modules[fullname]
+@@ -223,6 +233,12 @@ class _SixMetaPathImporter(object):
+ return None
+ get_source = get_code # same as get_code
+
++ def create_module(self, spec):
++ return self.load_module(spec.name)
++
++ def exec_module(self, module):
++ pass
++
+ _importer = _SixMetaPathImporter(__name__)
+
+
+diff -up chromium-103.0.5060.53/third_party/protobuf/third_party/six/six.py.116 chromium-103.0.5060.53/third_party/protobuf/third_party/six/six.py
+--- chromium-103.0.5060.53/third_party/protobuf/third_party/six/six.py.116 2022-07-05 13:32:17.815058318 +0000
++++ chromium-103.0.5060.53/third_party/protobuf/third_party/six/six.py 2022-07-05 22:00:28.139721738 +0000
+@@ -1,4 +1,4 @@
+-# Copyright (c) 2010-2018 Benjamin Peterson
++# Copyright (c) 2010-2020 Benjamin Peterson
+ #
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
+ # of this software and associated documentation files (the "Software"), to deal
+@@ -29,7 +29,7 @@ import sys
+ import types
+
+ __author__ = "Benjamin Peterson <benjamin(a)python.org>"
+-__version__ = "1.12.0"
++__version__ = "1.16.0"
+
+
+ # Useful for very coarse version differentiation.
+@@ -71,6 +71,11 @@ else:
+ MAXSIZE = int((1 << 63) - 1)
+ del X
+
++if PY34:
++ from importlib.util import spec_from_loader
++else:
++ spec_from_loader = None
++
+
+ def _add_doc(func, doc):
+ """Add documentation to a function."""
+@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
+ return self
+ return None
+
++ def find_spec(self, fullname, path, target=None):
++ if fullname in self.known_modules:
++ return spec_from_loader(fullname, self)
++ return None
++
+ def __get_module(self, fullname):
+ try:
+ return self.known_modules[fullname]
+@@ -223,6 +233,12 @@ class _SixMetaPathImporter(object):
+ return None
+ get_source = get_code # same as get_code
+
++ def create_module(self, spec):
++ return self.load_module(spec.name)
++
++ def exec_module(self, module):
++ pass
++
+ _importer = _SixMetaPathImporter(__name__)
+
+
+@@ -255,9 +271,11 @@ _moved_attributes = [
+ MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
+ MovedModule("builtins", "__builtin__"),
+ MovedModule("configparser", "ConfigParser"),
++ MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"),
+ MovedModule("copyreg", "copy_reg"),
+ MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
+- MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
++ MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
++ MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"),
+ MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
+ MovedModule("http_cookies", "Cookie", "http.cookies"),
+ MovedModule("html_entities", "htmlentitydefs", "html.entities"),
+@@ -637,13 +655,16 @@ if PY3:
+ import io
+ StringIO = io.StringIO
+ BytesIO = io.BytesIO
++ del io
+ _assertCountEqual = "assertCountEqual"
+ if sys.version_info[1] <= 1:
+ _assertRaisesRegex = "assertRaisesRegexp"
+ _assertRegex = "assertRegexpMatches"
++ _assertNotRegex = "assertNotRegexpMatches"
+ else:
+ _assertRaisesRegex = "assertRaisesRegex"
+ _assertRegex = "assertRegex"
++ _assertNotRegex = "assertNotRegex"
+ else:
+ def b(s):
+ return s
+@@ -665,6 +686,7 @@ else:
+ _assertCountEqual = "assertItemsEqual"
+ _assertRaisesRegex = "assertRaisesRegexp"
+ _assertRegex = "assertRegexpMatches"
++ _assertNotRegex = "assertNotRegexpMatches"
+ _add_doc(b, """Byte literal""")
+ _add_doc(u, """Text literal""")
+
+@@ -681,6 +703,10 @@ def assertRegex(self, *args, **kwargs):
+ return getattr(self, _assertRegex)(*args, **kwargs)
+
+
++def assertNotRegex(self, *args, **kwargs):
++ return getattr(self, _assertNotRegex)(*args, **kwargs)
++
++
+ if PY3:
+ exec_ = getattr(moves.builtins, "exec")
+
+@@ -716,16 +742,7 @@ else:
+ """)
+
+
+-if sys.version_info[:2] == (3, 2):
+- exec_("""def raise_from(value, from_value):
+- try:
+- if from_value is None:
+- raise value
+- raise value from from_value
+- finally:
+- value = None
+-""")
+-elif sys.version_info[:2] > (3, 2):
++if sys.version_info[:2] > (3,):
+ exec_("""def raise_from(value, from_value):
+ try:
+ raise value from from_value
+@@ -805,13 +822,33 @@ if sys.version_info[:2] < (3, 3):
+ _add_doc(reraise, """Reraise an exception.""")
+
+ if sys.version_info[0:2] < (3, 4):
++ # This does exactly the same what the :func:`py3:functools.update_wrapper`
++ # function does on Python versions after 3.2. It sets the ``__wrapped__``
++ # attribute on ``wrapper`` object and it doesn't raise an error if any of
++ # the attributes mentioned in ``assigned`` and ``updated`` are missing on
++ # ``wrapped`` object.
++ def _update_wrapper(wrapper, wrapped,
++ assigned=functools.WRAPPER_ASSIGNMENTS,
++ updated=functools.WRAPPER_UPDATES):
++ for attr in assigned:
++ try:
++ value = getattr(wrapped, attr)
++ except AttributeError:
++ continue
++ else:
++ setattr(wrapper, attr, value)
++ for attr in updated:
++ getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
++ wrapper.__wrapped__ = wrapped
++ return wrapper
++ _update_wrapper.__doc__ = functools.update_wrapper.__doc__
++
+ def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
+ updated=functools.WRAPPER_UPDATES):
+- def wrapper(f):
+- f = functools.wraps(wrapped, assigned, updated)(f)
+- f.__wrapped__ = wrapped
+- return f
+- return wrapper
++ return functools.partial(_update_wrapper, wrapped=wrapped,
++ assigned=assigned, updated=updated)
++ wraps.__doc__ = functools.wraps.__doc__
++
+ else:
+ wraps = functools.wraps
+
+@@ -824,7 +861,15 @@ def with_metaclass(meta, *bases):
+ class metaclass(type):
+
+ def __new__(cls, name, this_bases, d):
+- return meta(name, bases, d)
++ if sys.version_info[:2] >= (3, 7):
++ # This version introduced PEP 560 that requires a bit
++ # of extra care (we mimic what is done by __build_class__).
++ resolved_bases = types.resolve_bases(bases)
++ if resolved_bases is not bases:
++ d['__orig_bases__'] = bases
++ else:
++ resolved_bases = bases
++ return meta(name, resolved_bases, d)
+
+ @classmethod
+ def __prepare__(cls, name, this_bases):
+@@ -861,12 +906,11 @@ def ensure_binary(s, encoding='utf-8', e
+ - `str` -> encoded to `bytes`
+ - `bytes` -> `bytes`
+ """
++ if isinstance(s, binary_type):
++ return s
+ if isinstance(s, text_type):
+ return s.encode(encoding, errors)
+- elif isinstance(s, binary_type):
+- return s
+- else:
+- raise TypeError("not expecting type '%s'" % type(s))
++ raise TypeError("not expecting type '%s'" % type(s))
+
+
+ def ensure_str(s, encoding='utf-8', errors='strict'):
+@@ -880,12 +924,15 @@ def ensure_str(s, encoding='utf-8', erro
+ - `str` -> `str`
+ - `bytes` -> decoded to `str`
+ """
+- if not isinstance(s, (text_type, binary_type)):
+- raise TypeError("not expecting type '%s'" % type(s))
++ # Optimization: Fast return for the common case.
++ if type(s) is str:
++ return s
+ if PY2 and isinstance(s, text_type):
+- s = s.encode(encoding, errors)
++ return s.encode(encoding, errors)
+ elif PY3 and isinstance(s, binary_type):
+- s = s.decode(encoding, errors)
++ return s.decode(encoding, errors)
++ elif not isinstance(s, (text_type, binary_type)):
++ raise TypeError("not expecting type '%s'" % type(s))
+ return s
+
+
+@@ -908,10 +955,9 @@ def ensure_text(s, encoding='utf-8', err
+ raise TypeError("not expecting type '%s'" % type(s))
+
+
+-
+ def python_2_unicode_compatible(klass):
+ """
+- A decorator that defines __unicode__ and __str__ methods under Python 2.
++ A class decorator that defines __unicode__ and __str__ methods under Python 2.
+ Under Python 3 it does nothing.
+
+ To support Python 2 and 3 with a single code base, define a __str__ method
+diff -up chromium-103.0.5060.53/third_party/six/src/six.py.116 chromium-103.0.5060.53/third_party/six/src/six.py
+--- chromium-103.0.5060.53/third_party/six/src/six.py.116 2022-07-05 13:32:28.916687658 +0000
++++ chromium-103.0.5060.53/third_party/six/src/six.py 2022-07-05 21:59:42.561240407 +0000
+@@ -29,7 +29,7 @@ import sys
+ import types
+
+ __author__ = "Benjamin Peterson <benjamin(a)python.org>"
+-__version__ = "1.14.0"
++__version__ = "1.16.0"
+
+
+ # Useful for very coarse version differentiation.
+@@ -71,6 +71,11 @@ else:
+ MAXSIZE = int((1 << 63) - 1)
+ del X
+
++if PY34:
++ from importlib.util import spec_from_loader
++else:
++ spec_from_loader = None
++
+
+ def _add_doc(func, doc):
+ """Add documentation to a function."""
+@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
+ return self
+ return None
+
++ def find_spec(self, fullname, path, target=None):
++ if fullname in self.known_modules:
++ return spec_from_loader(fullname, self)
++ return None
++
+ def __get_module(self, fullname):
+ try:
+ return self.known_modules[fullname]
+@@ -223,6 +233,12 @@ class _SixMetaPathImporter(object):
+ return None
+ get_source = get_code # same as get_code
+
++ def create_module(self, spec):
++ return self.load_module(spec.name)
++
++ def exec_module(self, module):
++ pass
++
+ _importer = _SixMetaPathImporter(__name__)
+
+
+@@ -890,12 +906,11 @@ def ensure_binary(s, encoding='utf-8', e
+ - `str` -> encoded to `bytes`
+ - `bytes` -> `bytes`
+ """
++ if isinstance(s, binary_type):
++ return s
+ if isinstance(s, text_type):
+ return s.encode(encoding, errors)
+- elif isinstance(s, binary_type):
+- return s
+- else:
+- raise TypeError("not expecting type '%s'" % type(s))
++ raise TypeError("not expecting type '%s'" % type(s))
+
+
+ def ensure_str(s, encoding='utf-8', errors='strict'):
+@@ -909,12 +924,15 @@ def ensure_str(s, encoding='utf-8', erro
+ - `str` -> `str`
+ - `bytes` -> decoded to `str`
+ """
+- if not isinstance(s, (text_type, binary_type)):
+- raise TypeError("not expecting type '%s'" % type(s))
++ # Optimization: Fast return for the common case.
++ if type(s) is str:
++ return s
+ if PY2 and isinstance(s, text_type):
+- s = s.encode(encoding, errors)
++ return s.encode(encoding, errors)
+ elif PY3 and isinstance(s, binary_type):
+- s = s.decode(encoding, errors)
++ return s.decode(encoding, errors)
++ elif not isinstance(s, (text_type, binary_type)):
++ raise TypeError("not expecting type '%s'" % type(s))
+ return s
+
+
diff --git a/chromium-update-rjsmin-to-1.2.0.patch b/chromium-update-rjsmin-to-1.2.0.patch
new file mode 100644
index 0000000..29a5d9c
--- /dev/null
+++ b/chromium-update-rjsmin-to-1.2.0.patch
@@ -0,0 +1,1700 @@
+diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c
+--- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c.12 2022-06-28 12:50:10.167324583 +0000
++++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c 2021-11-14 19:50:55.000000000 +0000
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright 2011 - 2015
++ * Copyright 2011 - 2021
+ * Andr\xe9 Malo or his licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+@@ -18,21 +18,21 @@
+ #include "cext.h"
+ EXT_INIT_FUNC;
+
+-#define RJSMIN_DULL_BIT (1 << 0)
+-#define RJSMIN_PRE_REGEX_BIT (1 << 1)
+-#define RJSMIN_REGEX_DULL_BIT (1 << 2)
+-#define RJSMIN_REGEX_CC_DULL_BIT (1 << 3)
+-#define RJSMIN_ID_LIT_BIT (1 << 4)
+-#define RJSMIN_ID_LIT_O_BIT (1 << 5)
+-#define RJSMIN_ID_LIT_C_BIT (1 << 6)
+-#define RJSMIN_STRING_DULL_BIT (1 << 7)
+-#define RJSMIN_SPACE_BIT (1 << 8)
+-#define RJSMIN_POST_REGEX_OFF_BIT (1 << 9)
++#define RJSMIN_DULL_BIT (1 << 0)
++#define RJSMIN_PRE_REGEX_BIT (1 << 1)
++#define RJSMIN_REGEX_DULL_BIT (1 << 2)
++#define RJSMIN_REGEX_CC_DULL_BIT (1 << 3)
++#define RJSMIN_ID_LIT_BIT (1 << 4)
++#define RJSMIN_ID_LIT_O_BIT (1 << 5)
++#define RJSMIN_ID_LIT_C_BIT (1 << 6)
++#define RJSMIN_STRING_DULL_BIT (1 << 7)
++#define RJSMIN_SPACE_BIT (1 << 8)
++#define RJSMIN_POST_REGEX_OFF_BIT (1 << 9)
++#define RJSMIN_A_Z_BIT (1 << 10)
+
+-#ifdef EXT3
+-typedef Py_UNICODE rchar;
+-#else
+ typedef unsigned char rchar;
++#ifdef U
++#undef U
+ #endif
+ #define U(c) ((rchar)(c))
+
+@@ -66,66 +66,120 @@ typedef unsigned char rchar;
+ #define RJSMIN_IS_PRE_REGEX_1(c) ((U(c) <= 127) && \
+ (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_PRE_REGEX_BIT))
+
++#define RJSMIN_IS_A_Z(c) ((U(c) <= 127) && \
++ (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_A_Z_BIT))
++
+
+ static const unsigned short rjsmin_charmask[128] = {
+- 396, 396, 396, 396, 396, 396, 396, 396,
+- 396, 396, 2, 396, 396, 2, 396, 396,
+- 396, 396, 396, 396, 396, 396, 396, 396,
+- 396, 396, 396, 396, 396, 396, 396, 396,
+- 396, 687, 588, 653, 765, 653, 143, 588,
+- 687, 205, 653, 237, 143, 237, 141, 648,
+- 765, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 143, 143, 653, 143, 653, 143,
+- 653, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 683, 513, 197, 653, 765,
+- 653, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 765, 765, 765, 765, 765,
+- 765, 765, 765, 687, 143, 207, 653, 765
++ 396, 396, 396, 396, 396, 396, 396, 396,
++ 396, 396, 2, 396, 396, 2, 396, 396,
++ 396, 396, 396, 396, 396, 396, 396, 396,
++ 396, 396, 396, 396, 396, 396, 396, 396,
++ 396, 687, 588, 653, 765, 653, 143, 588,
++ 687, 205, 655, 239, 143, 239, 141, 648,
++ 765, 765, 765, 765, 765, 765, 765, 765,
++ 765, 765, 143, 143, 653, 143, 653, 143,
++ 653, 765, 765, 765, 765, 765, 765, 765,
++ 765, 765, 765, 765, 765, 765, 765, 765,
++ 765, 765, 765, 765, 765, 765, 765, 765,
++ 765, 765, 765, 683, 513, 197, 653, 765,
++ 588, 1789, 1789, 1789, 1789, 1789, 1789, 1789,
++ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789,
++ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789,
++ 1789, 1789, 1789, 687, 143, 207, 653, 765
+ };
+
++
+ static Py_ssize_t
+ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
+ int keep_bang_comments)
+ {
+- const rchar *reset, *pcreset = NULL, *pctoken = NULL, *xtarget,
+- *sentinel = source + length;
+- rchar *tstart = target;
+- int post_regex = 0;
+- rchar c, quote, spaced = U(' ');
++ const rchar
++ *sentinel = source + length, /* never hit this pointer (source buf) */
++ *reset, /* reset pointer (source buf) */
++ *pcreset = NULL, /* pre-comment reset pointer (source buf) */
++ *pctoken = NULL, /* pre-comment token pointer (target buf)
++ * Pointing to before the last kept comment, if any */
++ *rsreset = NULL, /* regex-with-method reset pointer (source buf) */
++ *xtarget; /* pre-regex-2 target pointer */
++
++ rchar *tstart = target, /* Target start pointer for reference */
++ *rtreset = NULL; /* regex-with-method reset pointer (target buf) */
++
++ int rsdot, /* seen dot after regex-with-method pattern? */
++ post_regex = 0;
++ rchar c, quote,
++ spaced = U(' '); /* the last seen kind of space (nl taking prio),
++ * init with ' ' */
+
++ /* main loop */
+ while (source < sentinel) {
+ c = *source++;
++
+ if (RJSMIN_IS_DULL(c)) {
+ if (post_regex) post_regex = 0;
+ if (pctoken) pctoken = NULL;
+ if (spaced == U('\n')) spaced = U(' ');
++ if (rsreset) {
++ /* both a-z and . are covered by "dull" */
++ if (!rsdot) {
++ if (c != U('.')) {
++ /* reset regex-with-method to the starting slash */
++ source = rsreset;
++ target = rtreset;
++ rsreset = NULL;
++ continue; /* main loop */
++ }
++ /* Found a dot after possible regex, looking for a-z now */
++ rsdot = 1;
++ }
++ else if (!RJSMIN_IS_A_Z(c)) {
++ /* reset regex-with-method to the starting slash */
++ source = rsreset;
++ target = rtreset;
++ rsreset = NULL;
++ continue; /* main loop */
++ }
++ else {
++ /* Successfull finish the regex-with-method match */
++ rsreset = NULL;
++ }
++ }
+
+ *target++ = c;
+- continue;
++ continue; /* main loop */
+ }
++
+ switch (c) {
+
+ /* String */
+- case U('\''): case U('"'):
++ case U('\''): case U('"'): case U('`'):
+ if (post_regex) post_regex = 0;
+ if (pctoken) pctoken = NULL;
+ if (spaced == U('\n')) spaced = U(' ');
++ if (rsreset) {
++ /* reset regex-with-method to the starting slash */
++ source = rsreset;
++ target = rtreset;
++ rsreset = NULL;
++ continue; /* main loop */
++ }
+
+ reset = source;
+ *target++ = quote = c;
++
++ /* string loop */
+ while (source < sentinel) {
+ c = *source++;
+ *target++ = c;
+ if (RJSMIN_IS_STRING_DULL(c))
+- continue;
++ continue; /* string loop */
++
+ switch (c) {
+- case U('\''): case U('"'):
++ case U('\''): case U('"'): case U('`'):
+ if (c == quote)
+- goto cont;
+- continue;
++ goto cont; /* main loop */
++ continue; /* string loop */
+ case U('\\'):
+ if (source < sentinel) {
+ c = *source++;
+@@ -134,13 +188,18 @@ rjsmin(const rchar *source, rchar *targe
+ && *source == U('\n'))
+ *target++ = *source++;
+ }
+- continue;
++ continue; /* string loop */
++ case U('\r'): case U('\n'):
++ if (quote != U('`'))
++ break; /* string reset */
++ continue; /* string loop */
+ }
+- break;
++ break; /* string reset */
+ }
++ /* string reset */
+ target -= source - reset;
+ source = reset;
+- continue;
++ continue; /* main loop */
+
+ /* Comment or Regex or something else entirely */
+ case U('/'):
+@@ -148,6 +207,13 @@ rjsmin(const rchar *source, rchar *targe
+ if (post_regex) post_regex = 0;
+ if (pctoken) pctoken = NULL;
+ if (spaced == U('\n')) spaced = U(' ');
++ if (rsreset) {
++ /* reset regex-with-method to the starting slash */
++ source = rsreset;
++ target = rtreset;
++ rsreset = NULL;
++ continue; /* main loop */
++ }
+
+ *target++ = c;
+ }
+@@ -157,7 +223,19 @@ rjsmin(const rchar *source, rchar *targe
+ case U('*'): case U('/'):
+ goto skip_or_copy_ws;
+
++ /* Regex or slash */
+ default:
++ if (rsreset) {
++ /* reset regex-with-method to the starting slash */
++ if (post_regex) post_regex = 0;
++ if (pctoken) pctoken = NULL;
++ if (spaced == U('\n')) spaced = U(' ');
++ source = rsreset;
++ target = rtreset;
++ rsreset = NULL;
++ continue; /* main loop */
++ }
++
+ xtarget = NULL;
+ if ( target == tstart
+ || RJSMIN_IS_PRE_REGEX_1(*((pctoken ? pctoken : target)
+@@ -176,99 +254,148 @@ rjsmin(const rchar *source, rchar *targe
+ || !RJSMIN_IS_ID_LITERAL(*(xtarget - 7))
+ )
+ )) {
+-
+- /* Regex */
++ /* nothing to do here, continuing down below
++ * We could unset rsreset here, but we know it already
++ * is. */
++ ;
++ }
++ else if (*((pctoken ? pctoken : target) - 1) == U(')')) {
++ xtarget = NULL;
++ rsreset = source;
++ rtreset = target + 1;
++ rsdot = 0;
++ }
++ else {
++ /* Just a slash */
+ if (post_regex) post_regex = 0;
+ if (pctoken) pctoken = NULL;
++ if (spaced == U('\n')) spaced = U(' ');
+
+- reset = source;
+- if (spaced == U('\n')) {
+- spaced = U(' ');
+- if (xtarget)
+- *target++ = U('\n');
+- }
++ *target++ = c;
++ continue; /* main loop */
++ }
+
+- *target++ = U('/');
+- while (source < sentinel) {
+- c = *source++;
+- *target++ = c;
+- if (RJSMIN_IS_REGEX_DULL(c))
+- continue;
+- switch (c) {
+- case U('/'):
+- post_regex = 1;
+- goto cont;
+- case U('\\'):
+- if (source < sentinel) {
+- c = *source++;
+- *target++ = c;
+- if (c == U('\r') || c == U('\n'))
+- break;
+- }
+- continue;
+- case U('['):
+- while (source < sentinel) {
+- c = *source++;
+- *target++ = c;
+- if (RJSMIN_IS_REGEX_CC_DULL(c))
+- continue;
+- switch (c) {
+- case U('\\'):
+- if (source < sentinel) {
+- c = *source++;
+- *target++ = c;
+- if (c == U('\r') || c == U('\n'))
+- break;
+- }
+- continue;
+- case U(']'):
+- goto cont_regex;
++ if (post_regex) post_regex = 0;
++ if (pctoken) pctoken = NULL;
++
++ reset = source;
++ if (spaced == U('\n')) {
++ spaced = U(' ');
++ if (xtarget)
++ *target++ = U('\n');
++ }
++
++ *target++ = U('/');
++
++ /* regex loop */
++ while (source < sentinel) {
++ c = *source++;
++ *target++ = c;
++
++ if (RJSMIN_IS_REGEX_DULL(c))
++ continue; /* regex loop */
++
++ switch (c) {
++ case U('/'):
++ while (source < sentinel
++ && RJSMIN_IS_A_Z(*source))
++ *target++ = *source++;
++ post_regex = !rsreset;
++ /* This check is supposed to make it faster.
++ * It doesn't. It slows it down. I wonder why...
++ */
++ /*
++ * if (!post_regex
++ * && source < sentinel - 1
++ * && *source == U('.')
++ * && RJSMIN_IS_A_Z(*(source + 1)))
++ * rsreset = NULL;
++ */
++
++ goto cont; /* main loop */
++
++ case U('\\'):
++ if (source < sentinel) {
++ c = *source++;
++ *target++ = c;
++ if (c == U('\r') || c == U('\n'))
++ break; /* regex reset */
++ }
++ continue; /* regex loop */
++
++ case U('['):
++ /* regex CC loop */
++ while (source < sentinel) {
++ c = *source++;
++ *target++ = c;
++
++ if (RJSMIN_IS_REGEX_CC_DULL(c))
++ continue; /* regex CC loop */
++
++ switch (c) {
++ case U('\\'):
++ if (source < sentinel) {
++ c = *source++;
++ *target++ = c;
++ if (c == U('\r') || c == U('\n'))
++ break; /* regex reset */
+ }
++ continue; /* regex CC loop */
++
++ case U(']'):
++ goto cont_regex; /* regex loop */
+ }
+- break;
+ }
+- break;
+- cont_regex:
+- continue;
++ break; /* regex reset */
++
+ }
+- target -= source - reset;
+- source = reset;
+- }
+- else {
+- /* Just a slash */
+- if (post_regex) post_regex = 0;
+- if (pctoken) pctoken = NULL;
+- if (spaced == U('\n')) spaced = U(' ');
++ break; /* regex reset */
+
+- *target++ = c;
++ cont_regex:
++ continue; /* regex loop */
+ }
+- continue;
++
++ /* regex reset */
++ target -= source - reset;
++ source = reset;
++ rsreset = NULL;
++ continue; /* main loop */
+ }
+ }
+- continue;
++ continue; /* main loop */ /* LCOV_EXCL_LINE */
+
+ /* Whitespace */
+ default:
+ skip_or_copy_ws:
++ /* remember if we've seen a newline, start with: no */
+ quote = U(' ');
+ --source;
++
++ /* space loop */
+ while (source < sentinel) {
+ c = *source++;
+ if (RJSMIN_IS_SPACE(c))
+- continue;
++ continue; /* space loop */
++
+ switch (c) {
+ case U('\r'): case U('\n'):
+ quote = U('\n');
+- continue;
++ continue; /* space loop */
++
++ /* Can only be a comment at this point
++ * (or ending prematurely) */
+ case U('/'):
+ if (source < sentinel) {
+ switch (*source) {
++
++ /* multiline comment */
+ case U('*'):
+ reset = source++;
+ /* copy bang comment, if requested */
+ if ( keep_bang_comments && source < sentinel
+ && *source == U('!')) {
+ if (!pctoken) {
++ /* Backtracking if ending prematurely */
+ pctoken = target;
+ pcreset = reset;
+ }
+@@ -276,6 +403,8 @@ rjsmin(const rchar *source, rchar *targe
+ *target++ = U('/');
+ *target++ = U('*');
+ *target++ = *source++;
++
++ /* comment loop */
+ while (source < sentinel) {
+ c = *source++;
+ *target++ = c;
+@@ -283,20 +412,21 @@ rjsmin(const rchar *source, rchar *targe
+ && *source == U('/')) {
+ *target++ = *source++;
+ reset = NULL;
+- break;
++ break; /* continue space loop */
+ }
+ }
+ if (!reset)
+- continue;
++ continue; /* space loop */
+
++ /* comment reset */
+ target -= source - reset;
+ source = reset;
+ if (pcreset == reset) {
+ pctoken = NULL;
+ pcreset = NULL;
+ }
+-
+ }
++
+ /* strip regular comment */
+ else {
+ while (source < sentinel) {
+@@ -305,41 +435,52 @@ rjsmin(const rchar *source, rchar *targe
+ && *source == U('/')) {
+ ++source;
+ reset = NULL;
+- break;
++ break; /* continue space loop */
+ }
+ }
+ if (!reset)
+- continue;
++ continue; /* space loop */
++
++ /* comment reset: fallback to slash */
+ source = reset;
+ *target++ = U('/');
+ }
+- goto cont;
++ goto cont; /* main loop */
++
++ /* single line comment */
+ case U('/'):
+ ++source;
++
++ /* single line comment loop */
+ while (source < sentinel) {
+ c = *source++;
+ switch (c) {
+ case U('\n'):
+- break;
++ break; /* continue space loop */
++
+ case U('\r'):
+ if (source < sentinel
+ && *source == U('\n'))
+ ++source;
+- break;
++ break; /* continue space loop */
++
+ default:
+- continue;
++ continue; /* single line comment loop */
+ }
+- break;
++ break; /* continue space loop */
+ }
+ quote = U('\n');
+- continue;
++ continue; /* space loop */
+ }
+ }
+ }
++
++ /* No more spacy character found */
+ --source;
+- break;
++ break; /* end space loop */
+ }
+
++ /* Copy a space if needed */
+ if ((tstart < (pctoken ? pctoken : target) && source < sentinel)
+ && ((quote == U('\n')
+ && ((RJSMIN_IS_ID_LITERAL_CLOSE(*((pctoken ?
+@@ -363,8 +504,9 @@ rjsmin(const rchar *source, rchar *targe
+ pcreset = NULL;
+ spaced = quote;
+ }
++
+ cont:
+- continue;
++ continue; /* main loop */
+ }
+ return (Py_ssize_t)(target - tstart);
+ }
+@@ -385,15 +527,15 @@ substitution regex.\n\
+ :Note: This is a hand crafted C implementation built on the regex\n\
+ semantics.\n\
+ \n\
+-:Parameters:\n\
+- `script` : ``str``\n\
++Parameters:\n\
++ script (str):\n\
+ Script to minify\n\
+ \n\
+- `keep_bang_comments` : ``bool``\n\
++ keep_bang_comments (bool):\n\
+ Keep comments starting with an exclamation mark? (``/*!...*/``)\n\
+ \n\
+-:Return: Minified script\n\
+-:Rtype: ``str``");
++Returns:\n\
++ str: Minified script");
+
+ static PyObject *
+ rjsmin_jsmin(PyObject *self, PyObject *args, PyObject *kwds)
+@@ -404,15 +546,15 @@ rjsmin_jsmin(PyObject *self, PyObject *a
+ int keep_bang_comments;
+ #ifdef EXT2
+ int uni;
+-#define UOBJ "O"
+ #endif
+ #ifdef EXT3
+-#define UOBJ "U"
++ int bytes;
++ rchar *bytescript;
+ #endif
+
+- if (!PyArg_ParseTupleAndKeywords(args, kwds, UOBJ "|O", kwlist,
++ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O", kwlist,
+ &script, &keep_bang_comments_))
+- return NULL;
++ LCOV_EXCL_LINE_RETURN(NULL);
+
+ if (!keep_bang_comments_)
+ keep_bang_comments = 0;
+@@ -425,28 +567,27 @@ rjsmin_jsmin(PyObject *self, PyObject *a
+ #ifdef EXT2
+ if (PyUnicode_Check(script)) {
+ if (!(script = PyUnicode_AsUTF8String(script)))
+- return NULL;
++ LCOV_EXCL_LINE_RETURN(NULL);
+ uni = 1;
+ }
++ else if (!PyString_Check(script)) {
++ PyErr_SetString(PyExc_TypeError, "Unexpected type");
++ return NULL;
++ }
+ else {
+ if (!(script = PyObject_Str(script)))
+- return NULL;
++ LCOV_EXCL_LINE_RETURN(NULL);
+ uni = 0;
+ }
+-#endif
+-
+-#ifdef EXT3
+- Py_INCREF(script);
+-#define PyString_GET_SIZE PyUnicode_GET_SIZE
+-#define PyString_AS_STRING PyUnicode_AS_UNICODE
+-#define _PyString_Resize PyUnicode_Resize
+-#define PyString_FromStringAndSize PyUnicode_FromUnicode
+-#endif
+-
+ slength = PyString_GET_SIZE(script);
++
+ if (!(result = PyString_FromStringAndSize(NULL, slength))) {
++ LCOV_EXCL_START
++
+ Py_DECREF(script);
+ return NULL;
++
++ LCOV_EXCL_STOP
+ }
+ Py_BEGIN_ALLOW_THREADS
+ length = rjsmin((rchar *)PyString_AS_STRING(script),
+@@ -456,30 +597,97 @@ rjsmin_jsmin(PyObject *self, PyObject *a
+
+ Py_DECREF(script);
+ if (length < 0) {
++ LCOV_EXCL_START
++
+ Py_DECREF(result);
+ return NULL;
++
++ LCOV_EXCL_STOP
+ }
+ if (length != slength && _PyString_Resize(&result, length) == -1)
+- return NULL;
++ LCOV_EXCL_LINE_RETURN(NULL);
+
+-#ifdef EXT2
+ if (uni) {
+ script = PyUnicode_DecodeUTF8(PyString_AS_STRING(result),
+ PyString_GET_SIZE(result), "strict");
+ Py_DECREF(result);
+- if (!script)
+- return NULL;
+- result = script;
++ return script;
+ }
+-#endif
++
+ return result;
++
++#else /* EXT3 */
++
++ if (PyUnicode_Check(script)) {
++ bytes = 0;
++ script = PyUnicode_AsUTF8String(script);
++ bytescript = (rchar *)PyBytes_AS_STRING(script);
++ slength = PyBytes_GET_SIZE(script);
++ }
++ else if (PyBytes_Check(script)) {
++ bytes = 1;
++ Py_INCREF(script);
++ bytescript = (rchar *)PyBytes_AS_STRING(script);
++ slength = PyBytes_GET_SIZE(script);
++ }
++ else if (PyByteArray_Check(script)) {
++ bytes = 2;
++ Py_INCREF(script);
++ bytescript = (rchar *)PyByteArray_AS_STRING(script);
++ slength = PyByteArray_GET_SIZE(script);
++ }
++ else {
++ PyErr_SetString(PyExc_TypeError, "Unexpected type");
++ return NULL;
++ }
++
++ if (!(result = PyBytes_FromStringAndSize(NULL, slength))) {
++ LCOV_EXCL_START
++
++ Py_DECREF(script);
++ return NULL;
++
++ LCOV_EXCL_STOP
++ }
++ Py_BEGIN_ALLOW_THREADS
++ length = rjsmin(bytescript, (rchar *)PyBytes_AS_STRING(result),
++ slength, keep_bang_comments);
++ Py_END_ALLOW_THREADS
++
++ Py_DECREF(script);
++ if (length < 0) {
++ LCOV_EXCL_START
++
++ Py_DECREF(result);
++ return NULL;
++
++ LCOV_EXCL_STOP
++ }
++
++ if (!bytes) {
++ script = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(result), length,
++ "strict");
++ Py_DECREF(result);
++ return script;
++ }
++ if (bytes == 1) {
++ if (length != slength) {
++ _PyBytes_Resize(&result, length);
++ }
++ return result;
++ }
++ /* bytes == 2: bytearray */
++ script = PyByteArray_FromStringAndSize(PyBytes_AS_STRING(result), length);
++ Py_DECREF(result);
++ return script;
++#endif
+ }
+
+ /* ------------------------ BEGIN MODULE DEFINITION ------------------------ */
+
+ EXT_METHODS = {
+ {"jsmin",
+- (PyCFunction)rjsmin_jsmin, METH_VARARGS | METH_KEYWORDS,
++ EXT_CFUNC(rjsmin_jsmin), METH_VARARGS | METH_KEYWORDS,
+ rjsmin_jsmin__doc__},
+
+ {NULL} /* Sentinel */
+@@ -499,10 +707,10 @@ EXT_INIT_FUNC {
+
+ /* Create the module and populate stuff */
+ if (!(m = EXT_CREATE(&EXT_DEFINE_VAR)))
+- EXT_INIT_ERROR(NULL);
++ EXT_INIT_ERROR(LCOV_EXCL_LINE(NULL));
+
+ EXT_ADD_UNICODE(m, "__author__", "Andr\xe9 Malo", "latin-1");
+- EXT_ADD_STRING(m, "__docformat__", "restructuredtext en");
++ EXT_ADD_STRING(m, "__version__", STRINGIFY(EXT_VERSION));
+
+ EXT_INIT_RETURN(m);
+ }
+diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py
+--- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py.12 2022-07-01 20:33:39.317727375 +0000
++++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py 2021-11-14 20:24:16.000000000 +0000
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env python
+ # -*- coding: ascii -*-
+-r"""
++u"""
+ =====================
+ Javascript Minifier
+ =====================
+@@ -11,7 +11,7 @@ The minifier is based on the semantics o
+
+ :Copyright:
+
+- Copyright 2011 - 2015
++ Copyright 2011 - 2021
+ Andr\xe9 Malo or his licensors, as applicable
+
+ :License:
+@@ -39,9 +39,11 @@ same results as the original ``jsmin.c``
+ - Newline characters are not allowed inside string and regex literals, except
+ for line continuations in string literals (ECMA-5).
+ - "return /regex/" is recognized correctly.
++- More characters are allowed before regexes.
+ - Line terminators after regex literals are handled more sensibly
+ - "+ +" and "- -" sequences are not collapsed to '++' or '--'
+ - Newlines before ! operators are removed more sensibly
++- (Unnested) template literals are supported (ECMA-6)
+ - Comments starting with an exclamation mark (``!``) can be kept optionally
+ - rJSmin does not handle streams, but only complete strings. (However, the
+ module provides a "streamy" interface).
+@@ -56,20 +58,17 @@ file for details.
+
+ rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
+
+-Both python 2 and python 3 are supported.
++Supported python versions are 2.7 and 3.6+.
+
+ .. _jsmin.c by Douglas Crockford:
+ http://www.crockford.com/javascript/jsmin.c
+ """
+-if __doc__:
+- # pylint: disable = redefined-builtin
+- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
+-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
+-__docformat__ = "restructuredtext en"
++__author__ = u"Andr\xe9 Malo"
+ __license__ = "Apache License, Version 2.0"
+-__version__ = '1.0.12'
++__version__ = '1.2.0'
+ __all__ = ['jsmin']
+
++import functools as _ft
+ import re as _re
+
+
+@@ -80,13 +79,13 @@ def _make_jsmin(python_only=False):
+ .. _jsmin.c by Douglas Crockford:
+ http://www.crockford.com/javascript/jsmin.c
+
+- :Parameters:
+- `python_only` : ``bool``
++ Parameters:
++ python_only (bool):
+ Use only the python variant. If true, the c extension is not even
+ tried to be loaded.
+
+- :Return: Minifier
+- :Rtype: ``callable``
++ Returns:
++ callable: Minifier
+ """
+ # pylint: disable = unused-variable
+ # pylint: disable = too-many-locals
+@@ -97,7 +96,10 @@ def _make_jsmin(python_only=False):
+ except ImportError:
+ pass
+ else:
+- return _rjsmin.jsmin
++ # Ensure that the C version is in sync
++ # https://github.com/ndparker/rjsmin/issues/11
++ if getattr(_rjsmin, '__version__', None) == __version__:
++ return _rjsmin.jsmin
+ try:
+ xrange
+ except NameError:
+@@ -110,15 +112,16 @@ def _make_jsmin(python_only=False):
+ space_comment_nobang = r'(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)'
+ bang_comment = r'(?:/\*![^*]*\*+(?:[^/*][^*]*\*+)*/)'
+
+- string1 = \
+- r'(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)'
++ string1 = r"(?:'[^'\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^'\\\r\n]*)*')"
++ string1 = string1.replace("'", r'\047') # portability
+ string2 = r'(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^"\\\r\n]*)*")'
+- string3 = r'(?:`(?:[^`\\]|\\.)*`)'
++ string3 = r'(?:`[^`\\]*(?:\\(?:[^\r\n]|\r?\n|\r)[^`\\]*)*`)'
++ string3 = string3.replace('`', r'\140') # portability
+ strings = r'(?:%s|%s|%s)' % (string1, string2, string3)
+
+ charclass = r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])'
+ nospecial = r'[^/\\\[\r\n]'
+- regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)' % (
++ regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/[a-z]*)' % (
+ nospecial, charclass, nospecial
+ )
+ space = r'(?:%s|%s)' % (space_chars, space_comment)
+@@ -154,7 +157,7 @@ def _make_jsmin(python_only=False):
+ ) for first, last in result]) # noqa
+
+ return _re.sub(
+- r'([\000-\040\047])', # \047 for better portability
++ r"([\000-\040'`])", # ' and ` for better portability
+ lambda m: '\\%03o' % ord(m.group(1)), (
+ sequentize(result)
+ .replace('\\', '\\\\')
+@@ -180,42 +183,48 @@ def _make_jsmin(python_only=False):
+ return r'[%s]' % fix_charclass(result)
+
+ not_id_literal = not_id_literal_(r'[a-zA-Z0-9_$]')
+- preregex1 = r'[(,=:\[!&|?{};\r\n]'
++ preregex1 = r'[(,=:\[!&|?{};\r\n+*-]'
+ preregex2 = r'%(not_id_literal)sreturn' % locals()
+
+ id_literal = id_literal_(r'[a-zA-Z0-9_$]')
+ id_literal_open = id_literal_(r'[a-zA-Z0-9_${\[(!+-]')
+- id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047+-]')
++ id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047\140+-]')
+ post_regex_off = id_literal_(r'[^\000-\040}\])?:|,;.&=+-]')
+
+- dull = r'[^\047"`/\000-\040]'
++ dull = r'[^\047"\140/\000-\040]'
+
+ space_sub_simple = _re.compile((
+- # noqa pylint: disable = bad-continuation
++ # noqa pylint: disable = bad-option-value, bad-continuation
+
+ r'(%(dull)s+)' # 0
+ r'|(%(strings)s%(dull)s*)' # 1
+- r'|(?<=%(preregex1)s)'
++ r'|(?<=[)])'
+ r'%(space)s*(?:%(newline)s%(space)s*)*'
+ r'(%(regex)s)' # 2
+- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 3
++ r'(?=%(space)s*(?:%(newline)s%(space)s*)*'
++ r'\.'
++ r'%(space)s*(?:%(newline)s%(space)s*)*[a-z])'
++ r'|(?<=%(preregex1)s)'
++ r'%(space)s*(?:%(newline)s%(space)s*)*'
++ r'(%(regex)s)' # 3
++ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4
+ r'(?=%(post_regex_off)s))?'
+ r'|(?<=%(preregex2)s)'
+- r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 4
+- r'(%(regex)s)' # 5
+- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6
++ r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 5
++ r'(%(regex)s)' # 6
++ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 7
+ r'(?=%(post_regex_off)s))?'
+ r'|(?<=%(id_literal_close)s)'
+- r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 7
++ r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 8
+ r'(?=%(id_literal_open)s)'
+- r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 8
+- r'|(?<=\+)(%(space)s)+(?=\+)' # 9
+- r'|(?<=-)(%(space)s)+(?=-)' # 10
++ r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 9
++ r'|(?<=\+)(%(space)s)+(?=\+)' # 10
++ r'|(?<=-)(%(space)s)+(?=-)' # 11
+ r'|%(space)s+'
+ r'|(?:%(newline)s%(space)s*)+'
+ ) % locals()).sub
+
+- # print space_sub_simple.__self__.pattern
++ # print(space_sub_simple.__self__.pattern)
+
+ def space_subber_simple(match):
+ """ Substitution callback """
+@@ -227,48 +236,56 @@ def _make_jsmin(python_only=False):
+ elif groups[1]:
+ return groups[1]
+ elif groups[2]:
+- if groups[3]:
+- return groups[2] + '\n'
+ return groups[2]
+- elif groups[5]:
++ elif groups[3]:
++ if groups[4]:
++ return groups[3] + '\n'
++ return groups[3]
++ elif groups[6]:
+ return "%s%s%s" % (
+- groups[4] and '\n' or '',
+- groups[5],
+- groups[6] and '\n' or '',
++ groups[5] and '\n' or '',
++ groups[6],
++ groups[7] and '\n' or '',
+ )
+- elif groups[7]:
++ elif groups[8]:
+ return '\n'
+- elif groups[8] or groups[9] or groups[10]:
++ elif groups[9] or groups[10] or groups[11]:
+ return ' '
+ else:
+ return ''
+
+ space_sub_banged = _re.compile((
+- # noqa pylint: disable = bad-continuation
++ # noqa pylint: disable = bad-option-value, bad-continuation
+
+ r'(%(dull)s+)' # 0
+ r'|(%(strings)s%(dull)s*)' # 1
+- r'|(?<=%(preregex1)s)'
++ r'|(?<=[)])'
+ r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 2
+ r'(%(regex)s)' # 3
+- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4
++ r'(?=%(space)s*(?:%(newline)s%(space)s*)*'
++ r'\.'
++ r'%(space)s*(?:%(newline)s%(space)s*)*[a-z])'
++ r'|(?<=%(preregex1)s)'
++ r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 4
++ r'(%(regex)s)' # 5
++ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6
+ r'(?=%(post_regex_off)s))?'
+ r'|(?<=%(preregex2)s)'
+- r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 5, 6
+- r'(%(regex)s)' # 7
+- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 8
++ r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 7, 8
++ r'(%(regex)s)' # 9
++ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 10
+ r'(?=%(post_regex_off)s))?'
+ r'|(?<=%(id_literal_close)s)'
+- r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 9
++ r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 11
+ r'(?=%(id_literal_open)s)'
+- r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 10
+- r'|(?<=\+)(%(space)s+)(?=\+)' # 11
+- r'|(?<=-)(%(space)s+)(?=-)' # 12
+- r'|(%(space)s+)' # 13
+- r'|((?:%(newline)s%(space)s*)+)' # 14
++ r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 12
++ r'|(?<=\+)(%(space)s+)(?=\+)' # 13
++ r'|(?<=-)(%(space)s+)(?=-)' # 14
++ r'|(%(space)s+)' # 15
++ r'|((?:%(newline)s%(space)s*)+)' # 16
+ ) % locals()).sub
+
+- # print space_sub_banged.__self__.pattern
++ # print(space_sub_banged.__self__.pattern)
+
+ keep = _re.compile((
+ r'%(space_chars)s+|%(space_comment_nobang)s+|%(newline)s+'
+@@ -276,7 +293,7 @@ def _make_jsmin(python_only=False):
+ ) % locals()).sub
+ keeper = lambda m: m.groups()[0] or ''
+
+- # print keep.__self__.pattern
++ # print(keep.__self__.pattern)
+
+ def space_subber_banged(match):
+ """ Substitution callback """
+@@ -288,26 +305,34 @@ def _make_jsmin(python_only=False):
+ elif groups[1]:
+ return groups[1]
+ elif groups[3]:
+- return "%s%s%s%s" % (
++ return "%s%s" % (
+ keep(keeper, groups[2]),
+ groups[3],
+- keep(keeper, groups[4] or ''),
+- groups[4] and '\n' or '',
+ )
+- elif groups[7]:
+- return "%s%s%s%s%s" % (
+- keep(keeper, groups[5]),
++ elif groups[5]:
++ return "%s%s%s%s" % (
++ keep(keeper, groups[4]),
++ groups[5],
++ keep(keeper, groups[6] or ''),
+ groups[6] and '\n' or '',
+- groups[7],
+- keep(keeper, groups[8] or ''),
+- groups[8] and '\n' or '',
+ )
+ elif groups[9]:
+- return keep(keeper, groups[9]) + '\n'
+- elif groups[10] or groups[11] or groups[12]:
+- return keep(keeper, groups[10] or groups[11] or groups[12]) or ' '
++ return "%s%s%s%s%s" % (
++ keep(keeper, groups[7]),
++ groups[8] and '\n' or '',
++ groups[9],
++ keep(keeper, groups[10] or ''),
++ groups[10] and '\n' or '',
++ )
++ elif groups[11]:
++ return keep(keeper, groups[11]) + '\n'
++ elif groups[12] or groups[13] or groups[14]:
++ return keep(keeper, groups[12] or groups[13] or groups[14]) or ' '
+ else:
+- return keep(keeper, groups[13] or groups[14])
++ return keep(keeper, groups[15] or groups[16])
++
++ banged = _ft.partial(space_sub_banged, space_subber_banged)
++ simple = _ft.partial(space_sub_simple, space_subber_simple)
+
+ def jsmin(script, keep_bang_comments=False):
+ r"""
+@@ -320,32 +345,51 @@ def _make_jsmin(python_only=False):
+ .. _jsmin.c by Douglas Crockford:
+ http://www.crockford.com/javascript/jsmin.c
+
+- :Parameters:
+- `script` : ``str``
++ Parameters:
++ script (str):
+ Script to minify
+
+- `keep_bang_comments` : ``bool``
++ keep_bang_comments (bool):
+ Keep comments starting with an exclamation mark? (``/*!...*/``)
+
+- :Return: Minified script
+- :Rtype: ``str``
++ Returns:
++ str: Minified script
+ """
+ # pylint: disable = redefined-outer-name
+
+- if keep_bang_comments:
+- return space_sub_banged(
+- space_subber_banged, '\n%s\n' % script
+- ).strip()
+- else:
+- return space_sub_simple(
+- space_subber_simple, '\n%s\n' % script
+- ).strip()
++ is_bytes, script = _as_str(script)
++ script = (banged if keep_bang_comments else simple)(
++ '\n%s\n' % script
++ ).strip()
++ if is_bytes:
++ script = script.encode('latin-1')
++ if is_bytes == 2:
++ script = bytearray(script)
++ return script
+
+ return jsmin
+
+ jsmin = _make_jsmin()
+
+
++def _as_str(script):
++ """ Make sure the script is a text string """
++ is_bytes = False
++ if str is bytes:
++ if not isinstance(script, basestring): # noqa pylint: disable = undefined-variable
++ raise TypeError("Unexpected type")
++ elif isinstance(script, bytes):
++ is_bytes = True
++ script = script.decode('latin-1')
++ elif isinstance(script, bytearray):
++ is_bytes = 2
++ script = script.decode('latin-1')
++ elif not isinstance(script, str):
++ raise TypeError("Unexpected type")
++
++ return is_bytes, script
++
++
+ def jsmin_for_posers(script, keep_bang_comments=False):
+ r"""
+ Minify javascript based on `jsmin.c by Douglas Crockford`_\.
+@@ -361,49 +405,61 @@ def jsmin_for_posers(script, keep_bang_c
+ utilizes the resulting regexes. It's here for fun and may
+ vanish any time. Use the `jsmin` function instead.
+
+- :Parameters:
+- `script` : ``str``
++ Parameters:
++ script (str):
+ Script to minify
+
+- `keep_bang_comments` : ``bool``
++ keep_bang_comments (bool):
+ Keep comments starting with an exclamation mark? (``/*!...*/``)
+
+- :Return: Minified script
+- :Rtype: ``str``
++ Returns:
++ str: Minified script
+ """
+ if not keep_bang_comments:
+ rex = (
+- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
+- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
+- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?'
+- r'{};\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*'
+- r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'
+- r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r'
+- r'\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r'
+- r'\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\014'
++ r'([^\047"\140/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^'
++ r'\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^'
++ r'\r\n]|\r?\n|\r)[^"\\\r\n]*)*")|(?:\140[^\140\\]*(?:\\(?:[^\r\n'
++ r']|\r?\n|\r)[^\140\\]*)*\140))[^\047"\140/\000-\040]*)|(?<=[)])'
++ r'(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+'
++ r')*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\0'
++ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/'
++ r'\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]'
++ r'\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))(?=(?:[\000-\011\013\014\0'
++ r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n'
++ r']*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^'
++ r'/*][^*]*\*+)*/))*)*\.(?:[\000-\011\013\014\016-\040]|(?:/\*[^*'
++ r']*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\00'
++ r'0-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)'
++ r'*[a-z])|(?<=[(,=:\[!&|?{};\r\n+*-])(?:[\000-\011\013\014\016-'
++ r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)'
++ r'?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*]'
++ r'[^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|'
++ r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*'
++ r'/[a-z]*))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/'
++ r'*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013'
++ r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000'
++ r'-\040&)+,.:;=?\]|}-]))?|(?<=[\000-#%-,./:-@\[-^\140{-~-]return'
++ r')(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*'
++ r'+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016'
++ r'-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])'
++ r'[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^'
++ r'\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))((?:[\000-\011\013\014'
+ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r'
+ r'\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:'
+- r'[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[\00'
+- r'0-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\016-\040]|(?'
+- r':/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]'
+- r'))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*'
+- r'\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\['
+- r'[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))(('
+- r'?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)'
+- r'*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\04'
+- r'0]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;'
+- r'=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])(?:[\000-\011\01'
+- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?:'
+- r'//[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]'
+- r'*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,./:-@\\-^'
+- r'`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\013\014\0'
+- r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./'
+- r':-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*['
+- r'^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013'
+- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:['
+- r'\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
+- r')+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]'
+- r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'
++ r'[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[^\0'
++ r'00-!#%&(*,./:-@\[\\^{|~])(?:[\000-\011\013\014\016-\040]|(?:/'
++ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))'
++ r'(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+'
++ r')*/))*)+(?=[^\000-\040"#%-\047)*,./:-@\\-^\140|-~])|(?<=[^\000'
++ r'-#%-,./:-@\[-^\140{-~-])((?:[\000-\011\013\014\016-\040]|(?:/'
++ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:-@\[-^\140{-'
++ r'~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:'
++ r'[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013\014\016-\0'
++ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\0'
++ r'13\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?:(?'
++ r'://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]'
++ r'*\*+(?:[^/*][^*]*\*+)*/))*)+'
+ )
+
+ def subber(match):
+@@ -412,59 +468,72 @@ def jsmin_for_posers(script, keep_bang_c
+ return (
+ groups[0] or
+ groups[1] or
+- (groups[3] and (groups[2] + '\n')) or
+ groups[2] or
+- (groups[5] and "%s%s%s" % (
+- groups[4] and '\n' or '',
+- groups[5],
+- groups[6] and '\n' or '',
++ (groups[4] and (groups[3] + '\n')) or
++ groups[3] or
++ (groups[6] and "%s%s%s" % (
++ groups[5] and '\n' or '',
++ groups[6],
++ groups[7] and '\n' or '',
+ )) or
+- (groups[7] and '\n') or
+- (groups[8] and ' ') or
++ (groups[8] and '\n') or
+ (groups[9] and ' ') or
+ (groups[10] and ' ') or
++ (groups[11] and ' ') or
+ ''
+ )
+ else:
+ rex = (
+- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
+- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
+- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?'
+- r'{};\r\n])((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/'
+- r'*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013'
+- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?!'
+- r'[\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^'
+- r'\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\01'
+- r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^'
++ r'([^\047"\140/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^'
++ r'\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^'
++ r'\r\n]|\r?\n|\r)[^"\\\r\n]*)*")|(?:\140[^\140\\]*(?:\\(?:[^\r\n'
++ r']|\r?\n|\r)[^\140\\]*)*\140))[^\047"\140/\000-\040]*)|(?<=[)])'
++ r'((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*'
++ r'+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-'
++ r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?![\r\n/*])'
++ r'[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^'
++ r'\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))(?=(?:[\000-\011\013\0'
++ r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^'
+ r'\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+('
+- r'?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=['
+- r'\000-#%-,./:-@\[-^`{-~-]return)((?:[\000-\011\013\014\016-\040'
+- r']|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?['
+- r'\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*]['
+- r'^*]*\*+)*/))*)*)((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|'
+- r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*'
+- r'/))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]'
+- r'*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\01'
+- r'6-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)'
+- r'+,.:;=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])((?:[\000-'
+- r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:'
+- r'(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/'
+- r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)(?=[^\000-\040"#%-\047)*,./'
+- r':-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\01'
+- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=[^\000'
+- r'-#%-,./:-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|'
+- r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=\+)|(?<=-)((?:[\000-\0'
+- r'11\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-'
+- r')|((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*'
+- r'\*+)*/))+)|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014'
+- r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)'
++ r'?:[^/*][^*]*\*+)*/))*)*\.(?:[\000-\011\013\014\016-\040]|(?:/'
++ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?'
++ r':[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*'
++ r'/))*)*[a-z])|(?<=[(,=:\[!&|?{};\r\n+*-])((?:[\000-\011\013\014'
++ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r'
++ r'\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:'
++ r'[^/*][^*]*\*+)*/))*)*)((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^'
++ r'\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r'
++ r'\n]*)*/[a-z]*))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+'
++ r'(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\01'
++ r'1\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=['
++ r'^\000-\040&)+,.:;=?\]|}-]))?|(?<=[\000-#%-,./:-@\[-^\140{-~-]r'
++ r'eturn)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*]['
++ r'^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\0'
++ r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?!['
++ r'\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^'
++ r'\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))((?:[\000-\011'
++ r'\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:('
++ r'?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*'
++ r']*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|'
++ r'(?<=[^\000-!#%&(*,./:-@\[\\^{|~])((?:[\000-\011\013\014\016-\0'
++ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?['
++ r'\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^'
++ r'*]*\*+)*/))*)+)(?=[^\000-\040"#%-\047)*,./:-@\\-^\140|-~])|(?<'
++ r'=[^\000-#%-,./:-@\[-^\140{-~-])((?:[\000-\011\013\014\016-\040'
++ r']|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=[^\000-#%-,./:-@\[-^'
++ r'\140{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*'
++ r'\*+(?:[^/*][^*]*\*+)*/))+)(?=\+)|(?<=-)((?:[\000-\011\013\014'
++ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-)|((?:[\00'
++ r'0-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)'
++ r'|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|'
++ r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)'
+ )
+
+- keep = _re.compile((
++ keep = _re.compile(
+ r'[\000-\011\013\014\016-\040]+|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*'
+ r'\*+)*/)+|(?:(?://[^\r\n]*)?[\r\n])+|((?:/\*![^*]*\*+(?:[^/*][^'
+ r'*]*\*+)*/)+)'
+- ) % locals()).sub
++ ).sub
+ keeper = lambda m: m.groups()[0] or ''
+
+ def subber(match):
+@@ -473,27 +542,37 @@ def jsmin_for_posers(script, keep_bang_c
+ return (
+ groups[0] or
+ groups[1] or
+- (groups[3] and "%s%s%s%s" % (
++ groups[3] and "%s%s" % (
+ keep(keeper, groups[2]),
+ groups[3],
+- keep(keeper, groups[4] or ''),
+- groups[4] and '\n' or '',
+- )) or
+- (groups[7] and "%s%s%s%s%s" % (
+- keep(keeper, groups[5]),
++ ) or
++ groups[5] and "%s%s%s%s" % (
++ keep(keeper, groups[4]),
++ groups[5],
++ keep(keeper, groups[6] or ''),
+ groups[6] and '\n' or '',
+- groups[7],
+- keep(keeper, groups[8] or ''),
++ ) or
++ groups[9] and "%s%s%s%s%s" % (
++ keep(keeper, groups[7]),
+ groups[8] and '\n' or '',
+- )) or
+- (groups[9] and keep(keeper, groups[9] + '\n')) or
+- (groups[10] and keep(keeper, groups[10]) or ' ') or
+- (groups[11] and keep(keeper, groups[11]) or ' ') or
+- (groups[12] and keep(keeper, groups[12]) or ' ') or
+- keep(keeper, groups[13] or groups[14])
++ groups[9],
++ keep(keeper, groups[10] or ''),
++ groups[10] and '\n' or '',
++ ) or
++ groups[11] and (keep(keeper, groups[11]) + '\n') or
++ groups[12] and (keep(keeper, groups[12]) or ' ') or
++ groups[13] and (keep(keeper, groups[13]) or ' ') or
++ groups[14] and (keep(keeper, groups[14]) or ' ') or
++ keep(keeper, groups[15] or groups[16])
+ )
+
+- return _re.sub(rex, subber, '\n%s\n' % script).strip()
++ is_bytes, script = _as_str(script)
++ script = _re.sub(rex, subber, '\n%s\n' % script).strip()
++ if is_bytes:
++ script = script.encode('latin-1')
++ if is_bytes == 2:
++ script = bytearray(script)
++ return script
+
+
+ if __name__ == '__main__':
+diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py
+--- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py.12 2022-06-28 12:50:10.171324444 +0000
++++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py 2021-11-05 17:03:12.000000000 +0000
+@@ -1,41 +1,264 @@
+ #!/usr/bin/env python
+ # -*- coding: ascii -*-
+-#
+-# Copyright 2006 - 2013
+-# Andr\xe9 Malo or his licensors, as applicable
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# http://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
++u"""
++:Copyright:
+
++ Copyright 2011 - 2021
++ Andr\xe9 Malo or his licensors, as applicable
++
++:License:
++
++ Licensed under the Apache License, Version 2.0 (the "License");
++ you may not use this file except in compliance with the License.
++ You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++
++===========================================
++ rJSmin - A Javascript Minifier For Python
++===========================================
++
++rJSmin - A Javascript Minifier For Python.
++"""
++from __future__ import print_function
++__author__ = u"Andr\xe9 Malo"
++__docformat__ = "restructuredtext en"
++
++import os as _os
++import posixpath as _posixpath
+ import sys as _sys
+-from _setup import run
+
++# pylint: disable = no-name-in-module, import-error, raise-missing-from
++import setuptools as _setuptools
++
++# pylint: disable = invalid-name
++
++
++def _doc(filename):
++ """ Read docs file """
++ # pylint: disable = unspecified-encoding
++ args = {} if str is bytes else dict(encoding='utf-8')
++ try:
++ with open(_os.path.join('docs', filename), **args) as fp:
++ return fp.read()
++ except IOError:
++ return None
++
++
++def _lines(multiline):
++ """ Split multiline string into single line % empty and comments """
++ return [line for line in (
++ line.strip() for line in multiline.splitlines(False)
++ ) if line and not line.startswith('#')]
++
++
++package = dict(
++ name='rjsmin',
++ top='.',
++ pathname='.',
++ provides=_doc('PROVIDES'),
++ desc=_doc('SUMMARY').strip(),
++ longdesc=_doc('DESCRIPTION'),
++ author=__author__,
++ email='nd(a)perlig.de',
++ license="Apache License, Version 2.0",
++ keywords=_lines(_doc('KEYWORDS')),
++ url='http://opensource.perlig.de/rjsmin/',
++ classifiers=_lines(_doc('CLASSIFIERS') or ''),
++
++ packages=False,
++ py_modules=['rjsmin'],
++ version_file='rjsmin.py',
++ install_requires=[],
++)
++
++
++class BuildFailed(Exception):
++ """ The build has failed """
++
++
++from distutils.command import build_ext as _build_ext # pylint: disable = wrong-import-order
++from distutils import errors as _errors # pylint: disable = wrong-import-order
++class build_ext(_build_ext.build_ext): # pylint: disable = no-init
++ """ Improved extension building code """
++
++ def run(self):
++ """ Unify exception """
++ try:
++ _build_ext.build_ext.run(self)
++ except _errors.DistutilsPlatformError:
++ raise BuildFailed()
++
++
++ def build_extension(self, ext):
++ """
++ Build C extension - with extended functionality
+
+-def setup(args=None, _manifest=0):
+- """ Main setup function """
+- from _setup.ext import Extension
++ The following features are added here:
+
+- if 'java' in _sys.platform.lower():
+- # no c extension for jython
+- ext = None
++ - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or
++ unset) depending on the extensions name, but only if they are not
++ already defined.
++
++ - "." is added to the include directories (for cext.h)
++
++ :Parameters:
++ `ext` : `Extension`
++ The extension to build
++
++ :Return: whatever ``distutils.command.build_ext.build_ext`` returns
++ :Rtype: any
++ """
++ # handle name macros
++ macros = dict(ext.define_macros or ())
++ tup = ext.name.split('.')
++ if len(tup) == 1:
++ pkg, mod = None, tup[0]
++ else:
++ pkg, mod = '.'.join(tup[:-1]), tup[-1]
++ if pkg is not None and 'EXT_PACKAGE' not in macros:
++ ext.define_macros.append(('EXT_PACKAGE', pkg))
++ if 'EXT_MODULE' not in macros:
++ ext.define_macros.append(('EXT_MODULE', mod))
++ if pkg is None:
++ macros = dict(ext.undef_macros or ())
++ if 'EXT_PACKAGE' not in macros:
++ ext.undef_macros.append('EXT_PACKAGE')
++
++ import pprint; pprint.pprint(ext.__dict__)
++ try:
++ return _build_ext.build_ext.build_extension(self, ext)
++ except (_errors.CCompilerError, _errors.DistutilsExecError,
++ _errors.DistutilsPlatformError, IOError, ValueError):
++ raise BuildFailed()
++
++
++class Extension(_setuptools.Extension):
++ """ improved functionality """
++
++ def __init__(self, *args, **kwargs):
++ """ Initialization """
++ version = kwargs.pop('version')
++ self.depends = []
++ if 'depends' in kwargs:
++ self.depends = kwargs['depends']
++ _setuptools.Extension.__init__(self, *args, **kwargs)
++ self.define_macros.append(('EXT_VERSION', version))
++
++ # add include path
++ included = '.'
++ if included not in self.include_dirs:
++ self.include_dirs.append(included)
++
++ # add cext.h to the dependencies
++ cext_h = _posixpath.normpath(_posixpath.join(included, 'cext.h'))
++ for item in self.depends:
++ if _posixpath.normpath(item) == cext_h:
++ break
++ else:
++ self.depends.append(cext_h)
++
++
++EXTENSIONS = lambda v: [Extension('_rjsmin', ["rjsmin.c"], version=v)]
++
++
++def do_setup(cext):
++ """ Main """
++ # pylint: disable = too-many-branches
++ # pylint: disable = unspecified-encoding
++
++ args = {} if str is bytes else dict(encoding='utf-8')
++ version_file = '%s/%s' % (package['pathname'],
++ package.get('version_file', '__init__.py'))
++ with open(version_file, **args) as fp:
++ for line in fp: # pylint: disable = redefined-outer-name
++ if line.startswith('__version__'):
++ version = line.split('=', 1)[1].strip()
++ if version.startswith(("'", '"')):
++ version = version[1:-1].strip()
++ break
++ else:
++ raise RuntimeError("Version not found")
++
++ kwargs = {}
++
++ if not cext or 'java' in _sys.platform.lower():
++ extensions = []
+ else:
+- ext=[Extension('_rjsmin', sources=['rjsmin.c'])]
++ extensions = EXTENSIONS(version)
++
++ if extensions:
++ if 'build_ext' in globals():
++ kwargs.setdefault('cmdclass', {})['build_ext'] = build_ext
++ kwargs['ext_modules'] = extensions
++
++ cflags = None
++ if _os.environ.get('CFLAGS') is None:
++ from distutils import ccompiler as _ccompiler
++
++ compiler = _ccompiler.get_default_compiler()
++ try:
++ with open("debug.%s.cflags" % compiler) as fp:
++ cflags = ' '.join([
++ line for line in (line.strip() for line in fp)
++ if line and not line.startswith('#')
++ ]).split() or None
++ except IOError:
++ pass
++
++ if cflags:
++ gcov = 'coverage' in ' '.join(cflags)
++ for ext in extensions:
++ # pylint: disable = attribute-defined-outside-init
++ ext.extra_compile_args = \
++ getattr(ext, 'extra_compile_args', []) + cflags
++ if gcov:
++ ext.libraries.append('gcov')
++
++
++ if package.get('packages', True):
++ kwargs['packages'] = [package['top']] + [
++ '%s.%s' % (package['top'], item)
++ for item in
++ _setuptools.find_packages(package['pathname'])
++ ]
++ if package.get('py_modules'):
++ kwargs['py_modules'] = package['py_modules']
+
+- return run(script_args=args, ext=ext, manifest_only=_manifest)
++ _setuptools.setup(
++ name=package['name'],
++ author=package['author'],
++ author_email=package['email'],
++ license=package['license'],
++ classifiers=package['classifiers'],
++ description=package['desc'],
++ long_description=package['longdesc'],
++ url=package['url'],
++ install_requires=package['install_requires'],
++ version=version,
++ zip_safe=False,
++ **kwargs
++ )
+
+
+-def manifest():
+- """ Create List of packaged files """
+- return setup((), _manifest=1)
++def setup():
++ """ Run setup """
++ try:
++ do_setup(True)
++ except BuildFailed:
++ env = 'SETUP_CEXT_REQUIRED'
++ if _os.environ.get(env, '') not in ('', '0'):
++ raise
++ print("C extension build failed - building python only version now. "
++ "Set '%s' environment variable to '1' to make it fail."
++ % (env,), file=_sys.stderr)
++ do_setup(False)
+
+
+ if __name__ == '__main__':
2 years, 4 months