TeX Live housekeeping

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TeX Live housekeeping

Edd Barrett-3
Hi,

This isn't very exciting, but I wanted to get it out of the way before I
start looking at TL 2019.

 * Port all Python scripts to Python 3 and invoke them via #!
 * Fix a generated CVS tag.
 * Add a missing make dep.

OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- Makefile 10 Feb 2019 18:14:36 -0000 1.57
+++ Makefile 17 May 2019 11:21:20 -0000
@@ -169,11 +169,10 @@ plist: fake
  env WRKINST=${WRKINST} TRUEPREFIX=${TRUEPREFIX} ${MODPY_BIN} \
  ${FILESDIR}/update_plist_hints.py \
  ${WRKDIR}/texlive.tlpdb | \
- ${MODPY_BIN} ${FILESDIR}/write_plists.py
+ ${FILESDIR}/write_plists.py
 
 # regenerate adj.mk
-adj:
- ${MODPY_BIN} ${FILESDIR}/mk_adj.py ${WRKSRC}/texmf-dist \
- ${WRKSRC} > adj.mk
+adj: patch
+ ${FILESDIR}/mk_adj.py ${WRKSRC}/texmf-dist ${WRKSRC} > adj.mk
 
 .include <bsd.port.mk>
Index: files/mk_adj.py
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/files/mk_adj.py,v
retrieving revision 1.1
diff -u -p -r1.1 mk_adj.py
--- files/mk_adj.py 30 Jan 2018 20:35:52 -0000 1.1
+++ files/mk_adj.py 17 May 2019 12:59:53 -0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
 """
 Generate adj.mk.
 
@@ -62,14 +62,14 @@ def process_file(dirpath, filename, subs
     stripped_path = os.path.relpath(path, strip_prefix)
 
     try:
-        fh = open(path)
+        fh = open(path, "rb")
     except IOError:
         # ignore broken symlinks
         if os.path.islink(path):
             return
         raise
 
-    line1 = fh.readline().strip()
+    line1 = fh.readline().strip().decode(errors='ignore')
     fh.close()
 
     # There are some `.in` files with placeholder shebangs, ignore.
@@ -121,11 +121,11 @@ def main(root_dir, strip_prefix):
             except UnknownInterpreterError as e:
                 unknown_interp_files.append(e.args)
 
-    print("# $OpenBSD: mk_adj.py,v 1.1 2018/01/30 20:35:52 edd Exp $")
+    print("# $OpenBSD$")
     print("#")
     print("# This file is automatically generated. Do not edit.\n")
 
-    for subst_var, paths in sorted(substs.iteritems(), key=lambda t: t[0]):
+    for subst_var, paths in sorted(substs.items(), key=lambda t: t[0]):
         joined_paths = " \\\n\t".join(sorted(paths))
         print("\n%s += \\\n\t%s" % (subst_var, joined_paths))
 
Index: files/tlpdb.py
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/files/tlpdb.py,v
retrieving revision 1.2
diff -u -p -r1.2 tlpdb.py
--- files/tlpdb.py 20 Jan 2019 11:17:49 -0000 1.2
+++ files/tlpdb.py 17 May 2019 11:01:38 -0000
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
 # $OpenBSD: tlpdb.py,v 1.2 2019/01/20 11:17:49 edd Exp $
 """Lightweight TeX Live TLPDB parser."""
 
Index: files/update_plist_hints.py
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/files/update_plist_hints.py,v
retrieving revision 1.2
diff -u -p -r1.2 update_plist_hints.py
--- files/update_plist_hints.py 20 Jan 2019 11:17:49 -0000 1.2
+++ files/update_plist_hints.py 17 May 2019 11:00:31 -0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
 """
 Output update-plist(1) hints for which files go into which PLIST.
 
