Package distutils :: Package command :: Module sdist :: Class sdist
[hide private]
[frames] | no frames]

_ClassType sdist

cmd.Command --+
              |
             sdist

Instance Methods [hide private]
 
initialize_options(self)
Set default values for all the options that this command supports.
 
finalize_options(self)
Set final values for all the options that this command supports.
 
run(self)
A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'.
 
check_metadata(self)
Ensure that all required elements of meta-data (name, version, URL, (author and author_email) or (maintainer and maintainer_email)) are supplied by the Distribution object; warn if any are missing.
 
get_file_list(self)
Figure out the list of files to include in the source distribution, and put it in 'self.filelist'.
 
add_defaults(self)
Add all the default files to self.filelist:
 
read_template(self)
Read and parse manifest template file named by self.template.
 
prune_file_list(self)
Prune off branches that might slip into the file list as created...
 
write_manifest(self)
Write the file list in 'self.filelist' (presumably as filled in by 'add_defaults()' and 'read_template()') to the manifest file named by 'self.manifest'.
 
read_manifest(self)
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
 
make_release_tree(self, base_dir, files)
Create the directory tree that will become the source distribution archive.
 
make_distribution(self)
Create the source distribution(s).
 
get_archive_files(self)
Return the list of archive files created when the command was run, or None if the command hasn't run yet.

Inherited from cmd.Command: __getattr__, __init__, announce, copy_file, copy_tree, debug_print, dump_options, ensure_dirname, ensure_filename, ensure_finalized, ensure_string, ensure_string_list, execute, get_command_name, get_finalized_command, get_sub_commands, make_archive, make_file, mkpath, move_file, reinitialize_command, run_command, set_undefined_options, spawn, warn

Class Variables [hide private]
  description = 'create a source distribution (tarball, zip file...
  user_options = [('template=', 't', 'name of manifest template ...
  boolean_options = ['use-defaults', 'prune', 'manifest-only', '...
  help_options = [('help-formats', None, 'list available distrib...
  negative_opt = {'no-defaults': 'use-defaults', 'no-prune': 'pr...
  default_format = {'nt': 'zip', 'posix': 'gztar'}

Inherited from cmd.Command: sub_commands

Method Details [hide private]

initialize_options(self)

 

Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, 'initialize_options()' implementations are just a bunch of "self.foo = None" assignments.

This method must be implemented by all command classes.

Overrides: cmd.Command.initialize_options
(inherited documentation)

finalize_options(self)

 

Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been done. Thus, this is the place to code option dependencies: if 'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as long as 'foo' still has the same value it was assigned in 'initialize_options()'.

This method must be implemented by all command classes.

Overrides: cmd.Command.finalize_options
(inherited documentation)

run(self)

 

A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'. All terminal output and filesystem interaction should be done by 'run()'.

This method must be implemented by all command classes.

Overrides: cmd.Command.run
(inherited documentation)

get_file_list(self)

 

Figure out the list of files to include in the source distribution, and put it in 'self.filelist'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all depends on the user's options and the state of the filesystem.

add_defaults(self)

 

Add all the default files to self.filelist:

  • README or README.txt
  • setup.py
  • test/test*.py
  • all pure Python modules mentioned in setup script
  • all C sources listed as part of extensions or C libraries in the setup script (doesn't catch C headers!)

Warns if (README or README.txt) or setup.py are missing; everything else is optional.

read_template(self)

 

Read and parse manifest template file named by self.template.

(usually "MANIFEST.in") The parsing and processing is done by 'self.filelist', which updates itself accordingly.

prune_file_list(self)

 
Prune off branches that might slip into the file list as created
by 'read_template()', but really don't belong there:
  * the build tree (typically "build")
  * the release tree itself (only an issue if we ran "sdist"
    previously with --keep-temp, or it aborted)
  * any RCS, CVS and .svn directories

make_release_tree(self, base_dir, files)

 

Create the directory tree that will become the source distribution archive. All directories implied by the filenames in 'files' are created under 'base_dir', and then we hard link or copy (if hard linking is unavailable) those files into place. Essentially, this duplicates the developer's source tree, but in a directory named after the distribution, containing only the files to be distributed.

make_distribution(self)

 

Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless 'self.keep_temp' is true). The list of archive files created is stored so it can be retrieved later by 'get_archive_files()'.


Class Variable Details [hide private]

description

Value:
'create a source distribution (tarball, zip file, etc.)'

user_options

Value:
[('template=',
  't',
  'name of manifest template file [default: MANIFEST.in]'),
 ('manifest=', 'm', 'name of manifest file [default: MANIFEST]'),
 ('use-defaults',
  None,
  'include the default file set in the manifest [default; disable with\
 --no-defaults]'),
...

boolean_options

Value:
['use-defaults',
 'prune',
 'manifest-only',
 'force-manifest',
 'keep-temp']

help_options

Value:
[('help-formats',
  None,
  'list available distribution formats',
  <function show_formats at 0x4125048c>)]

negative_opt

Value:
{'no-defaults': 'use-defaults', 'no-prune': 'prune'}