[tex-live] Feature requests tlmgr
Adam R. Maxwell
amaxwell at mac.com
Tue Nov 16 16:12:00 CET 2010
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).
#!/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