texlive[72709] trunk: minted (30oct24)

commits+karl at tug.org commits+karl at tug.org
Wed Oct 30 21:02:30 CET 2024


Revision: 72709
          https://tug.org/svn/texlive?view=revision&revision=72709
Author:   karl
Date:     2024-10-30 21:02:30 +0100 (Wed, 30 Oct 2024)
Log Message:
-----------
minted (30oct24)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/minted/latexminted.py
    trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md
    trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md
    trunk/Master/texmf-dist/doc/latex/minted/README
    trunk/Master/texmf-dist/doc/latex/minted/minted.pdf
    trunk/Master/texmf-dist/scripts/minted/latexminted.py
    trunk/Master/texmf-dist/source/latex/minted/minted.dtx
    trunk/Master/texmf-dist/tex/latex/minted/minted.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl
    trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl

Removed Paths:
-------------
    trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl
    trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.4.0-py3-none-any.whl

Modified: trunk/Build/source/texk/texlive/linked_scripts/minted/latexminted.py
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/minted/latexminted.py	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Build/source/texk/texlive/linked_scripts/minted/latexminted.py	2024-10-30 20:02:30 UTC (rev 72709)
@@ -79,12 +79,11 @@
 '''
 
 
-__version__ = '0.1.0'
+__version__ = '0.3.0'
 
 
 import os
 import pathlib
-import platform
 import shutil
 import subprocess
 import sys
@@ -140,7 +139,12 @@
         prohibited_path_roots.add(env_var_path)
         prohibited_path_roots.add(env_var_path.resolve())
 
+did_init_prohibited_path_roots = False
 def is_permitted_executable_path(executable_path, executable_path_resolved):
+    global did_init_prohibited_path_roots
+    if not did_init_prohibited_path_roots:
+        did_init_prohibited_path_roots = True
+        init_prohibited_path_roots()
     if not executable_path_resolved.is_resolved():
         raise Exception('Second argument must be resolved path')
     if any(e.is_relative_to(p) or p.is_relative_to(e)
@@ -154,76 +158,80 @@
 # https://github.com/gpoore/latexrestricted/blob/main/latexrestricted/_latex_config.py
 env_SELFAUTOLOC = os.getenv('SELFAUTOLOC')
 env_TEXSYSTEM = os.getenv('TEXSYSTEM')
-if not env_TEXMFOUTPUT and env_SELFAUTOLOC and (not env_TEXSYSTEM or env_TEXSYSTEM.lower() != 'miktex'):
-    if platform.system() == 'Windows':
-        # Under Windows, shell escape executables will often be launched with
-        # the TeX Live `runscript.exe` executable wrapper.  This overwrites
-        # `SELFAUTOLOC` from TeX with the location of the wrapper, so
-        # `SELFAUTOLOC` may not be correct.
-        which_tlmgr = shutil.which('tlmgr')  # No `.exe`; likely `.bat`
-        if not which_tlmgr:
-            sys.exit('Failed to find TeX Live "tlmgr" executable on PATH')
-        which_tlmgr_resolved = Path(which_tlmgr).resolve()
-        texlive_bin_path = which_tlmgr_resolved.parent
-        # Make sure executable is *.exe, not *.bat or *.cmd:
-        # https://docs.python.org/3/library/subprocess.html#security-considerations
-        which_kpsewhich = shutil.which('kpsewhich.exe', path=str(texlive_bin_path))
-        if not which_kpsewhich:
-            sys.exit('Failed to find a TeX Live "tlmgr" executable with accompanying "kpsewhich" executable on PATH')
-        which_kpsewhich_path = Path(which_kpsewhich)
-        which_kpsewhich_resolved = which_kpsewhich_path.resolve()
-        if not texlive_bin_path == which_kpsewhich_resolved.parent:
-            sys.exit(' '.join([
-                '"tlmgr" executable from PATH resolved to "{}" '.format(which_tlmgr_resolved.as_posix()),
-                'while "kpsewhich" resolved to "{}";'.format(which_kpsewhich_resolved.as_posix()),
-                '"tlmgr" and "kpsewhich" should be in the same location',
-            ]))
-        if not which_kpsewhich_resolved.name.lower().endswith('.exe'):
-            sys.exit(' '.join([
-                'Executable "kpsewhich" resolved to "{}",'.format(which_kpsewhich_resolved.as_posix()),
-                'but *.exe is required',
-            ]))
-    else:
-        which_kpsewhich = shutil.which('kpsewhich', path=env_SELFAUTOLOC)
-        if not which_kpsewhich:
-            sys.exit(' '.join([
-                'Environment variable SELFAUTOLOC has value "{}",'.format(env_SELFAUTOLOC),
-                'but a "kpsewhich" executable was not found at that location',
-            ]))
-        which_kpsewhich_path = Path(which_kpsewhich)
-        which_kpsewhich_resolved = which_kpsewhich_path.resolve()
-    if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
-        # As in the latexrestricted case, this doesn't initially check for the
-        # TeX Live scenario where `TEXMFOUTPUT` is set in a `texmf.cnf` config
-        # file to a location that includes the `kpsewhich` executable.  There
-        # isn't a good way to get the value of `TEXMFOUTPUT` without running
-        # `kpsewhich` in that case.
-        sys.exit(
-            'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
-            'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
-        )
-    kpsewhich_cmd = [which_kpsewhich_resolved.as_posix(), '--var-value', 'TEXMFOUTPUT']
-    try:
-        kpsewhich_proc = subprocess.run(kpsewhich_cmd, shell=False, capture_output=True)
-    except PermissionError:
-        sys.exit('Insufficient permission to run "{}"'.format(which_kpsewhich_resolved.as_posix()))
-    kpsewhich_TEXMFOUTPUT = kpsewhich_proc.stdout.decode(sys.stdout.encoding) or None
-    if kpsewhich_TEXMFOUTPUT:
-        kpsewhich_TEXMFOUTPUT_path = Path(kpsewhich_TEXMFOUTPUT)
-        prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path)
-        prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path.resolve())
-    if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
-        # It is now possible to check for the TeX Live scenario where
-        # `TEXMFOUTPUT` is set in a `texmf.cnf` config file to a location that
-        # includes the `kpsewhich` executable.  Giving an error message after
-        # already running `kpsewhich` isn't ideal, but there isn't a good
-        # alternative.  As in the latexrestricted case, the impact on overall
-        # security is negligible because an unsafe value of `TEXMFOUTPUT`
-        # means that all TeX-related executables are potentially compromised.
-        sys.exit(
-            'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
-            'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
-        )
+def init_prohibited_path_roots():
+    if not env_TEXMFOUTPUT and env_SELFAUTOLOC and (not env_TEXSYSTEM or env_TEXSYSTEM.lower() != 'miktex'):
+        if sys.platform == 'win32':
+            # Under Windows, shell escape executables will often be launched
+            # with the TeX Live `runscript.exe` executable wrapper.  This
+            # overwrites `SELFAUTOLOC` from TeX with the location of the
+            # wrapper, so `SELFAUTOLOC` may not be correct.
+            which_tlmgr = shutil.which('tlmgr')  # No `.exe`; likely `.bat`
+            if not which_tlmgr:
+                sys.exit('Failed to find TeX Live "tlmgr" executable on PATH')
+            which_tlmgr_resolved = Path(which_tlmgr).resolve()
+            texlive_bin_path = which_tlmgr_resolved.parent
+            # Make sure executable is *.exe, not *.bat or *.cmd:
+            # https://docs.python.org/3/library/subprocess.html#security-considerations
+            which_kpsewhich = shutil.which('kpsewhich.exe', path=str(texlive_bin_path))
+            if not which_kpsewhich:
+                sys.exit(
+                    'Failed to find a TeX Live "tlmgr" executable with accompanying "kpsewhich" executable on PATH'
+                )
+            which_kpsewhich_path = Path(which_kpsewhich)
+            which_kpsewhich_resolved = which_kpsewhich_path.resolve()
+            if not texlive_bin_path == which_kpsewhich_resolved.parent:
+                sys.exit(' '.join([
+                    '"tlmgr" executable from PATH resolved to "{}" '.format(which_tlmgr_resolved.as_posix()),
+                    'while "kpsewhich" resolved to "{}";'.format(which_kpsewhich_resolved.as_posix()),
+                    '"tlmgr" and "kpsewhich" should be in the same location',
+                ]))
+            if not which_kpsewhich_resolved.name.lower().endswith('.exe'):
+                sys.exit(' '.join([
+                    'Executable "kpsewhich" resolved to "{}",'.format(which_kpsewhich_resolved.as_posix()),
+                    'but *.exe is required',
+                ]))
+        else:
+            which_kpsewhich = shutil.which('kpsewhich', path=env_SELFAUTOLOC)
+            if not which_kpsewhich:
+                sys.exit(' '.join([
+                    'Environment variable SELFAUTOLOC has value "{}",'.format(env_SELFAUTOLOC),
+                    'but a "kpsewhich" executable was not found at that location',
+                ]))
+            which_kpsewhich_path = Path(which_kpsewhich)
+            which_kpsewhich_resolved = which_kpsewhich_path.resolve()
+        if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
+            # As in the latexrestricted case, this doesn't initially check for
+            # the TeX Live scenario where `TEXMFOUTPUT` is set in a
+            # `texmf.cnf` config file to a location that includes the
+            # `kpsewhich` executable.  There isn't a good way to get the value
+            # of `TEXMFOUTPUT` without running `kpsewhich` in that case.
+            sys.exit(
+                'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
+                'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
+            )
+        kpsewhich_cmd = [which_kpsewhich_resolved.as_posix(), '--var-value', 'TEXMFOUTPUT']
+        try:
+            kpsewhich_proc = subprocess.run(kpsewhich_cmd, shell=False, capture_output=True)
+        except PermissionError:
+            sys.exit('Insufficient permission to run "{}"'.format(which_kpsewhich_resolved.as_posix()))
+        kpsewhich_TEXMFOUTPUT = kpsewhich_proc.stdout.strip().decode(sys.stdout.encoding) or None
+        if kpsewhich_TEXMFOUTPUT:
+            kpsewhich_TEXMFOUTPUT_path = Path(kpsewhich_TEXMFOUTPUT)
+            prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path)
+            prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path.resolve())
+        if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
+            # It is now possible to check for the TeX Live scenario where
+            # `TEXMFOUTPUT` is set in a `texmf.cnf` config file to a location
+            # that includes the `kpsewhich` executable.  Giving an error
+            # message after already running `kpsewhich` isn't ideal, but there
+            # isn't a good alternative.  As in the latexrestricted case, the
+            # impact on overall security is negligible because an unsafe value
+            # of `TEXMFOUTPUT` means that all TeX-related executables are
+            # potentially compromised.
+            sys.exit(
+                'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
+                'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
+            )
 
 
 
@@ -232,7 +240,7 @@
 # relaunch this script with that Python version in a subprocess.
 if sys.version_info[:2] < (3, 8):
     for minor_version in range(13, 7, -1):
-        if platform.system() == 'Windows':
+        if sys.platform == 'win32':
             # Batch files must be prohibited:
             # https://docs.python.org/3/library/subprocess.html#security-considerations
             which_python = shutil.which('python3.{}.exe'.format(minor_version))
@@ -241,7 +249,7 @@
         if which_python:
             which_python_path = Path(which_python)
             which_python_resolved = which_python_path.resolve()
-            if platform.system() == 'Windows' and not which_python_resolved.name.lower().endswith('.exe'):
+            if sys.platform == 'win32' and not which_python_resolved.name.lower().endswith('.exe'):
                 continue
             if is_permitted_executable_path(which_python_path, which_python_resolved):
                 python_cmd = [which_python_resolved.as_posix(), __file__] + sys.argv[1:]
@@ -282,7 +290,7 @@
 # endless recursion of subprocesses in the event that a `latexminted`
 # executable *inside* a TeX installation somehow manages to pass the tests for
 # an executable *outside* a TeX installation.
-if platform.system() == 'Windows' and not os.getenv('LATEXMINTED_SUBPROCESS'):
+if sys.platform == 'win32' and not os.getenv('LATEXMINTED_SUBPROCESS'):
     os.environ['LATEXMINTED_SUBPROCESS'] = '1'
     fallback_path_search = True
     if env_SELFAUTOLOC:

Modified: trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md	2024-10-30 20:02:30 UTC (rev 72709)
@@ -1,6 +1,26 @@
 # Changelog: `latexminted` — Python library for LaTeX minted package
 
 
+
+## v0.3.0 (2024-10-29)
+
+*  Added support for new keywords options (#416):  `extrakeywords`,
+   `extrakeywordsconstant`, `extrakeywordsdeclaration`,
+   `extrakeywordsnamespace`, `extrakeywordspseudo`, `extrakeywordsreserved`,
+   `extrakeywordstype`.
+
+*  Refactored version handling in `cmdline.py` to avoid unnecessary imports.
+
+*  Improved `.errlog.minted` files.  Improved layout and added traceback
+   information for the origin in the LaTeX document.  Fixed a bug that could
+   cause `.errlog.minted` files to be deleted when they should be kept.
+   `.errlog.minted` files now contain all error data from a compile,
+   regardless of `highlightmode` setting.  Previously, only the data from the
+   last error was kept under some circumstances when `highlightmode` was not
+   `immediate`.
+
+
+
 ## v0.2.0 (2024-10-03)
 
 *  All config data passed back to LaTeX is now processed with `\detokenize`

Modified: trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md	2024-10-30 20:02:30 UTC (rev 72709)
@@ -1,6 +1,43 @@
 # Changelog — minted LaTeX package
 
 
+## v3.2.0 (2024/10/29)
+
+*  Fixed compatibility with `\includeonly` by replacing buffer length counters
+   with macros (#414).  As part of this, the minimum supported `latex2pydata`
+   LaTeX package is now 0.3.0 and the minimum supported `fvextra` is now
+   1.9.0.
+
+*  Added new options that allow keywords to be added to a lexer (#416):
+   `extrakeywords`, `extrakeywordsconstant`, `extrakeywordsdeclaration`,
+   `extrakeywordsnamespace`, `extrakeywordspseudo`, `extrakeywordsreserved`,
+   `extrakeywordstype`.  This covers all keyword tokens supported by Pygments
+   (https://pygments.org/docs/tokens/#keyword-tokens).
+
+*  Many performance improvements.  When combined with `latexrestricted`
+   v0.6.0, these can give a cumulative speedup of over 40% in the case when no
+   code needs to be highlighted.
+
+   - Temp files and the cache are now only cleaned up when necessary at the
+     end of the document.  Previously, this occurred at the end of each
+     compile, unnecessarily increasing compile time.
+
+   - In `latexminted.py`, switched from `platform.system()` to `sys.platform`
+     for better performance in detecting operating system.
+
+     Performance reference:  https://github.com/python/cpython/issues/95531.
+
+   - In `latexminted.py` with TeX Live, the value of `TEXMFOUTPUT` is no
+     longer retrieved with `kpsewhich` unless it is actually used.  Also fixed
+     a bug in parsing `TEXMFOUTPUT` value (whitespace is now stripped).
+
+*  The `debug` package option now records shell escape commands in the log.
+
+*  In config detection, error messages now mention `.errlog.minted` file when
+   it exists.
+
+
+
 ## v3.1.2 (2024/10/07)
 
 *  There is now only a single `\read` allocation for reading temporary files

Modified: trunk/Master/texmf-dist/doc/latex/minted/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/README	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/doc/latex/minted/README	2024-10-30 20:02:30 UTC (rev 72709)
@@ -7,8 +7,10 @@
 See the documentation (minted.pdf) for examples and instructions for
 installation and usage.
 
-This work may be distributed and/or modified under the conditions of the
-LaTeX Project Public License (LPPL), version 1.3c or later.
+This work may be distributed and/or modified under the conditions of the LaTeX
+Project Public License (LPPL), version 1.3c or later.  Additionally,
+minted1.sty and minted2.sty may be distributed under the terms of the 3-Clause
+("New") BSD license.
 
 For suggestions, feature requests, and bug reports, please use the project's
 GitHub site:  https://github.com/gpoore/minted.

Modified: trunk/Master/texmf-dist/doc/latex/minted/minted.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl
===================================================================
--- trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl	2024-10-30 20:02:30 UTC (rev 72709)

Property changes on: trunk/Master/texmf-dist/scripts/minted/latexminted-0.3.0-py3-none-any.whl
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/minted/latexminted.py
===================================================================
--- trunk/Master/texmf-dist/scripts/minted/latexminted.py	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/scripts/minted/latexminted.py	2024-10-30 20:02:30 UTC (rev 72709)
@@ -79,12 +79,11 @@
 '''
 
 
