Orbits  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
setuptools.dist.Distribution Class Reference
Inheritance diagram for setuptools.dist.Distribution:

Public Member Functions

def patch_missing_pkg_info
 
def __init__
 
def parse_command_line
 
def fetch_build_eggs
 
def finalize_options
 
def fetch_build_egg
 
def get_command_class
 
def print_commands
 
def feature_is_included
 
def include_feature
 
def include
 
def exclude_package
 
def has_contents_for
 
def exclude
 
def get_cmdline_options
 
def iter_distribution_names
 
def handle_display_options
 

Public Attributes

 package_data
 
 require_features
 
 features
 
 dist_files
 
 src_root
 
 dependency_links
 
 convert_2to3_doctests
 
 global_options
 
 feature_options
 
 negative_opt
 
 feature_negopt
 
 packages
 
 py_modules
 
 ext_modules
 

Private Member Functions

def _feature_attrname
 
def _set_global_opts_from_features
 
def _finalize_features
 
def _set_feature
 
def _exclude_misc
 
def _include_misc
 
def _exclude_packages
 
def _parse_command_opts
 

Private Attributes

 _egg_fetcher
 

Static Private Attributes

 _patched_dist = None
 

Detailed Description

Distribution with support for features, tests, and package data

This is an enhanced version of 'distutils.dist.Distribution' that
effectively adds the following new optional keyword arguments to 'setup()':

 'install_requires' -- a string or sequence of strings specifying project
    versions that the distribution requires when installed, in the format
    used by 'pkg_resources.require()'.  They will be installed
    automatically when the package is installed.  If you wish to use
    packages that are not available in PyPI, or want to give your users an
    alternate download location, you can add a 'find_links' option to the
    '[easy_install]' section of your project's 'setup.cfg' file, and then
    setuptools will scan the listed web pages for links that satisfy the
    requirements.

 'extras_require' -- a dictionary mapping names of optional "extras" to the
    additional requirement(s) that using those extras incurs. For example,
    this::

        extras_require = dict(reST = ["docutils>=0.3", "reSTedit"])

    indicates that the distribution can optionally provide an extra
    capability called "reST", but it can only be used if docutils and
    reSTedit are installed.  If the user installs your package using
    EasyInstall and requests one of your extras, the corresponding
    additional requirements will be installed if needed.

 'features' **deprecated** -- a dictionary mapping option names to
    'setuptools.Feature'
    objects.  Features are a portion of the distribution that can be
    included or excluded based on user options, inter-feature dependencies,
    and availability on the current system.  Excluded features are omitted
    from all setup commands, including source and binary distributions, so
    you can create multiple distributions from the same source tree.
    Feature names should be valid Python identifiers, except that they may
    contain the '-' (minus) sign.  Features can be included or excluded
    via the command line options '--with-X' and '--without-X', where 'X' is
    the name of the feature.  Whether a feature is included by default, and
    whether you are allowed to control this from the command line, is
    determined by the Feature object.  See the 'Feature' class for more
    information.

 'test_suite' -- the name of a test suite to run for the 'test' command.
    If the user runs 'python setup.py test', the package will be installed,
    and the named test suite will be run.  The format is the same as
    would be used on a 'unittest.py' command line.  That is, it is the
    dotted name of an object to import and call to generate a test suite.

 'package_data' -- a dictionary mapping package names to lists of filenames
    or globs to use to find data files contained in the named packages.
    If the dictionary has filenames or globs listed under '""' (the empty
    string), those names will be searched for in every package, in addition
    to any names for the specific package.  Data files found using these
    names/globs will be installed along with the package, in the same
    location as the package.  Note that globs are allowed to reference
    the contents of non-package subdirectories, as long as you use '/' as
    a path separator.  (Globs are automatically converted to
    platform-specific paths at runtime.)

In addition to these new keywords, this class also has several new methods
for manipulating the distribution's contents.  For example, the 'include()'
and 'exclude()' methods can be thought of as in-place add and subtract
commands that add or remove packages, modules, extensions, and so on from
the distribution.  They are used by the feature subsystem to configure the
distribution for the included and excluded features.

Constructor & Destructor Documentation

def setuptools.dist.Distribution.__init__ (   self,
  attrs = None 
)

Member Function Documentation

