#!/usr/bin/env python """ a workflow for installing ubuntu packages: - get list of current executables (requires: lsex.py) - fire up: - synaptic - ubuntu package metadata editor - python package metadata editor (?) - get """ import optparse import os import sys here = os.path.dirname(os.path.realpath(__file__)) # @requires('lsex') import lsex # TODO: # - package lsex.py # - solve the probem where one (python) resource is wanted in one manner # (for lsex.py, in `python/` in http://k0s.org/hg/config ) # but is also needed as a setup.py dependency # (in this case, for this script once it is packaged and which, in fact, # blocks this admittedly incomplete script from being packaged) # - or define a workflow whereby this problem does not happen # - [META] talk about this in a forum for (python) packaging workflow patterns # - [META] keywords: # - META # - TODO # - IDEA # - SEE ALSO # the big idea being that you have a state (memory, a graph), a new # association occurs (time moves forward), what responses are possible? # keywords classify these. # - of course, a number of these are possible for any association # (transition), including those of the same type # SEE ALSO: hmtl2flux def compare_executables(callback, path=None): """ compare executables before and after firing a callback. returns 2-tuple of (added_executables, removed_executables) - callbacK: a callable taking no arguments - path: list or PATH-style string of directories to search. if not specified, use system PATH """ before = set(lsex.lsex(path)) callback() after = set(lsex.lsex(path)) new = after.difference(before) removed = before.difference(after) return (new, removed) def main(args=sys.argv[1:]): usage = '%prog [options]' parser = optparse.OptionParser(usage=usage, description=__doc__) options, args = options.parse_args(args) if __name__ == '__main__': main()