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

Class Cheesecake
source code

object --+
         |
        Cheesecake

Computes 'goodness' of Python packages.

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



Instance Methods [hide private]
  __init__(self, name="", url="", path="", sandbox=None, logfile=None, verbose=False, quiet=False, static_only=False, lite=False, keep_log=False)
Initialize critical variables, download and unpack package, walk package tree.
  raise_exception(self, msg)
Cleanup, print error message and raise CheesecakeError.
  cleanup(self, remove_log_file=True)
Delete temporary directories and files that were created in the sandbox.
  configure_logging(self, logfile=None)
Default settings for logging.
  run_step(self, step_name)
Run step if its decide() method returns True.
  get_pkg_from_pypi(self)
Download package using setuptools utilities.
  download_pkg(self)
Use urllib.urlretrieve to download package to file in sandbox dir.
  copy_pkg(self)
Copy package file to sandbox directory.
  unpack_pkg(self)
Unpack the package in the sandbox directory.
  walk_pkg(self)
Get package files and directories.
  install_pkg(self)
Verify that package can be installed in alternate directory.
  compute_cheesecake_index(self)
Compute overall Cheesecake index for the package by adding up specific indexes.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
steps  
package_types  

Inherited from object: __class__


Method Details [hide private]

__init__(self, name="", url="", path="", sandbox=None, logfile=None, verbose=False, quiet=False, static_only=False, lite=False, keep_log=False)
(Constructor)

source code 
Initialize critical variables, download and unpack package, walk package tree.
Overrides: object.__init__

raise_exception(self, msg)

source code 

Cleanup, print error message and raise CheesecakeError.

Don't use logging, since it can be called before logging has been setup.

cleanup(self, remove_log_file=True)

source code 
Delete temporary directories and files that were created in the sandbox. At the end delete the sandbox itself.

configure_logging(self, logfile=None)

source code 

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.

run_step(self, step_name)

source code 
Run step if its decide() method returns True.

get_pkg_from_pypi(self)

source code 

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.

download_pkg(self)

source code 
Use urllib.urlretrieve to download package to file in sandbox dir.

copy_pkg(self)

source code 
Copy package file to sandbox directory.

unpack_pkg(self)

source code 

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)

source code 

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.

install_pkg(self)

source code 

Verify that package can be installed in alternate directory.

New attributes:
installed : bool
Describes whenever package has been succefully installed.

compute_cheesecake_index(self)

source code 
Compute overall Cheesecake index for the package by adding up specific indexes.

Class Variable Details [hide private]

steps

Value:
{'copy_pkg': <cheesecake.cheesecake_index.StepByVariable object at 0xb\
7a3e46c>,
 'download_pkg': <cheesecake.cheesecake_index.StepByVariable object at\
 0xb7a3e3ac>,
 'get_pkg_from_pypi': <cheesecake.cheesecake_index.StepByVariable obje\
ct at 0xb7a3e1ec>,
 'install_pkg': <cheesecake.cheesecake_index.Step object at 0xb7a3e82c\
>,
...                                                                    
      

package_types

Value:
{'egg': <function unegg_package at 0xb7a5ebfc>,
 'tar.gz': <function untar_package at 0xb7a5ebc4>,
 'tgz': <function untar_package at 0xb7a5ebc4>,
 'zip': <function unzip_package at 0xb7a5eb8c>}