[tex-live] Feature requests tlmgr

Pander pander at users.sourceforge.net
Tue Nov 16 16:19:43 CET 2010


On 2010-11-16 16:12, Adam R. Maxwell wrote:
> 
> On Nov 16, 2010, at 07:03 , Pander wrote:
> 
>> Thaks but it still needs some extra installs:
> 
> No, I intended you to to read it instead of blindly executing it.
> The missing modules are all Mac OS X components, which I use for
> displaying an alert and doing IPC with my application.  Here's a
> minimal version (untested). 

Thanks. Perhaps we can merge all into one python script that will do
dynamic imports so it support multiple platforms.

I have some code for server installations that will send email, in stead
of doing a popup.

So we have:
- Mac GUI
- Debian/Ubuntu GUI via zenity
- Debian/Ubuntu server via email
- Windows ???

> #!/usr/bin/env python
> 
> from subprocess import Popen, PIPE
> import os, sys
> 
> def check_for_updates():
>     
>     texbin_path = "/usr/local/bin"
>         
>     cmd = [os.path.join(texbin_path, "tlmgr"), "update", "--list", "--machine-readable"]
>         
>     tlmgr = Popen(cmd, stdout=PIPE, universal_newlines=True)
>     (stdout, stderr) = tlmgr.communicate()
>     
>     output = "".join([c for c in stdout])
>     is_list_line = False
>     count = 0
>     actual_location = None
>     for line in output.split("\n"):
>         
>         if line == "end-of-header":
>             is_list_line = True
>         elif line == "end-of-updates":
>             is_list_line = False
>         elif is_list_line:
>             comps = line.split()
>             #
>             # d = deleted on server
>             # u = updated on server
>             # a = added on server
>             # f = forcibly removed
>             # r = reverse update
>             #
>             
>             # ignore anything that's not an update or addition
>             if len(comps) >= 2 and comps[1] in ("a", "u"):
>                 count += 1
>         elif line.startswith("location-url"):
>             actual_location = line.strip().split()[-1]
>     
>     return count, actual_location
> 
> if __name__ == '__main__':
>     
>     count, actual_location = check_for_updates()
> 



More information about the tex-live mailing list