Index: files/which_subset.py
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/files/which_subset.py,v
retrieving revision 1.1
diff -u -p -r1.1 which_subset.py
--- files/which_subset.py 11 Apr 2018 13:40:32 -0000 1.1
+++ files/which_subset.py 17 May 2019 11:04:15 -0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.6
+#!/usr/bin/env python3
 """
 Prints the dependencies of a TeX document in terms of OpenBSD packing lists.
 
Index: files/write_plists.py
===================================================================
RCS file: /cvs/ports/print/texlive/texmf/files/write_plists.py,v
retrieving revision 1.1
diff -u -p -r1.1 write_plists.py
--- files/write_plists.py 11 Sep 2018 21:32:28 -0000 1.1
+++ files/write_plists.py 17 May 2019 13:00:01 -0000
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
 # $OpenBSD: write_plists.py,v 1.1 2018/09/11 21:32:28 edd Exp $
 """
 Write PLISTs based on the output of update_plist_hints.py.
@@ -125,7 +126,7 @@ def main():
         dir_ents[plist].update(dir_entries(filename, EXISTING_DIRS))
         all_files[plist].add(filename)
 
-    for plist, files in all_files.iteritems():
+    for plist, files in all_files.items():
         fh = plist_map[plist]
 
         for fl in sorted(files.union(dir_ents[plist])):

--
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply | Threaded
Open this post in threaded view
|

Re: TeX Live housekeeping

Steven Mestdagh-3
Edd Barrett [2019-05-18, 14:30:12]:
> Hi,
>
> This isn't very exciting, but I wanted to get it out of the way before I
> start looking at TL 2019.
>
>  * Port all Python scripts to Python 3 and invoke them via #!
>  * Fix a generated CVS tag.

CVS will just regenerate it again, if you want to avoid it you probably
want to tweak the code a bit.