-__version__ = '0.1.0'
+__version__ = '0.3.0'
 
 
 import os
 import pathlib
-import platform
 import shutil
 import subprocess
 import sys
@@ -140,7 +139,12 @@
         prohibited_path_roots.add(env_var_path)
         prohibited_path_roots.add(env_var_path.resolve())
 
+did_init_prohibited_path_roots = False
 def is_permitted_executable_path(executable_path, executable_path_resolved):
+    global did_init_prohibited_path_roots
+    if not did_init_prohibited_path_roots:
+        did_init_prohibited_path_roots = True
+        init_prohibited_path_roots()
     if not executable_path_resolved.is_resolved():
         raise Exception('Second argument must be resolved path')
     if any(e.is_relative_to(p) or p.is_relative_to(e)
@@ -154,76 +158,80 @@
 # https://github.com/gpoore/latexrestricted/blob/main/latexrestricted/_latex_config.py
 env_SELFAUTOLOC = os.getenv('SELFAUTOLOC')
 env_TEXSYSTEM = os.getenv('TEXSYSTEM')
-if not env_TEXMFOUTPUT and env_SELFAUTOLOC and (not env_TEXSYSTEM or env_TEXSYSTEM.lower() != 'miktex'):
-    if platform.system() == 'Windows':
-        # Under Windows, shell escape executables will often be launched with
-        # the TeX Live `runscript.exe` executable wrapper.  This overwrites
-        # `SELFAUTOLOC` from TeX with the location of the wrapper, so
-        # `SELFAUTOLOC` may not be correct.
-        which_tlmgr = shutil.which('tlmgr')  # No `.exe`; likely `.bat`
-        if not which_tlmgr:
-            sys.exit('Failed to find TeX Live "tlmgr" executable on PATH')
-        which_tlmgr_resolved = Path(which_tlmgr).resolve()
-        texlive_bin_path = which_tlmgr_resolved.parent
-        # Make sure executable is *.exe, not *.bat or *.cmd:
-        # https://docs.python.org/3/library/subprocess.html#security-considerations
-        which_kpsewhich = shutil.which('kpsewhich.exe', path=str(texlive_bin_path))
-        if not which_kpsewhich:
-            sys.exit('Failed to find a TeX Live "tlmgr" executable with accompanying "kpsewhich" executable on PATH')
-        which_kpsewhich_path = Path(which_kpsewhich)
-        which_kpsewhich_resolved = which_kpsewhich_path.resolve()
-        if not texlive_bin_path == which_kpsewhich_resolved.parent:
-            sys.exit(' '.join([
-                '"tlmgr" executable from PATH resolved to "{}" '.format(which_tlmgr_resolved.as_posix()),
-                'while "kpsewhich" resolved to "{}";'.format(which_kpsewhich_resolved.as_posix()),
-                '"tlmgr" and "kpsewhich" should be in the same location',
-            ]))
-        if not which_kpsewhich_resolved.name.lower().endswith('.exe'):
-            sys.exit(' '.join([
-                'Executable "kpsewhich" resolved to "{}",'.format(which_kpsewhich_resolved.as_posix()),
-                'but *.exe is required',
-            ]))
-    else:
-        which_kpsewhich = shutil.which('kpsewhich', path=env_SELFAUTOLOC)
-        if not which_kpsewhich:
-            sys.exit(' '.join([
-                'Environment variable SELFAUTOLOC has value "{}",'.format(env_SELFAUTOLOC),
-                'but a "kpsewhich" executable was not found at that location',
-            ]))
-        which_kpsewhich_path = Path(which_kpsewhich)
-        which_kpsewhich_resolved = which_kpsewhich_path.resolve()
-    if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
-        # As in the latexrestricted case, this doesn't initially check for the
-        # TeX Live scenario where `TEXMFOUTPUT` is set in a `texmf.cnf` config
-        # file to a location that includes the `kpsewhich` executable.  There
-        # isn't a good way to get the value of `TEXMFOUTPUT` without running
-        # `kpsewhich` in that case.
-        sys.exit(
-            'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
-            'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
-        )
-    kpsewhich_cmd = [which_kpsewhich_resolved.as_posix(), '--var-value', 'TEXMFOUTPUT']
-    try:
-        kpsewhich_proc = subprocess.run(kpsewhich_cmd, shell=False, capture_output=True)
-    except PermissionError:
-        sys.exit('Insufficient permission to run "{}"'.format(which_kpsewhich_resolved.as_posix()))
-    kpsewhich_TEXMFOUTPUT = kpsewhich_proc.stdout.decode(sys.stdout.encoding) or None
-    if kpsewhich_TEXMFOUTPUT:
-        kpsewhich_TEXMFOUTPUT_path = Path(kpsewhich_TEXMFOUTPUT)
-        prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path)
-        prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path.resolve())
-    if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
-        # It is now possible to check for the TeX Live scenario where
-        # `TEXMFOUTPUT` is set in a `texmf.cnf` config file to a location that
-        # includes the `kpsewhich` executable.  Giving an error message after
-        # already running `kpsewhich` isn't ideal, but there isn't a good
-        # alternative.  As in the latexrestricted case, the impact on overall
-        # security is negligible because an unsafe value of `TEXMFOUTPUT`
-        # means that all TeX-related executables are potentially compromised.
-        sys.exit(
-            'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
-            'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
-        )
+def init_prohibited_path_roots():
+    if not env_TEXMFOUTPUT and env_SELFAUTOLOC and (not env_TEXSYSTEM or env_TEXSYSTEM.lower() != 'miktex'):
+        if sys.platform == 'win32':
+            # Under Windows, shell escape executables will often be launched
+            # with the TeX Live `runscript.exe` executable wrapper.  This
+            # overwrites `SELFAUTOLOC` from TeX with the location of the
+            # wrapper, so `SELFAUTOLOC` may not be correct.
+            which_tlmgr = shutil.which('tlmgr')  # No `.exe`; likely `.bat`
+            if not which_tlmgr:
+                sys.exit('Failed to find TeX Live "tlmgr" executable on PATH')
+            which_tlmgr_resolved = Path(which_tlmgr).resolve()
+            texlive_bin_path = which_tlmgr_resolved.parent
+            # Make sure executable is *.exe, not *.bat or *.cmd:
+            # https://docs.python.org/3/library/subprocess.html#security-considerations
+            which_kpsewhich = shutil.which('kpsewhich.exe', path=str(texlive_bin_path))
+            if not which_kpsewhich:
+                sys.exit(
+                    'Failed to find a TeX Live "tlmgr" executable with accompanying "kpsewhich" executable on PATH'
+                )
+            which_kpsewhich_path = Path(which_kpsewhich)
+            which_kpsewhich_resolved = which_kpsewhich_path.resolve()
+            if not texlive_bin_path == which_kpsewhich_resolved.parent:
+                sys.exit(' '.join([
+                    '"tlmgr" executable from PATH resolved to "{}" '.format(which_tlmgr_resolved.as_posix()),
+                    'while "kpsewhich" resolved to "{}";'.format(which_kpsewhich_resolved.as_posix()),
+                    '"tlmgr" and "kpsewhich" should be in the same location',
+                ]))
+            if not which_kpsewhich_resolved.name.lower().endswith('.exe'):
+                sys.exit(' '.join([
+                    'Executable "kpsewhich" resolved to "{}",'.format(which_kpsewhich_resolved.as_posix()),
+                    'but *.exe is required',
+                ]))
+        else:
+            which_kpsewhich = shutil.which('kpsewhich', path=env_SELFAUTOLOC)
+            if not which_kpsewhich:
+                sys.exit(' '.join([
+                    'Environment variable SELFAUTOLOC has value "{}",'.format(env_SELFAUTOLOC),
+                    'but a "kpsewhich" executable was not found at that location',
+                ]))
+            which_kpsewhich_path = Path(which_kpsewhich)
+            which_kpsewhich_resolved = which_kpsewhich_path.resolve()
+        if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
+            # As in the latexrestricted case, this doesn't initially check for
+            # the TeX Live scenario where `TEXMFOUTPUT` is set in a
+            # `texmf.cnf` config file to a location that includes the
+            # `kpsewhich` executable.  There isn't a good way to get the value
+            # of `TEXMFOUTPUT` without running `kpsewhich` in that case.
+            sys.exit(
+                'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
+                'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
+            )
+        kpsewhich_cmd = [which_kpsewhich_resolved.as_posix(), '--var-value', 'TEXMFOUTPUT']
+        try:
+            kpsewhich_proc = subprocess.run(kpsewhich_cmd, shell=False, capture_output=True)
+        except PermissionError:
+            sys.exit('Insufficient permission to run "{}"'.format(which_kpsewhich_resolved.as_posix()))
+        kpsewhich_TEXMFOUTPUT = kpsewhich_proc.stdout.strip().decode(sys.stdout.encoding) or None
+        if kpsewhich_TEXMFOUTPUT:
+            kpsewhich_TEXMFOUTPUT_path = Path(kpsewhich_TEXMFOUTPUT)
+            prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path)
+            prohibited_path_roots.add(kpsewhich_TEXMFOUTPUT_path.resolve())
+        if not is_permitted_executable_path(which_kpsewhich_path, which_kpsewhich_resolved):
+            # It is now possible to check for the TeX Live scenario where
+            # `TEXMFOUTPUT` is set in a `texmf.cnf` config file to a location
+            # that includes the `kpsewhich` executable.  Giving an error
+            # message after already running `kpsewhich` isn't ideal, but there
+            # isn't a good alternative.  As in the latexrestricted case, the
+            # impact on overall security is negligible because an unsafe value
+            # of `TEXMFOUTPUT` means that all TeX-related executables are
+            # potentially compromised.
+            sys.exit(
+                'Executable "kpsewhich" is located under the current directory, TEXMFOUTPUT, or '
+                'TEXMF_OUTPUT_DIRECTORY, or one of these locations is under the same directory as the executable'
+            )
 
 
 
