Ascolta «Grazie al Podcast»: il Podcast del NoWhereBlog!

Thursday, June 26, 2014

Wednesday, June 25, 2014

Tuesday, June 24, 2014

Monday, June 23, 2014

Saturday, June 21, 2014

Friday, June 20, 2014

texliveonfly won’t escalate privileges on Mac OS X

texliveonfly is a simple python script that emulates the behavior of MiKTeX on TeXLive; that is, it automatically downloads missing TeX packages from CTAN. AFAIR the MiKTeX guys actually hooked into the package resolution routines triggering a prompt when the package is missing, while, if I’ve understood correctly, this script executes a compilation and traces the output of the compilation. It is not 100% perfect, but it works most of the times, so it is really, really useful. It works as a drop-in replacement for pdflatex so you just write

texliveonlyfly my-latex-file.tex

where you would have written pdflatex my-latex-file.tex (the name is unfortunate since it’s long and it has the same texl- prefix of many other scripts, but you can fix that with an alias or a symlink).

The script should try and escalate privileges, prompting for your root password when it install the new packages. However, this is currently not working on OS X 10.9. Since the author “Saitulaa Naranong” notes that he was using Ubuntu at the time, I wonder if the script were tested under OS X at all. This is not a critique. The script is cool. You just have to prepend sudo to make certain that the packages will be actually downloaded.

Anyway, I’ve been able to isolate the bug to line 95 of the script:

elif os.name == "mac":

this won’t work because current Python version on my Mac is returning posix (which is actually technically correct — of course, the best kind of correct). The line should actually read:

elif platform.system() == 'Darwin':

provided that at line 37 you make sure to import platform as well:

import re, subprocess, platform, os, time,  optparse, sys, shlex

I’m publishing here the patch I did on the original CTAN package. On my machine, the script is found at:

/usr/texbin/texliveonfly

just do a which texliveonfly to find where yours is located. I would contribute back the changes but unfortunately I don’t know how to contact the maintainer.

Here’s the diff

Categories

Archives

Blogroll

Last 10 entries

Admin area