>  * Add a missing make dep.
>
> OK?
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/Makefile,v
> retrieving revision 1.57
> diff -u -p -r1.57 Makefile
> --- Makefile 10 Feb 2019 18:14:36 -0000 1.57
> +++ Makefile 17 May 2019 11:21:20 -0000
> @@ -169,11 +169,10 @@ plist: fake
>   env WRKINST=${WRKINST} TRUEPREFIX=${TRUEPREFIX} ${MODPY_BIN} \
>   ${FILESDIR}/update_plist_hints.py \
>   ${WRKDIR}/texlive.tlpdb | \
> - ${MODPY_BIN} ${FILESDIR}/write_plists.py
> + ${FILESDIR}/write_plists.py
>  
>  # regenerate adj.mk
> -adj:
> - ${MODPY_BIN} ${FILESDIR}/mk_adj.py ${WRKSRC}/texmf-dist \
> - ${WRKSRC} > adj.mk
> +adj: patch
> + ${FILESDIR}/mk_adj.py ${WRKSRC}/texmf-dist ${WRKSRC} > adj.mk
>  
>  .include <bsd.port.mk>
> Index: files/mk_adj.py
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/files/mk_adj.py,v
> retrieving revision 1.1
> diff -u -p -r1.1 mk_adj.py
> --- files/mk_adj.py 30 Jan 2018 20:35:52 -0000 1.1
> +++ files/mk_adj.py 17 May 2019 12:59:53 -0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python2.7
> +#!/usr/bin/env python3
>  """
>  Generate adj.mk.
>  
> @@ -62,14 +62,14 @@ def process_file(dirpath, filename, subs
>      stripped_path = os.path.relpath(path, strip_prefix)
>  
>      try:
> -        fh = open(path)
> +        fh = open(path, "rb")
>      except IOError:
>          # ignore broken symlinks
>          if os.path.islink(path):
>              return
>          raise
>  
> -    line1 = fh.readline().strip()
> +    line1 = fh.readline().strip().decode(errors='ignore')
>      fh.close()
>  
>      # There are some `.in` files with placeholder shebangs, ignore.
> @@ -121,11 +121,11 @@ def main(root_dir, strip_prefix):
>              except UnknownInterpreterError as e:
>                  unknown_interp_files.append(e.args)
>  
> -    print("# $OpenBSD: mk_adj.py,v 1.1 2018/01/30 20:35:52 edd Exp $")
> +    print("# $OpenBSD$")
>      print("#")
>      print("# This file is automatically generated. Do not edit.\n")
>  
> -    for subst_var, paths in sorted(substs.iteritems(), key=lambda t: t[0]):
> +    for subst_var, paths in sorted(substs.items(), key=lambda t: t[0]):
>          joined_paths = " \\\n\t".join(sorted(paths))
>          print("\n%s += \\\n\t%s" % (subst_var, joined_paths))
>  
> Index: files/tlpdb.py
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/files/tlpdb.py,v
> retrieving revision 1.2
> diff -u -p -r1.2 tlpdb.py
> --- files/tlpdb.py 20 Jan 2019 11:17:49 -0000 1.2
> +++ files/tlpdb.py 17 May 2019 11:01:38 -0000
> @@ -1,3 +1,4 @@
> +#!/usr/bin/env python3
>  # $OpenBSD: tlpdb.py,v 1.2 2019/01/20 11:17:49 edd Exp $
>  """Lightweight TeX Live TLPDB parser."""
>  
> Index: files/update_plist_hints.py
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/files/update_plist_hints.py,v
> retrieving revision 1.2
> diff -u -p -r1.2 update_plist_hints.py
> --- files/update_plist_hints.py 20 Jan 2019 11:17:49 -0000 1.2
> +++ files/update_plist_hints.py 17 May 2019 11:00:31 -0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python2.7
> +#!/usr/bin/env python3
>  """
>  Output update-plist(1) hints for which files go into which PLIST.
>  
> Index: files/which_subset.py
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/files/which_subset.py,v
> retrieving revision 1.1
> diff -u -p -r1.1 which_subset.py
> --- files/which_subset.py 11 Apr 2018 13:40:32 -0000 1.1
> +++ files/which_subset.py 17 May 2019 11:04:15 -0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python3.6
> +#!/usr/bin/env python3
>  """
>  Prints the dependencies of a TeX document in terms of OpenBSD packing lists.
>  
> Index: files/write_plists.py
> ===================================================================
> RCS file: /cvs/ports/print/texlive/texmf/files/write_plists.py,v
> retrieving revision 1.1
> diff -u -p -r1.1 write_plists.py
> --- files/write_plists.py 11 Sep 2018 21:32:28 -0000 1.1
> +++ files/write_plists.py 17 May 2019 13:00:01 -0000
> @@ -1,3 +1,4 @@
> +#!/usr/bin/env python3
>  # $OpenBSD: write_plists.py,v 1.1 2018/09/11 21:32:28 edd Exp $
>  """
>  Write PLISTs based on the output of update_plist_hints.py.
> @@ -125,7 +126,7 @@ def main():
>          dir_ents[plist].update(dir_entries(filename, EXISTING_DIRS))
>          all_files[plist].add(filename)
>  
> -    for plist, files in all_files.iteritems():
> +    for plist, files in all_files.items():
>          fh = plist_map[plist]
>  
>          for fl in sorted(files.union(dir_ents[plist])):
>
> --
> Best Regards
> Edd Barrett
>
> http://www.theunixzoo.co.uk
>

Reply | Threaded
Open this post in threaded view
|

Re: TeX Live housekeeping

Edd Barrett-3
Hi Steven,

On Sat, May 18, 2019 at 04:04:39PM +0200, Steven Mestdagh wrote:
> CVS will just regenerate it again, if you want to avoid it you probably
> want to tweak the code a bit.

Yep, that's fine. I'm expecting CVS to re-write the tag, but what I
objected to was the script writing a tag for a file called "mk_adj.py"
to a file called "adj.mk".

Now I just write a generic "$OpenBSD$" and let CVS do it's thing.

Would you be willing to OK?

--
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply | Threaded
Open this post in threaded view
|

Re: TeX Live housekeeping

Edd Barrett-3
On Sun, May 19, 2019 at 03:14:48PM +0100, Edd Barrett wrote:
> Would you be willing to OK?

Anyone?

--
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk