Python: module booman.create

booman.create | index booman/create.py

`# Boodler: a programmable soundscape tool
# Copyright 2007-9 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
`` |  |
boopak.argdef booman boopak.collect inspect | keyword os boopak.pinfo boopak.pload | re sys types unittest | boopak.version

Classes
`` |  | booman.CommandError(exceptions.Exception) ConstructError WalkContext unittest.TestCase(__builtin__.object) TestCreate
class ConstructError(booman.CommandError)
`` | `ConstructError: represents an error during package construction.`
| Method resolution order: ConstructError booman.CommandError exceptions.Exception exceptions.BaseException __builtin__.object Methods defined here: __init__(self, dirname, msg) Data descriptors inherited from booman.CommandError: __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from exceptions.Exception: __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` Methods inherited from exceptions.BaseException: __delattr__(...) `x.__delattr__('name') <==> del x.name` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __getslice__(...) `x.__getslice__(i, j) <==> x[i:j] Use of negative indices is not supported.` __reduce__(...) __repr__(...) `x.__repr__() <==> repr(x)` __setattr__(...) `x.__setattr__('name', value) <==> x.name = value` __setstate__(...) __str__(...) `x.__str__() <==> str(x)` Data descriptors inherited from exceptions.BaseException: __dict__ args message `exception message`
class TestCreate(unittest.TestCase)
`` |  | Method resolution order: TestCreate unittest.TestCase __builtin__.object Methods defined here: test_build_package_filename(self) test_parse_package_filename(self) test_parse_package_filename_assume(self) test_parse_package_filename_bad(self) Methods inherited from unittest.TestCase: __call__(self, *args, **kwds) __init__(self, methodName='runTest') `Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.` __repr__(self) __str__(self) assertAlmostEqual = failUnlessAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` assertAlmostEquals = failUnlessAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` assertEqual = failUnlessEqual(self, first, second, msg=None) `Fail if the two objects are unequal as determined by the '==' operator.` assertEquals = failUnlessEqual(self, first, second, msg=None) `Fail if the two objects are unequal as determined by the '==' operator.` assertFalse = failIf(self, expr, msg=None) `Fail the test if the expression is true.` assertNotAlmostEqual = failIfAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` assertNotAlmostEquals = failIfAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` assertNotEqual = failIfEqual(self, first, second, msg=None) `Fail if the two objects are equal as determined by the '==' operator.` assertNotEquals = failIfEqual(self, first, second, msg=None) `Fail if the two objects are equal as determined by the '==' operator.` assertRaises = failUnlessRaises(self, excClass, callableObj, *args, **kwargs) `Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception.` assertTrue = failUnless(self, expr, msg=None) `Fail the test unless the expression is true.` assert_ = failUnless(self, expr, msg=None) `Fail the test unless the expression is true.` countTestCases(self) debug(self) `Run the test without collecting errors in a TestResult` defaultTestResult(self) fail(self, msg=None) `Fail immediately, with the given message.` failIf(self, expr, msg=None) `Fail the test if the expression is true.` failIfAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` failIfEqual(self, first, second, msg=None) `Fail if the two objects are equal as determined by the '==' operator.` failUnless(self, expr, msg=None) `Fail the test unless the expression is true.` failUnlessAlmostEqual(self, first, second, places=7, msg=None) `Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).` failUnlessEqual(self, first, second, msg=None) `Fail if the two objects are unequal as determined by the '==' operator.` failUnlessRaises(self, excClass, callableObj, *args, **kwargs) `Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception.` id(self) run(self, result=None) setUp(self) `Hook method for setting up the test fixture before exercising it.` shortDescription(self) `Returns a one-line description of the test, or None if no description has been provided. The default implementation of this method returns the first line of the specified test method's docstring.` tearDown(self) `Hook method for deconstructing the test fixture after testing it.` Data descriptors inherited from unittest.TestCase: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from unittest.TestCase: failureException = <type 'exceptions.AssertionError'> `Assertion failed.`
class WalkContext
`` | `WalkContext: context structure used by walk_module().`
| Methods defined here: __init__(self, pkg)

Functions
`` |  | build_package_filename(pkgname, pkgvers) `build_package_filename(pkgname, pkgvers) -> str Given a package name and version, return the canonical name of the file containing it. (This is also used for constructing package URLs; the filename of a package on a server is the same as on disk.) This will look like "PACKAGE.VERSION.boop". This is guaranteed to create a distinct pathname for every (pkgname, vers) pair. This is true even on case-insensitive filesystems, which is a wrinkle, since version strings are case-sensitive. We work around this by putting a "^" character before each capital letter.` construct_zipfile(fl, tup, dirname, contents, metadatafile, resourcesfile=None) `construct_zipfile(fl, (pkgname, pkgvers), dirname, contents, metadatafile, resourcesfile=None) -> None Write out a zip file containing the given package data. The fl must be a ZipFile object, newly opened for writing. The dirname contains the package data; metadatafile and resourcesfile must be valid Metadata and Resources files. (Not Metadata and Resources objects, but rather the files produced by dump()ing them.)` examine_directory(loader, dirname, destname=None) `examine_directory(loader, dirname, destname=None) -> ((pkgname, pkgvers), contents, metadata, resources) Look at a directory containing package data. Figure out its metadata and resources, considering both the directory contents and the contents of the Metadata and Resources files (if present). The destname, if provided, may also be used to figure out the package's desired name and version number. The loader argument must be a PackageLoader. This is used for a test import, during the process. Any fatal errors will raise ConstructError. This may also print (non-fatal) warning messages. This returns a tuple of four items: - the package name and version: (str, VersionNumber) - a list of the files (not subdirs) in the directory; each element in the list is a tuple (realname, resourcename), where realname is the current absolute path and resourcename is the universal relative path in the package. - a Metadata object. - a Resources object. ### ignore .pyc and ~ files in contents? Or warn about them?` parse_package_filename(val, assume_1=True) `parse_package_filename(val, assume_1) -> (str, VersionNumber) Given a package filename, return the package name and version that it should contain. If the filename is not a canonical form, raise ValueError. The name can look like "PACKAGE.VERSION.boop" or "PACKAGE.boop". In the latter case, the version returned depends on the assume_1 argument. To get version 1.0, pass True; to get None, pass False.` resolve_argument_list(dirname, key, ag) resolve_dependency_metadata(dirname, pkgname, pkgvers, resources, metadata, import_record, context) walk_module(context, mod, prefix='') `walk_module(context, mod, prefix='') -> None Walk through the contents of the given module, and all its submodules. This looks for Agents. Callers should not pass a prefix argument. That is used for the recursion.` warning(dirname, msg) `warning(dirname, msg) -> None Print a warning.`

Data
`` |  | version_start_regexp = <_sre.SRE_Pattern object>