booman.command
index
booman/command.py

# Boodler: a programmable soundscape tool
# Copyright 2007-2011 by Andrew Plotkin <erkyrath@eblong.com>
#   <http://boodler.org/>
# This program is distributed under the LGPL.
# See the LGPL document, or the above URL, for details.

 
Modules
       
codecs
boopak.collect
booman.create
booman.frame
os
boopak.pinfo
sys
time
booman.token
boopak.version
zipfile

 
Classes
       
Command
ContentsCmd
CreateCmd
DeleteAllCmd
DeleteCmd
DescribeCmd
ExamineCmd
HelpCmd
InstallCmd
LastErrorCmd
ListAllCmd
ListCmd
ObsoleteCmd
QuitCmd
ReloadCmd
RequiresCmd
VersionsCmd
booman.token.Token
CommandToken

 
class Command
    Command: represents a possible command. Each subclass of Command
represents one command (QuitCmdHelpCmd, etc).
 
Class fields:
 
name -- the basic command word
synonyms -- a list of alternate words which are accepted for the command
description -- one-line description of the command
help -- more detailed help for the command
 
Methods:
 
perform() -- carry out the command
assert_done() -- ensure that the input has been exhausted
 
  Methods defined here:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)
perform(self, source)
perform(source) -> None
 
Carry out the command. Each Command subclass must override this.

Data and other attributes defined here:
description = '<unknown>'
help = None
name = '<unknown>'
synonyms = []

 
class CommandToken(booman.token.Token)
    CommandToken: a Token which grabs one of the command words.
 
Returns the Command subclass corresponding to the command. (A class
object, not an instance of it.)
 
Class field:
 
verb_map -- a dict mapping words to Command subclasses.
 
  Methods defined here:
__init__(self)
accept(self, source)

Data and other attributes defined here:
verb_map = None

Data and other attributes inherited from booman.token.Token:
prompt = ''

 
class ContentsCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List the resources in a package'
help = '\n"contents PACKAGE"\n"contents PACKAGE VERSION"\n"... file on disk,\nor a URL to download and inspect.\n'
name = 'contents'
synonyms = ['resources']

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

 
class CreateCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Create a package file from a directory'
help = '\n"create DIRECTORY"\n"create DIRECTORY DESTFILE"\n...aging up a soundscape that you created yourself.\n'
name = 'create'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class DeleteAllCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Delete your entire collection (all packages)'
help = '\nDelete every package in your collection.\n'
name = 'deleteall'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class DeleteCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Delete a package from your collection'
help = '\n"delete PACKAGE"\nDelete a package from your col...cular version of a package from your collection.\n'
name = 'delete'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class DescribeCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List the metadata of a package'
help = '\n"describe PACKAGE"\n"describe PACKAGE VERSION"\n\n...ecent\nversion of the package you have installed.\n'
name = 'describe'
synonyms = ['metadata']

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

 
class ExamineCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Examine a resource in a package'
name = 'examine'
synonyms = ['x']

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
help = None

 
class HelpCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Show this list'
help = '\n"help"\nList all available commands. \n\n"help COMMAND"\nShow some help on the given command.\n'
name = 'help'
synonyms = ['?']

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

 
class InstallCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Install a package into your collection'
help = '\n"install URL"\nDownload a package from that URL,...N"\nInstall a package from the Boodler web site. \n'
name = 'install'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class LastErrorCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Display a debugging trace of the most recent error'
help = '\nDisplay a full Python stack trace of the last e...red. This\nexists to aid debugging of boodle-mgr.\n'
name = 'lasterror'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class ListAllCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List all the packages installed, including versions'
help = '\nList all of the packages you have installed, sh... versions of a package, this displays that fact.\n'
name = 'listall'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class ListCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List all the packages installed'
help = '\nList all the packages you have installed. If yo...his ignores that, and just shows a single\nentry.\n'
name = 'list'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class ObsoleteCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Find old versions which are not required by any current package'
help = '\nSearch through your collection, and list all th...can use this command to see what\ncan be deleted.\n'
name = 'obsolete'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class QuitCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Exit Boodle-Manager'
help = '\nLeave the interactive prompt and shut down boodle-mgr.\n'
name = 'quit'
synonyms = ['.', 'q']

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

 
class ReloadCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'Force the manager to re-scan the collection directory.'
help = '\nForce boodle-mgr to re-scan your collection. Yo...llection directory while boodle-mgr was running.\n'
name = 'reload'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class RequiresCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List what depends on a package'
help = '\n"requires PACKAGE"\n"requires PACKAGE VERSION"\n\n...ll the packages which require the\none you named.\n'
name = 'requires'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
class VersionsCmd(Command)
     Methods defined here:
perform(self, source)

Data and other attributes defined here:
description = 'List all the installed versions of a package'
help = '\n"versions PACKAGE"\nList all the versions of package that are installed.\n'
name = 'versions'

Methods inherited from Command:
__repr__(self)
assert_done(self, source)
assert_done(source) -> None
 
Ensure that the input has been exhausted. If it has not, raise a
CommandError.
 
(This should be called after all command arguments have been read,
but before execution begins.)

Data and other attributes inherited from Command:
synonyms = []

 
Functions
       
ensure_fetched(srctype, loc)
ensure_fetched(srctype, loc) -> None
 
Make sure the (srctype, loc) pair is fetched by the loader. (See the
PackageCollection.fetch_source() method for the arguments.) This
does any slow processing -- that is, HTTP downloading -- which is
necessary before the command is executed.
format_package(val, full=True)
format_package(val, full=True) -> str
 
Create a human-readable label for a package. The val may be a
PackageInfo object or a (pkgname, vers) pair. In the latter case,
vers may be a VersionNumber or a VersionSpec.
 
If full is false, the version is ignored.

 
Data
        command_list = [<class booman.command.HelpCmd>, <class booman.command.ListCmd>, <class booman.command.ListAllCmd>, <class booman.command.DescribeCmd>, <class booman.command.ContentsCmd>, <class booman.command.VersionsCmd>, <class booman.command.ObsoleteCmd>, <class booman.command.RequiresCmd>, <class booman.command.InstallCmd>, <class booman.command.DeleteCmd>, <class booman.command.DeleteAllCmd>, <class booman.command.CreateCmd>, <class booman.command.ReloadCmd>, <class booman.command.LastErrorCmd>, <class booman.command.QuitCmd>]