def setuptools.dist.Distribution._exclude_misc (   self,
  name,
  value 
)
private
Handle 'exclude()' for list/tuple attrs without a special handler
def setuptools.dist.Distribution._exclude_packages (   self,
  packages 
)
private
def setuptools.dist.Distribution._feature_attrname (   self,
  name 
)
private
Convert feature name to corresponding option attribute name
def setuptools.dist.Distribution._finalize_features (   self)
private
Add/remove features and resolve dependencies between them
def setuptools.dist.Distribution._include_misc (   self,
  name,
  value 
)
private
Handle 'include()' for list/tuple attrs without a special handler
def setuptools.dist.Distribution._parse_command_opts (   self,
  parser,
  args 
)
private
def setuptools.dist.Distribution._set_feature (   self,
  name,
  status 
)
private
Set feature's inclusion status
def setuptools.dist.Distribution._set_global_opts_from_features (   self)
private
Add --with-X/--without-X options based on optional features
def setuptools.dist.Distribution.exclude (   self,
  attrs 
)
Remove items from distribution that are named in keyword arguments

For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from
the distribution's 'py_modules' attribute.  Excluding packages uses
the 'exclude_package()' method, so all of the package's contained
packages, modules, and extensions are also excluded.

Currently, this method only supports exclusion from attributes that are
lists or tuples.  If you need to add support for excluding from other
attributes in this or a subclass, you can add an '_exclude_X' method,
where 'X' is the name of the attribute.  The method will be called with
the value passed to 'exclude()'.  So, 'dist.exclude(foo={"bar":"baz"})'
will try to call 'dist._exclude_foo({"bar":"baz"})', which can then
handle whatever special exclusion logic is needed.
def setuptools.dist.Distribution.exclude_package (   self,
  package 
)
Remove packages, modules, and extensions in named package
def setuptools.dist.Distribution.feature_is_included (   self,
  name 
)
Return 1 if feature is included, 0 if excluded, 'None' if unknown
def setuptools.dist.Distribution.fetch_build_egg (   self,
  req 
)
Fetch an egg needed for building
def setuptools.dist.Distribution.fetch_build_eggs (   self,
  requires 
)
Resolve pre-setup requirements
def setuptools.dist.Distribution.finalize_options (   self)
def setuptools.dist.Distribution.get_cmdline_options (   self)
Return a '{cmd: {opt:val}}' map of all command-line options

Option names are all long, but do not include the leading '--', and
contain dashes rather than underscores.  If the option doesn't take
an argument (e.g. '--quiet'), the 'val' is 'None'.

Note that options provided by config files are intentionally excluded.
def setuptools.dist.Distribution.get_command_class (   self,
  command 
)
Pluggable version of get_command_class()
def setuptools.dist.Distribution.handle_display_options (   self,
  option_order 
)
If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
line, display the requested info and return true; else return
false.
def setuptools.dist.Distribution.has_contents_for (   self,
  package 
)
Return true if 'exclude_package(package)' would do something
def setuptools.dist.Distribution.include (   self,
  attrs 
)
Add items to distribution that are named in keyword arguments

For example, 'dist.exclude(py_modules=["x"])' would add 'x' to
the distribution's 'py_modules' attribute, if it was not already
there.

Currently, this method only supports inclusion for attributes that are
lists or tuples.  If you need to add support for adding to other
attributes in this or a subclass, you can add an '_include_X' method,
where 'X' is the name of the attribute.  The method will be called with
the value passed to 'include()'.  So, 'dist.include(foo={"bar":"baz"})'
will try to call 'dist._include_foo({"bar":"baz"})', which can then
handle whatever special inclusion logic is needed.
def setuptools.dist.Distribution.include_feature (   self,
  name 
)
Request inclusion of feature named 'name'
def setuptools.dist.Distribution.iter_distribution_names (   self)
Yield all packages, modules, and extension names in distribution
def setuptools.dist.Distribution.parse_command_line (   self)
Process features after parsing command line options
def setuptools.dist.Distribution.patch_missing_pkg_info (   self,
  attrs 
)
def setuptools.dist.Distribution.print_commands (   self)

Member Data Documentation

setuptools.dist.Distribution._egg_fetcher
private
setuptools.dist.Distribution._patched_dist = None
staticprivate
setuptools.dist.Distribution.convert_2to3_doctests
setuptools.dist.Distribution.dependency_links
setuptools.dist.Distribution.dist_files
setuptools.dist.Distribution.ext_modules
setuptools.dist.Distribution.feature_negopt
setuptools.dist.Distribution.feature_options
setuptools.dist.Distribution.features
setuptools.dist.Distribution.global_options
setuptools.dist.Distribution.negative_opt
setuptools.dist.Distribution.package_data
setuptools.dist.Distribution.packages
setuptools.dist.Distribution.py_modules
setuptools.dist.Distribution.require_features
setuptools.dist.Distribution.src_root

The documentation for this class was generated from the following file:

Copyright 2014 Google Inc. All rights reserved.