@@ -232,7 +240,7 @@
 # relaunch this script with that Python version in a subprocess.
 if sys.version_info[:2] < (3, 8):
     for minor_version in range(13, 7, -1):
-        if platform.system() == 'Windows':
+        if sys.platform == 'win32':
             # Batch files must be prohibited:
             # https://docs.python.org/3/library/subprocess.html#security-considerations
             which_python = shutil.which('python3.{}.exe'.format(minor_version))
@@ -241,7 +249,7 @@
         if which_python:
             which_python_path = Path(which_python)
             which_python_resolved = which_python_path.resolve()
-            if platform.system() == 'Windows' and not which_python_resolved.name.lower().endswith('.exe'):
+            if sys.platform == 'win32' and not which_python_resolved.name.lower().endswith('.exe'):
                 continue
             if is_permitted_executable_path(which_python_path, which_python_resolved):
                 python_cmd = [which_python_resolved.as_posix(), __file__] + sys.argv[1:]
@@ -282,7 +290,7 @@
 # endless recursion of subprocesses in the event that a `latexminted`
 # executable *inside* a TeX installation somehow manages to pass the tests for
 # an executable *outside* a TeX installation.
-if platform.system() == 'Windows' and not os.getenv('LATEXMINTED_SUBPROCESS'):
+if sys.platform == 'win32' and not os.getenv('LATEXMINTED_SUBPROCESS'):
     os.environ['LATEXMINTED_SUBPROCESS'] = '1'
     fallback_path_search = True
     if env_SELFAUTOLOC:

