cheesecake.cheesecake_index.Cheesecake

Package cheesecake :: Module cheesecake_index :: Class Cheesecake |
[show private | hide private]
[frames | no frames]

## Type Cheesecake

    object --+
             |
            Cheesecake

Computes 'goodness' of Python packages.

Generates "cheesecake index" that takes into account things like:

> - whether the package can be downloaded
> - whether the package can be unpacked
> - whether the package can be installed into an alternate directory
> - existence of certain files such as README, INSTALL, LICENSE, setup.py etc.
> - existence of certain directories such as doc, test, demo, examples
> - percentage of modules/functions/classes/methods with docstrings
> - percentage of functions/methods that are unit tested
> - average pylint score for all non-test and non-demo modules

Method Summary
| ``__init__`(self, keep_log, lite, logfile, name, path, pylint_max_execution_time, quiet, sandbox, static_only, url, verbose, with_pep8)` Initialize critical variables, download and unpack package, walk package tree.
| ``cleanup`(self, remove_log_file)` Delete temporary directories and files that were created in the sandbox.
| ``compute_cheesecake_index`(self)` Compute overall Cheesecake index for the package by adding up specific indexes.
| ``configure_logging`(self, logfile)` Default settings for logging.
| ``copy_pkg`(self)` Copy package file to sandbox directory.
| ``download_pkg`(self)` Use `urllib.urlretrieve` to download package to file in sandbox dir.
| ``get_pkg_from_pypi`(self)` Download package using setuptools utilities.
| ``install_pkg`(self)` Verify that package can be installed in alternate directory.
| ``raise_exception`(self, msg)` Cleanup, print error message and raise CheesecakeError.
| ``run_step`(self, step_name)` Run step if its decide() method returns True.
| ``unpack_pkg`(self)` Unpack the package in the sandbox directory.
| ``walk_pkg`(self)` Get package files and directories.
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__hash__`(x)` x.__hash__() <==> hash(x)
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value
| ``__str__`(x)` x.__str__() <==> str(x)

Class Variable Summary
`dict` | `package_types` = `{'tar.gz': <function untar_package at 0x...`
`dict` | `steps` = `{'install_pkg': <cheesecake.cheesecake_index.Ste...`

Method Details

### __init__(self, keep_log=False, lite=False, logfile=None, name='', path='', pylint_max_execution_time=None, quiet=False, sandbox=None, static_only=False, url='', verbose=False, with_pep8=False) (Constructor) Initialize critical variables, download and unpack package, walk package tree. Overrides: `__builtin__.object.__init__`

### cleanup(self, remove_log_file=True) Delete temporary directories and files that were created in the sandbox. At the end delete the sandbox itself.

### compute_cheesecake_index(self) Compute overall Cheesecake index for the package by adding up specific indexes.

### configure_logging(self, logfile=None) Default settings for logging. If verbose, log goes to console, else it goes to logfile. log.debug and log.info goes to logfile. log.warn and log.error go to both logfile and stdout.

### copy_pkg(self) Copy package file to sandbox directory.

### download_pkg(self) Use `urllib.urlretrieve` to download package to file in sandbox dir.

### get_pkg_from_pypi(self) Download package using setuptools utilities. New attributes: download_url : str URL that package was downloaded from. distance_from_pypi : int How many hops setuptools had to make to download package. found_on_cheeseshop : bool Whenever package has been found on CheeseShop. found_locally : bool Whenever package has been already installed.

### install_pkg(self) Verify that package can be installed in alternate directory. New attributes: installed : bool Describes whenever package has been succefully installed.

### raise_exception(self, msg) Cleanup, print error message and raise CheesecakeError. Don't use logging, since it can be called before logging has been setup.

### run_step(self, step_name) Run step if its decide() method returns True.

### unpack_pkg(self) Unpack the package in the sandbox directory. Check `package_types` attribute for list of currently supported archive types. New attributes: original_package_name : str Package name guessed from the package name. Will be set only if package name is different than unpacked directory name.

### walk_pkg(self) Get package files and directories. New attributes: dirs_list : list List of directories package contains. docstring_cnt : int Number of docstrings found in all package objects. docformat_cnt : int Number of formatted docstrings found in all package objects. doctests_count : int Number of docstrings that include doctests. unittests_count : int Number of classes which inherit from unittest.TestCase. files_list : list List of files package contains. functions : list List of all functions defined in package sources. classes : list List of all classes defined in package sources. methods : list List of all methods defined in package sources. object_cnt : int Number of documentable objects found in all package modules. package_dir : str Path to project directory.

Class Variable Details

    ### package_types Type: `dict` Value:
        {'egg': <function unegg_package at 0xb7b3e994>,
         'tar.gz': <function untar_package at 0xb7b3e95c>,
         'tgz': <function untar_package at 0xb7b3e95c>,
         'zip': <function unzip_package at 0xb7b3e924>}

    ### steps Type: `dict` Value:
        {'copy_pkg': <cheesecake.cheesecake_index.StepByVariable object at 0xb\
        7a2cf0c>,
         'download_pkg': <cheesecake.cheesecake_index.StepByVariable object at\
         0xb7a2ceec>,
         'get_pkg_from_pypi': <cheesecake.cheesecake_index.StepByVariable obje\
        ct at 0xb7a2cecc>,
         'install_pkg': <cheesecake.cheesecake_index.Step object at 0xb7a2cf8c\
        >,
        ...

Generated by Epydoc 2.1 on Fri Feb 9 02:15:12 2007 | http://epydoc.sf.net