Deleted: trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.4.0-py3-none-any.whl
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl
===================================================================
--- trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl	2024-10-30 20:02:30 UTC (rev 72709)

Property changes on: trunk/Master/texmf-dist/scripts/minted/latexrestricted-0.6.0-py3-none-any.whl
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/minted/minted.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2024-10-30 20:02:30 UTC (rev 72709)
@@ -27,7 +27,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{minted}
 %<*package>
-    [2024/10/07 v3.1.2 Yet another Pygments shim for LaTeX]
+    [2024/10/29 v3.2.0 Yet another Pygments shim for LaTeX]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -1192,9 +1192,25 @@
 % \endgroup
 %
 % \textbf{Note that when math is used inside escapes, any active characters beyond those that are normally active in verbatim can cause problems.}  Any package that relies on special active characters in math mode (for example, \texpkg{icomma}) will produce errors along the lines of ``\texttt{TeX capacity exceeded}'' and ``\texttt{\string\leavevmode \string\kern \string\z@}''.  This may be fixed by modifying \texttt{\string\@noligs}, as described at \url{https://tex.stackexchange.com/questions/223876}.
+%
+%
+% \item[extrakeywords (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordsconstant (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordsdeclaration (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordsnamespace (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordspseudo (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordsreserved (string) (\meta{none})]\vspace{-1.2\baselineskip}
+% \item[extrakeywordstype (string) (\meta{none})]
+% Extra keywords for the current lexer.  See the \href{https://pygments.org/docs/tokens/#keyword-tokens}{Pygments documentation} for details about the different keyword classes.
+%
+% Values must be lists of extra keywords, either comma-delimited or space-delimited.
+%
+%
 %   \item[firstline (integer) (1)]
 %     The first line to be shown.
 %     All lines before that line are ignored and do not appear in the output.
+%
+%
 %   \item[firstnumber (auto \| last \| integer) (auto = 1)]
 %     Line number of the first line.
 %
@@ -1657,8 +1673,8 @@
 %    \begin{macrocode}
 \RequirePackage{catchfile}
 \RequirePackage{etoolbox}
-\RequirePackage{fvextra}[2024/09/05]
-\RequirePackage{latex2pydata}[2024/05/16]
+\RequirePackage{fvextra}[2024/10/16]
+\RequirePackage{latex2pydata}[2024/10/16]
 \RequirePackage{pdftexcmds}
 \RequirePackage{pgfkeys}
 \RequirePackage{pgfopts}
@@ -2053,7 +2069,7 @@
 %
 % |\minted at highlightmode@init| is invoked within |\minted at detectconfig| if the Python executable is available and enabled.  For the |fastfirst| case, |\minted at highlightmode@init| requires the |\minted at cachepath| that is set within |\minted at detectconfig|.
 %
-% |\minted at fasthighlightmode@checkend| is invoked |\AfterEndDocument| with |\minted at clean|; the |\AtEndDocument| is created with the definition of |\minted at clean| so that everything is in the correct order.
+% |\minted at fasthighlightmode@checkend| is invoked at the end of the document within |\minted at clean|.
 %    \begin{macrocode}
 \newbool{minted at fasthighlightmode}
 \newbool{minted at fasthighlightmode@open}
@@ -2356,7 +2372,7 @@
 % \begin{macro}{minted at tmpcodebufferlength}
 % Length of buffer in which code to be highlighted is stored.
 %    \begin{macrocode}
-\newcounter{minted at tmpcodebufferlength}
+\def\minted at tmpcodebufferlength{0}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2382,10 +2398,20 @@
 % \begin{macro}{\minted at ShellEscapeMaybeMessages,\minted at ShellEscapeNoMessages}
 %    \begin{macrocode}
 \def\minted at ShellEscapeMaybeMessages#1{%
+  \ifbool{minted at debug}%
+   {\immediate\typeout{%
+      minted debug: shell escape at
+      \ifx\CurrentFile\@empty\else\CurrentFile\space\fi line \the\inputlineno: #1}}%
+   {}%
   \let\minted at exec@warning\relax
   \let\minted at exec@error\relax
   \ifbool{minted at canexec}{\ShellEscape{#1}\minted at inputexecmessages}{}}
 \def\minted at ShellEscapeNoMessages#1{%
+  \ifbool{minted at debug}%
+   {\immediate\typeout{%
+      minted debug: shell escape at
+      \ifx\CurrentFile\@empty\else\CurrentFile\space\fi line \the\inputlineno: #1}}%
+   {}%
   \ifbool{minted at canexec}{\ShellEscape{#1}}{}}
 %    \end{macrocode}
 % \end{macro}
@@ -2536,18 +2562,27 @@
   \minted at ensureatletter{%
     \InputIfFileExists{\MintedConfigFilename}{}{}}%
   \ifx\minted at executable@version\relax
-    \expandafter\minted at detectconfig@noexecutable
+    \expandafter\minted at detectconfig@noexecutableorerrlog
   \else
     \expandafter\minted at detectconfig@ii
   \fi}
-\def\minted at detectconfig@noexecutable{%
+\def\minted at detectconfig@noexecutableorerrlog{%
   \global\boolfalse{minted at canexec}%
   \ifnum\csname c_sys_shell_escape_int\endcsname=1\relax
-    \minted at error{minted v3+ executable is not installed or is not added to PATH}%
+    \expandafter\@firstofttwo
   \else
-    \minted at error{minted v3+ executable is not installed, is not added to PATH,
-      or is not permitted with restricted shell escape}%
-  \fi}
+    \expandafter\@secondoftwo
+  \fi
+   {\IfFileExists{\MintedErrlogFilename}%
+     {\minted at error{minted v3+ executable is not installed or is not added to PATH,
+        or there was an unexpected error (check "\MintedErrlogFilename")}}%
+     {\minted at error{minted v3+ executable is not installed or is not added to PATH}}}%
+   {\IfFileExists{\MintedErrlogFilename}%
+     {\minted at error{minted v3+ executable is not installed, is not added to PATH,
+        or is not permitted with restricted shell escape;
+        or there was an unexpected error (check "\MintedErrlogFilename")}}%
+     {\minted at error{minted v3+ executable is not installed, is not added to PATH,
+        or is not permitted with restricted shell escape}}}}
 \def\minted at detectconfig@ii{%
   \ifx\minted at timestamp\minted at config@timestamp
     \expandafter\minted at detectconfig@iii
@@ -2562,7 +2597,7 @@
       upgrade to TeX distribution that supports \detokenize{TEXMF_OUTPUT_DIRECTORY}
       or set environment variable \detokenize{TEXMF_OUTPUT_DIRECTORY} manually)}%
   \else
-    \expandafter\minted at detectconfig@noexecutable
+    \expandafter\minted at detectconfig@noexecutableorerrlog
   \fi}
 \def\minted at detectconfig@iii{%
   \minted at exec@cleanconfig
@@ -3157,6 +3192,13 @@
 \mintedpgfkeyscreate{py}{
   autogobble<true>=false,
   encoding=utf8,
+  extrakeywords=,
+  extrakeywordsconstant=,
+  extrakeywordsdeclaration=,
+  extrakeywordsnamespace=,
+  extrakeywordspseudo=,
+  extrakeywordsreserved=,
+  extrakeywordstype=,
   funcnamehighlighting<true>=true,
   gobble=0,
   gobblefilter=0,
@@ -3234,19 +3276,63 @@
 %
 %
 %
+% \subsubsection{State}
+%
+% \begin{macro}{minted at didcreatefiles}
+% Track whether any style definitions or highlighted code files were generated, so that file cleanup can be optimized.  This is set |true| whenever there is an attempt to create style definitions or highlighted code files; even if the attempt fails, there will typically be leftover temp files.
+%    \begin{macrocode}
+\newbool{minted at didcreatefiles}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \subsubsection{Cache management}
 %
 %
-% \begin{macro}{\minted at addcachefilename,\minted at cachefile<n>}
+% \begin{macro}{\minted at addcachefilename,\minted at numcachefiles,\minted at cachefile<n>,\minted at cachechecksum,\mintedoldcachechecksum}
 % Track cache files that are used, so that unused files can be removed.
+%
+% The number of files is stored in a global macro rather than a counter to avoid counter scope issues.  For example, |\includeonly| tracks and resets counters.
+%
+% Also track the overall state of the cache using a sum of MD5 hashes of cache file names combined with the number of cache files.  When no new cache files are created, this is used in determining whether the cache should be cleaned.
 %    \begin{macrocode}
-\newcounter{minted at numcachefiles}
+\def\minted at numcachefiles{0}
 \def\minted at addcachefilename#1{%
   \ifbool{minted at canexec}%
-   {\stepcounter{minted at numcachefiles}%
-    \expandafter
-      \xdef\csname minted at cachefile\arabic{minted at numcachefiles}\endcsname{#1}}%
+   {\xdef\minted at numcachefiles{\the\numexpr\minted at numcachefiles+1\relax}%
+    \expandafter\xdef\csname minted at cachefile\minted at numcachefiles\endcsname{#1}%
+    \edef\minted at tmp{\pdf at mdfivesum{#1}}%
+    \expandafter\minted at cachechecksum@update\expandafter{\minted at tmp}}%
    {}}
+\let\minted at cachechecksum\relax
+\ifcsname mintedoldcachechecksum\endcsname
+\else
+  \let\mintedoldcachechecksum\relax
+\fi
+\edef\minted at cachechecksum@files{\pdf at mdfivesum{}}
+\expandafter\let\expandafter\minted at intfromhex\csname int_from_hex:n\endcsname
+\expandafter\let\expandafter\minted at inttoHex\csname int_to_Hex:n\endcsname
+\expandafter\let\expandafter\minted at intmod\csname int_mod:nn\endcsname
+\def\minted at intmodsixteen#1{\minted at intmod{#1}{16}}
+\def\minted at cachechecksum@update#1{%
+  \xdef\minted at cachechecksum@files{%
+    \expandafter\minted at cachechecksum@files at calc
+      \minted at cachechecksum@files\FV at Sentinel#1\FV at Sentinel}%
+  \xdef\minted at cachechecksum{%
+    \detokenize\expandafter{\minted at cachechecksum@files}%
+    \detokenize{:}%
+    \detokenize\expandafter{\minted at numcachefiles}}}
+\def\minted at cachechecksum@files at calc#1#2\FV at Sentinel#3#4\FV at Sentinel{%
+  \minted at inttoHex{%
+    \the\numexpr
+      \minted at intmodsixteen{\minted at intfromhex{#1}+\minted at intfromhex{#3}}%
+    \relax}%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\minted at cachechecksum@files at calc#2\FV at Sentinel#4\FV at Sentinel}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -3256,26 +3342,35 @@
 %
 % Only create a |.data.minted| file if there is a cache list to save.  Otherwise, no file is needed.
 %
-% Runs |\AfterEndDocument| so that all typesetting is complete, and thus the cache list is complete.  |\minted at fasthighlightmode@checkend| is placed within the same |\AfterEndDocument| to guarantee correct ordering.
+% Runs within the hook |enddocument/afterlastpage| so that all typesetting is complete, and thus the cache list is complete.  |\minted at fasthighlightmode@checkend| is included in the hook to guarantee correct ordering.
 %
 %    \begin{macrocode}
 \def\minted at clean{%
   \ifbool{minted at canexec}%
-   {\ifbool{minted at diddetectconfig}{\minted at clean@i}{}}%
+   {\ifbool{minted at didcreatefiles}%
+     {\minted at clean@i}%
+     {\ifbool{minted at fasthighlightmode}%
+       {\minted at clean@i}%
+       {\ifbool{minted at cache}%
+         {\ifx\minted at cachechecksum\mintedoldcachechecksum
+          \else
+            \expandafter\minted at clean@i
+          \fi}%
+         {}}}%
+    \ifbool{minted at fasthighlightmode}{}{\global\boolfalse{minted at canexec}}}%
    {}}
 \def\minted at clean@i{%
-  \ifnum\value{minted at numcachefiles}>0\relax
+  \ifnum\minted at numcachefiles>0\relax
     \expandafter\minted at savecachelist
   \fi
   \ifbool{minted at fasthighlightmode}%
    {}%
-   {\ifnum\value{minted at numcachefiles}>0\relax
+   {\ifnum\minted at numcachefiles>0\relax
       \expandafter\minted at exec@clean
     \else
       \expandafter\minted at exec@cleantemp
-    \fi
-    \global\boolfalse{minted at canexec}}%
-  \setcounter{minted at numcachefiles}{0}}
+    \fi}%
+  \gdef\minted at numcachefiles{0}}
 \def\minted at savecachelist{%
   \pydatasetfilename{\MintedDataFilename}%
   \minted at fasthighlightmode@checkstart
@@ -3288,7 +3383,7 @@
   \pydatawritemlvaluestart
   \pydatawritemlvalueline{[}%
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at numcachefiles}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at numcachefiles\relax
     \expandafter\minted at savecachelist@writecachefile\expandafter{%
       \csname minted at cachefile\arabic{minted at tmpcnt}\endcsname}%
     \expandafter\global\expandafter
@@ -3305,9 +3400,13 @@
 \gdef\minted at savecachelist@writecachefile#1{%
   \expandafter\pydatawritemlvalueline\expandafter{\expandafter"#1",}}
 \endgroup
-\AfterEndDocument{%
+\AddToHook{enddocument/afterlastpage}{%
   \minted at clean
-  \minted at fasthighlightmode@checkend}
+  \minted at fasthighlightmode@checkend
+  \ifbool{minted at cache}%
+   {\immediate\write\@auxout{%
+      \xdef\string\mintedoldcachechecksum{\string\detokenize{\minted at cachechecksum}}}}%
+   {}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -3483,6 +3582,7 @@
    {\pydataclosefilename{\MintedDataFilename}%
     \begingroup
     \minted at exec@styledef
+    \global\booltrue{minted at didcreatefiles}%
     \ifx\minted at exec@warning\relax
     \else
       \expandafter\minted at exec@warning
@@ -3642,7 +3742,7 @@
   \pydatabufferkey{code}%
   \pydatabuffermlvaluestart
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at tmpcodebufferlength\relax
     \expandafter\let\expandafter
       \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
     \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
@@ -3728,6 +3828,7 @@
    {\pydataclosefilename{\MintedDataFilename}%
     \begingroup
     \minted at exec@highlight
+    \global\booltrue{minted at didcreatefiles}%
     \IfFileExists{\minted at highlightfilepath}%
      {\ifx\minted at exec@warning\relax
       \else
@@ -3825,25 +3926,23 @@
 \endgroup
 \def\minted at iffasthighlightmode@buffertempfile at iv{%
   \begingroup
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \openin\minted at intempfile=\minted at inputfilepath
   \endlinechar=-1%
   \let\do\@makeother\FVExtraDoSpecials
   \loop\unless\ifeof\minted at intempfile
     \read\minted at intempfile to\minted at intempfileline
-    \stepcounter{minted at tmpcodebufferlength}%
+    \xdef\minted at tmpcodebufferlength{\the\numexpr\minted at tmpcodebufferlength+1\relax}%
     \expandafter\global\expandafter\let\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      minted at tmpcodebufferline\minted at tmpcodebufferlength
       \endcsname\minted at intempfileline
   \repeat
   \closein\minted at intempfile
   \expandafter\ifx\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
-      \endcsname\@empty
+      minted at tmpcodebufferline\minted at tmpcodebufferlength\endcsname\@empty
     \expandafter\global\expandafter\let\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
-      \endcsname\minted at undefined
-    \addtocounter{minted at tmpcodebufferlength}{-1}%
+      minted at tmpcodebufferline\minted at tmpcodebufferlength\endcsname\minted at undefined
+    \xdef\minted at tmpcodebufferlength{\the\numexpr\minted at tmpcodebufferlength-1\relax}%
   \fi
   \endgroup
   \edef\minted at inputfilemdfivesum@check{\pdf at filemdfivesum{\minted at inputfilepath}}%
@@ -3853,7 +3952,7 @@
     \expandafter\@firstofone
   \fi
    {\VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}%
-  \ifnum\value{minted at tmpcodebufferlength}>0\relax
+  \ifnum\minted at tmpcodebufferlength>0\relax
     \expandafter\@firstofone
   \else
     \expandafter\@gobble
@@ -3863,7 +3962,7 @@
   \pydatabufferkey{code}%
   \pydatabuffermlvaluestart
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at tmpcodebufferlength\relax
     \expandafter\let\expandafter
       \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
     \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
@@ -3943,10 +4042,10 @@
      \FVExtraRetokenizeVArg{\RobustMintInlineProcess at highlight@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintInlineProcess at highlight@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \let\minted at highlight@fallback\RobustMintInlineProcess at highlight@fallback
   \minted at highlight
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \def\RobustMintInlineProcess at highlight@fallback{%
   \minted at useadditionalfvoptsnopy
@@ -4002,10 +4101,10 @@
     \FVExtraRetokenizeVArg{\RobustMintProcess at highlight@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintProcess at highlight@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \let\minted at highlight@fallback\RobustMintProcess at highlight@fallback
   \minted at highlight
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \def\RobustMintProcess at highlight@fallback{%
   \minted at useadditionalfvoptsnopy
@@ -4024,10 +4123,10 @@
     \FVExtraRetokenizeVArg{\RobustMintProcess at verbatim@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintProcess at verbatim@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \minted at codewrapper{%
     \VerbatimInsertBuffer[buffername=minted at tmpcodebuffer,insertenvname=\minted at envname]}%
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \ifbool{minted at placeholder}%
  {\let\RobustMintProcess\RobustMintProcess at placeholder}%

Modified: trunk/Master/texmf-dist/tex/latex/minted/minted.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2024-10-30 20:02:16 UTC (rev 72708)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2024-10-30 20:02:30 UTC (rev 72709)
@@ -26,11 +26,11 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{minted}
-    [2024/10/07 v3.1.2 Yet another Pygments shim for LaTeX]
+    [2024/10/29 v3.2.0 Yet another Pygments shim for LaTeX]
 \RequirePackage{catchfile}
 \RequirePackage{etoolbox}
-\RequirePackage{fvextra}[2024/09/05]
-\RequirePackage{latex2pydata}[2024/05/16]
+\RequirePackage{fvextra}[2024/10/16]
+\RequirePackage{latex2pydata}[2024/10/16]
 \RequirePackage{pdftexcmds}
 \RequirePackage{pgfkeys}
 \RequirePackage{pgfopts}
@@ -374,7 +374,7 @@
 \def\minted at ifalphanumhyphenunderscore@false#1\FV at Sentinel#2#3{#3}
 \let\minted at lexer\@empty
 \newbool{minted at isinline}
-\newcounter{minted at tmpcodebufferlength}
+\def\minted at tmpcodebufferlength{0}
 \newbool{minted at canexec}
 \booltrue{minted at canexec}
 \ifnum\csname c_sys_shell_escape_int\endcsname=0\relax
@@ -384,10 +384,20 @@
 \ifbool{minted at placeholder}{\boolfalse{minted at canexec}}{}
 \ifbool{minted at verbatim}{\boolfalse{minted at canexec}}{}
 \def\minted at ShellEscapeMaybeMessages#1{%
+  \ifbool{minted at debug}%
+   {\immediate\typeout{%
+      minted debug: shell escape at
+      \ifx\CurrentFile\@empty\else\CurrentFile\space\fi line \the\inputlineno: #1}}%
+   {}%
   \let\minted at exec@warning\relax
   \let\minted at exec@error\relax
   \ifbool{minted at canexec}{\ShellEscape{#1}\minted at inputexecmessages}{}}
 \def\minted at ShellEscapeNoMessages#1{%
+  \ifbool{minted at debug}%
+   {\immediate\typeout{%
+      minted debug: shell escape at
+      \ifx\CurrentFile\@empty\else\CurrentFile\space\fi line \the\inputlineno: #1}}%
+   {}%
   \ifbool{minted at canexec}{\ShellEscape{#1}}{}}
 \def\minted at execarg@debug{%
   \ifbool{minted at debug}{\detokenize{ --debug }}{}}
@@ -457,18 +467,27 @@
   \minted at ensureatletter{%
     \InputIfFileExists{\MintedConfigFilename}{}{}}%
   \ifx\minted at executable@version\relax
-    \expandafter\minted at detectconfig@noexecutable
+    \expandafter\minted at detectconfig@noexecutableorerrlog
   \else
     \expandafter\minted at detectconfig@ii
   \fi}
-\def\minted at detectconfig@noexecutable{%
+\def\minted at detectconfig@noexecutableorerrlog{%
   \global\boolfalse{minted at canexec}%
   \ifnum\csname c_sys_shell_escape_int\endcsname=1\relax
-    \minted at error{minted v3+ executable is not installed or is not added to PATH}%
+    \expandafter\@firstofttwo
   \else
-    \minted at error{minted v3+ executable is not installed, is not added to PATH,
-      or is not permitted with restricted shell escape}%
-  \fi}
+    \expandafter\@secondoftwo
+  \fi
+   {\IfFileExists{\MintedErrlogFilename}%
+     {\minted at error{minted v3+ executable is not installed or is not added to PATH,
+        or there was an unexpected error (check "\MintedErrlogFilename")}}%
+     {\minted at error{minted v3+ executable is not installed or is not added to PATH}}}%
+   {\IfFileExists{\MintedErrlogFilename}%
+     {\minted at error{minted v3+ executable is not installed, is not added to PATH,
+        or is not permitted with restricted shell escape;
+        or there was an unexpected error (check "\MintedErrlogFilename")}}%
+     {\minted at error{minted v3+ executable is not installed, is not added to PATH,
+        or is not permitted with restricted shell escape}}}}
 \def\minted at detectconfig@ii{%
   \ifx\minted at timestamp\minted at config@timestamp
     \expandafter\minted at detectconfig@iii
@@ -483,7 +502,7 @@
       upgrade to TeX distribution that supports \detokenize{TEXMF_OUTPUT_DIRECTORY}
       or set environment variable \detokenize{TEXMF_OUTPUT_DIRECTORY} manually)}%
   \else
-    \expandafter\minted at detectconfig@noexecutable
+    \expandafter\minted at detectconfig@noexecutableorerrlog
   \fi}
 \def\minted at detectconfig@iii{%
   \minted at exec@cleanconfig
@@ -956,6 +975,13 @@
 \mintedpgfkeyscreate{py}{
   autogobble<true>=false,
   encoding=utf8,
+  extrakeywords=,
+  extrakeywordsconstant=,
+  extrakeywordsdeclaration=,
+  extrakeywordsnamespace=,
+  extrakeywordspseudo=,
+  extrakeywordsreserved=,
+  extrakeywordstype=,
   funcnamehighlighting<true>=true,
   gobble=0,
   gobblefilter=0,
@@ -1018,30 +1044,70 @@
 \providecommand{\minted at def@optcl}[4][]{%
   \minted at warning{Macro \string\minted at def@optcl\space is deprecated with minted v3
     and no longer has any effect}}
-\newcounter{minted at numcachefiles}
+\newbool{minted at didcreatefiles}
+\def\minted at numcachefiles{0}
 \def\minted at addcachefilename#1{%
   \ifbool{minted at canexec}%
-   {\stepcounter{minted at numcachefiles}%
-    \expandafter
-      \xdef\csname minted at cachefile\arabic{minted at numcachefiles}\endcsname{#1}}%
+   {\xdef\minted at numcachefiles{\the\numexpr\minted at numcachefiles+1\relax}%
+    \expandafter\xdef\csname minted at cachefile\minted at numcachefiles\endcsname{#1}%
+    \edef\minted at tmp{\pdf at mdfivesum{#1}}%
+    \expandafter\minted at cachechecksum@update\expandafter{\minted at tmp}}%
    {}}
+\let\minted at cachechecksum\relax
+\ifcsname mintedoldcachechecksum\endcsname
+\else
+  \let\mintedoldcachechecksum\relax
+\fi
+\edef\minted at cachechecksum@files{\pdf at mdfivesum{}}
+\expandafter\let\expandafter\minted at intfromhex\csname int_from_hex:n\endcsname
+\expandafter\let\expandafter\minted at inttoHex\csname int_to_Hex:n\endcsname
+\expandafter\let\expandafter\minted at intmod\csname int_mod:nn\endcsname
+\def\minted at intmodsixteen#1{\minted at intmod{#1}{16}}
+\def\minted at cachechecksum@update#1{%
+  \xdef\minted at cachechecksum@files{%
+    \expandafter\minted at cachechecksum@files at calc
+      \minted at cachechecksum@files\FV at Sentinel#1\FV at Sentinel}%
+  \xdef\minted at cachechecksum{%
+    \detokenize\expandafter{\minted at cachechecksum@files}%
+    \detokenize{:}%
+    \detokenize\expandafter{\minted at numcachefiles}}}
+\def\minted at cachechecksum@files at calc#1#2\FV at Sentinel#3#4\FV at Sentinel{%
+  \minted at inttoHex{%
+    \the\numexpr
+      \minted at intmodsixteen{\minted at intfromhex{#1}+\minted at intfromhex{#3}}%
+    \relax}%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\minted at cachechecksum@files at calc#2\FV at Sentinel#4\FV at Sentinel}}
 \def\minted at clean{%
   \ifbool{minted at canexec}%
-   {\ifbool{minted at diddetectconfig}{\minted at clean@i}{}}%
+   {\ifbool{minted at didcreatefiles}%
+     {\minted at clean@i}%
+     {\ifbool{minted at fasthighlightmode}%
+       {\minted at clean@i}%
+       {\ifbool{minted at cache}%
+         {\ifx\minted at cachechecksum\mintedoldcachechecksum
+          \else
+            \expandafter\minted at clean@i
+          \fi}%
+         {}}}%
+    \ifbool{minted at fasthighlightmode}{}{\global\boolfalse{minted at canexec}}}%
    {}}
 \def\minted at clean@i{%
-  \ifnum\value{minted at numcachefiles}>0\relax
+  \ifnum\minted at numcachefiles>0\relax
     \expandafter\minted at savecachelist
   \fi
   \ifbool{minted at fasthighlightmode}%
    {}%
-   {\ifnum\value{minted at numcachefiles}>0\relax
+   {\ifnum\minted at numcachefiles>0\relax
       \expandafter\minted at exec@clean
     \else
       \expandafter\minted at exec@cleantemp
-    \fi
-    \global\boolfalse{minted at canexec}}%
-  \setcounter{minted at numcachefiles}{0}}
+    \fi}%
+  \gdef\minted at numcachefiles{0}}
 \def\minted at savecachelist{%
   \pydatasetfilename{\MintedDataFilename}%
   \minted at fasthighlightmode@checkstart
@@ -1054,7 +1120,7 @@
   \pydatawritemlvaluestart
   \pydatawritemlvalueline{[}%
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at numcachefiles}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at numcachefiles\relax
     \expandafter\minted at savecachelist@writecachefile\expandafter{%
       \csname minted at cachefile\arabic{minted at tmpcnt}\endcsname}%
     \expandafter\global\expandafter
@@ -1071,9 +1137,13 @@
 \gdef\minted at savecachelist@writecachefile#1{%
   \expandafter\pydatawritemlvalueline\expandafter{\expandafter"#1",}}
 \endgroup
-\AfterEndDocument{%
+\AddToHook{enddocument/afterlastpage}{%
   \minted at clean
-  \minted at fasthighlightmode@checkend}
+  \minted at fasthighlightmode@checkend
+  \ifbool{minted at cache}%
+   {\immediate\write\@auxout{%
+      \xdef\string\mintedoldcachechecksum{\string\detokenize{\minted at cachechecksum}}}}%
+   {}}
 \def\minted at patch@PygmentsZsq{%
   \ifcsname\minted at styleprefix Zsq\endcsname
     \ifcsstring{\minted at styleprefix Zsq}{\char`\'}{\minted at patch@PygmentsZsq at i}{}%
@@ -1201,6 +1271,7 @@
    {\pydataclosefilename{\MintedDataFilename}%
     \begingroup
     \minted at exec@styledef
+    \global\booltrue{minted at didcreatefiles}%
     \ifx\minted at exec@warning\relax
     \else
       \expandafter\minted at exec@warning
@@ -1310,7 +1381,7 @@
   \pydatabufferkey{code}%
   \pydatabuffermlvaluestart
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at tmpcodebufferlength\relax
     \expandafter\let\expandafter
       \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
     \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
@@ -1396,6 +1467,7 @@
    {\pydataclosefilename{\MintedDataFilename}%
     \begingroup
     \minted at exec@highlight
+    \global\booltrue{minted at didcreatefiles}%
     \IfFileExists{\minted at highlightfilepath}%
      {\ifx\minted at exec@warning\relax
       \else
@@ -1482,25 +1554,23 @@
 \endgroup
 \def\minted at iffasthighlightmode@buffertempfile at iv{%
   \begingroup
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \openin\minted at intempfile=\minted at inputfilepath
   \endlinechar=-1%
   \let\do\@makeother\FVExtraDoSpecials
   \loop\unless\ifeof\minted at intempfile
     \read\minted at intempfile to\minted at intempfileline
-    \stepcounter{minted at tmpcodebufferlength}%
+    \xdef\minted at tmpcodebufferlength{\the\numexpr\minted at tmpcodebufferlength+1\relax}%
     \expandafter\global\expandafter\let\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      minted at tmpcodebufferline\minted at tmpcodebufferlength
       \endcsname\minted at intempfileline
   \repeat
   \closein\minted at intempfile
   \expandafter\ifx\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
-      \endcsname\@empty
+      minted at tmpcodebufferline\minted at tmpcodebufferlength\endcsname\@empty
     \expandafter\global\expandafter\let\csname
-      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
-      \endcsname\minted at undefined
-    \addtocounter{minted at tmpcodebufferlength}{-1}%
+      minted at tmpcodebufferline\minted at tmpcodebufferlength\endcsname\minted at undefined
+    \xdef\minted at tmpcodebufferlength{\the\numexpr\minted at tmpcodebufferlength-1\relax}%
   \fi
   \endgroup
   \edef\minted at inputfilemdfivesum@check{\pdf at filemdfivesum{\minted at inputfilepath}}%
@@ -1510,7 +1580,7 @@
     \expandafter\@firstofone
   \fi
    {\VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}%
-  \ifnum\value{minted at tmpcodebufferlength}>0\relax
+  \ifnum\minted at tmpcodebufferlength>0\relax
     \expandafter\@firstofone
   \else
     \expandafter\@gobble
@@ -1520,7 +1590,7 @@
   \pydatabufferkey{code}%
   \pydatabuffermlvaluestart
   \setcounter{minted at tmpcnt}{1}%
-  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+  \loop\unless\ifnum\value{minted at tmpcnt}>\minted at tmpcodebufferlength\relax
     \expandafter\let\expandafter
       \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
     \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
@@ -1564,10 +1634,10 @@
      \FVExtraRetokenizeVArg{\RobustMintInlineProcess at highlight@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintInlineProcess at highlight@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \let\minted at highlight@fallback\RobustMintInlineProcess at highlight@fallback
   \minted at highlight
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \def\RobustMintInlineProcess at highlight@fallback{%
   \minted at useadditionalfvoptsnopy
@@ -1616,10 +1686,10 @@
     \FVExtraRetokenizeVArg{\RobustMintProcess at highlight@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintProcess at highlight@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \let\minted at highlight@fallback\RobustMintProcess at highlight@fallback
   \minted at highlight
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \def\RobustMintProcess at highlight@fallback{%
   \minted at useadditionalfvoptsnopy
@@ -1638,10 +1708,10 @@
     \FVExtraRetokenizeVArg{\RobustMintProcess at verbatim@i}{\FV at CatCodes}}{#3}}
 \def\RobustMintProcess at verbatim@i#1{%
   \expandafter\def\csname minted at tmpcodebufferline1\endcsname{#1}%
-  \setcounter{minted at tmpcodebufferlength}{1}%
+  \gdef\minted at tmpcodebufferlength{1}%
   \minted at codewrapper{%
     \VerbatimInsertBuffer[buffername=minted at tmpcodebuffer,insertenvname=\minted at envname]}%
-  \setcounter{minted at tmpcodebufferlength}{0}%
+  \gdef\minted at tmpcodebufferlength{0}%
   \endgroup}
 \ifbool{minted at placeholder}%
  {\let\RobustMintProcess\RobustMintProcess at placeholder}%



More information about the tex-live-commits mailing list.