-í
ì¶<c       sÒ     d  Z    d Z 	 d k Z d k Z d k Z 
 d k T d k l Z  d k l Z  d k	 l
 Z
 l Z l Z l Z  d k l Z  d k T d k l Z  d	 „  Z " d
 e f d „  ƒ  YZ d S(   sa   distutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution).s5   $Id: sdist.py,v 1.53 2001/12/06 20:57:12 fdrake Exp $N(   s   *(   s   glob(   s   Command(   s   dir_utils   dep_utils	   file_utils   archive_util(   s   TextFile(   s   FileListc     s¡      d k  l }  d k l }   g  }  x< |  i ƒ  D ]+ }  | i d | t |  | d f ƒ q? W | i	 ƒ   | | ƒ }  | i d ƒ d S(   so   Print all possible values for the 'formats' option (used by
    the "--help-formats" command-line option).
    (   s   FancyGetopt(   s   ARCHIVE_FORMATSs   formats=i   s.   List of available source distribution formats:N(   s   distutils.fancy_getopts   FancyGetopts   distutils.archive_utils   ARCHIVE_FORMATSs   formatss   keyss   formats   appends   Nones   sorts   pretty_printers
   print_help(   s   ARCHIVE_FORMATSs   pretty_printers   FancyGetopts   formats   formats(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   show_formats s   	 	)s   sdistc      s§  " t  Z $ d Z & d d d f d d d f d e d	 f d
 e d f d e d f d e d f d d d f d d d f d e d f d d d d f d d d f g Z E d d d d d g Z I d e d  e f g Z N h  d d
 <d d <Z Q h  d! d" <d# d$ <Z	 T d% „  Z
 i d& „  Z  d' „  Z ™ d( „  Z º d) „  Z d* „  Z Cd+ „  Z bd, „  Z rd- „  Z ~d. „  Z d/ „  Z ½d0 „  Z Õd1 „  Z RS(2   Ns6   create a source distribution (tarball, zip file, etc.)s	   template=s   ts5   name of manifest template file [default: MANIFEST.in]s	   manifest=s   ms)   name of manifest file [default: MANIFEST]s   use-defaultssR   include the default file set in the manifest [default; disable with --no-defaults]s   no-defaultss"   don't include the default file sets   prunes‰   specifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]s   no-prunes$   don't automatically exclude anythings   manifest-onlys   osE   just regenerate the manifest and then stop (implies --force-manifest)s   force-manifests   fs6   forcibly regenerate the manifest and carry on as usuals   formats=s6   formats for source distribution (comma-separated list)s	   keep-temps   ks1   keep the distribution tree around after creating s   archive file(s)s	   dist-dir=s   dsF   directory to put the source distribution archive(s) in [default: dist]s   help-formatss#   list available distribution formatss   gztars   posixs   zips   ntc    s   T W t  |  _ X t  |  _ \ d |  _ ] d |  _ _ d |  _ ` d |  _ b t  |  _ c d |  _	 d t  |  _
 f t  |  _ d  S(   Ni   i    (   s   Nones   selfs   templates   manifests   use_defaultss   prunes   manifest_onlys   force_manifests   formatss	   keep_temps   dist_dirs   archive_files(   s   self(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   initialize_optionsT s   c    s  i j |  i t j o k d |  _ n l |  i t j o m d |  _ n o |  i d ƒ p |  i t j oT q y r |  i t i g |  _ Wn- s t	 j
 o t t
 d d t i ‚ n Xn x t i |  i ƒ } y | o z t d | ‚ n } |  i t j o ~ d |  _ n d  S(   Ns   MANIFESTs   MANIFEST.ins   formatss.   don't know how to create source distributions s   on platform %ss   unknown archive format '%s's   dist(   s   selfs   manifests   Nones   templates   ensure_string_lists   formatss   default_formats   oss   names   KeyErrors   DistutilsPlatformErrors   archive_utils   check_archive_formatss
   bad_formats   DistutilsOptionErrors   dist_dir(   s   selfs
   bad_format(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   finalize_optionsi s    
c    sU    … t  ƒ  |  _ ‰ |  i ƒ  Ž |  i ƒ  ‘ |  i o ’ d  Sn – |  i ƒ  d  S(   N(   s   FileLists   selfs   filelists   check_metadatas   get_file_lists   manifest_onlys   make_distribution(   s   self(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   run s   c    s.  ™ ž Ÿ |  i i } ¡ g  } ¢ xR d d d f D¢ ]> } £ t | | ƒ o t | | ƒ o ¤ | i | ƒ n q1 W¦ | o$ § |  i d t	 i
 | d ƒ ƒ n ª | i o* « | i o ¬ |  i d d ƒ n nP ® | i o* ¯ | i o ° |  i d d	 ƒ n n ³ |  i d
 d d ƒ d S(   sæ   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.
        s   names   versions   urls   missing required meta-data: s   , s)   missing meta-data: if 'author' supplied, s#   'author_email' must be supplied toos-   missing meta-data: if 'maintainer' supplied, s'   'maintainer_email' must be supplied toos4   missing meta-data: either (author and author_email) s%   or (maintainer and maintainer_email) s   must be suppliedN(   s   selfs   distributions   metadatas   missings   attrs   hasattrs   getattrs   appends   warns   strings   joins   authors   author_emails
   maintainers   maintainer_email(   s   selfs   attrs   missings   metadata(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   check_metadata™ s    	 	$
$c    sÍ  º À Ä t  i i |  i ƒ } Å | o Æ t i |  i |  i ƒ } n Ï |  i
 d |  i i |  i f ƒ Ñ t i |  i i Ò |  i ƒ } à | o | p | } â |  i p |  i } ã t  i i |  i ƒ } ä | o | } ç | p | p | oÂ è | o é |  i d d |  i ƒ n í |  i i ƒ  ð |  i o ñ |  i ƒ  n ô | o õ |  i ƒ  n ù |  i o ú |  i ƒ  n þ |  i i ƒ  |  i i ƒ  |  i ƒ  n 	|  i ƒ  d S(   sc  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.
        s   checking if %s newer than %ss&   manifest template '%s' does not exist s   (using default file list)N(    s   oss   paths   isfiles   selfs   templates   template_existss   dep_utils   newers   manifests   template_newers   debug_prints   distributions   script_names   setup_newers   manifest_outofdates   force_manifests   manifest_onlys   force_regens   manifest_existss   neither_existss   warns   filelists   findalls   use_defaultss   add_defaultss   read_templates   prunes   prune_file_lists   sorts   remove_duplicatess   write_manifests   read_manifest(   s   selfs   manifest_existss   setup_newers   neither_existss   force_regens   template_existss   template_newers   manifest_outofdate(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   get_file_listº s2   
	#
c    sT  d d f |  i i g } xþ | D]ó }
 t |
 ƒ t j o– |
 } d }	 xK | D]@ }
  t	 i
 i |
 ƒ o$ !d }	 "|  i i |
 ƒ #Pn qf W%|	 o$ &|  i d t i | d ƒ ƒ n nB )t	 i
 i |
 ƒ o *|  i i |
 ƒ n ,|  i d |
 ƒ q+ W.d d	 g } /xP | D/]E } 0t t	 i
 i t | ƒ ƒ } 1| o 2|  i i | ƒ n q>W4|  i i ƒ  o/ 5|  i d
 ƒ } 6|  i i | i ƒ  ƒ n 8|  i i ƒ  o/ 9|  i d ƒ } :|  i i | i ƒ  ƒ n <|  i i ƒ  o/ =|  i d ƒ } >|  i i | i ƒ  ƒ n d S(   s©  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.
        s   READMEs
   README.txti    i   s,   standard file not found: should have one of s   , s   standard file '%s' not founds   test/test*.pys	   setup.cfgs   build_pys	   build_exts
   build_clibN(    s   selfs   distributions   script_names	   standardss   fns   types	   TupleTypes   altss   got_its   oss   paths   existss   filelists   appends   warns   strings   joins   optionals   patterns   filters   isfiles   globs   filess   extends   has_pure_moduless   get_finalized_commands   build_pys   get_source_filess   has_ext_moduless	   build_exts   has_c_librariess
   build_clib(   s   selfs   filess	   build_exts   build_pys   optionals	   standardss
   build_clibs   altss   patterns   got_its   fn(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   add_defaultssB   

 			
 		(
 	
c    sý   CIJ|  i d |  i ƒ Kt |  i Ld d Md d Nd d Od d Pd d Qd d ƒ} SxŽ Sd oƒ T| i ƒ  } U| t j o VPn Xy Y|  i i | ƒ Wn; Zt	 j
 o, } [|  i d	 | i | i | f ƒ n Xqk Wd
 S(   sÖ   Read and parse the manifest template file named by
        'self.template' (usually "MANIFEST.in").  The parsing and
        processing is done by 'self.filelist', which updates itself
        accordingly.
        s   reading manifest template '%s's   strip_commentsi   s   skip_blankss
   join_liness	   lstrip_wss	   rstrip_wss   collapse_joins   %s, line %d: %sN(   s   selfs   announces   templates   TextFiles   readlines   lines   Nones   filelists   process_template_lines   DistutilsTemplateErrors   msgs   warns   filenames   current_line(   s   selfs   templates   msgs   line(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   read_templateCs$   					 
c    s|   bij|  i d ƒ } k|  i i ƒ  } m|  i i t d | i	 ƒn|  i i t d | ƒo|  i i d d d ƒd S(   sY  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 or CVS directories
        s   builds   prefixs   /(RCS|CVS)/.*s   is_regexi   N(
   s   selfs   get_finalized_commands   builds   distributions   get_fullnames   base_dirs   filelists   exclude_patterns   Nones
   build_base(   s   selfs   builds   base_dir(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   prune_file_listbs   c    s?   rvw|  i t i x|  i |  i i f yd |  i ƒ d S(   s²   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'.
        s   writing manifest file '%s'N(   s   selfs   executes	   file_utils
   write_files   manifests   filelists   files(   s   self(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   write_manifestrs   c    sª   ~‚ƒ|  i d |  i ƒ „t |  i ƒ } …xq …d of †| i ƒ  } ‡| d j o ˆPn ‰| d d j o Š| d d !} n ‹|  i i | ƒ q5 Wd S(   sª   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.
        s   reading manifest file '%s'i   s    iÿÿÿÿs   
i    N(   s   selfs   announces   manifests   opens   readlines   lines   filelists   append(   s   selfs   lines   manifest(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   read_manifest~s    
c    sA  ˜œ|  i | ƒ t i | | žd |  i d |  i ƒ§t t	 d ƒ o ¨d } ©d | } n «t } ¬d | } ®| o ¯|  i d ƒ n ±|  i | ƒ ²xq | D²]f } ³t	 i i | ƒ o ´|  i d | ƒ n2 ¶t	 i i | | ƒ } ·|  i | | d | ƒqº W¹|  i i i | ƒ d	 S(
   sÆ  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.
        s   verboses   dry_runs   links   hards   making hard links in %s...s   copying files to %s...s)   no files to distribute -- empty manifest?s#   '%s' not a regular file -- skippingN(   s   selfs   mkpaths   base_dirs   dir_utils   create_trees   filess   verboses   dry_runs   hasattrs   oss   links   msgs   Nones   warns   announces   files   paths   isfiles   joins   dests	   copy_files   distributions   metadatas   write_pkg_info(   s   selfs   base_dirs   filess   dests   files   msgs   link(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   make_release_trees&   			
 	c    sØ   ½ÄÇ|  i i ƒ  } Èt i i |  i | ƒ } Ê|  i	 | |  i
 i ƒ Ëg  } Ìx? |  i DÌ]1 } Í|  i | | d | ƒ} Î| i | ƒ qb WÐ| |  _ Ò|  i o  Ót i | |  i |  i ƒ n d S(   s¯  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()'.
        s   base_dirN(   s   selfs   distributions   get_fullnames   base_dirs   oss   paths   joins   dist_dirs	   base_names   make_release_trees   filelists   filess   archive_filess   formatss   fmts   make_archives   files   appends	   keep_temps   dir_utils   remove_trees   verboses   dry_run(   s   selfs   archive_filess   files	   base_names   fmts   base_dir(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   make_distribution½s   	 	c    s   ÕØÙ|  i Sd S(   sz   Return the list of archive files created when the command
        was run, or None if the command hasn't run yet.
        N(   s   selfs   archive_files(   s   self(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   get_archive_filesÕs   (   s   __name__s
   __module__s   descriptions   Nones   user_optionss   boolean_optionss   show_formatss   help_optionss   negative_opts   default_formats   initialize_optionss   finalize_optionss   runs   check_metadatas   get_file_lists   add_defaultss   read_templates   prune_file_lists   write_manifests   read_manifests   make_release_trees   make_distributions   get_archive_files(    (    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   sdist" s&   		‘!T5-(   s   __doc__s   __revision__s   syss   oss   strings   typess   globs   distutils.cores   Commands	   distutilss   dir_utils   dep_utils	   file_utils   archive_utils   distutils.text_files   TextFiles   distutils.errorss   distutils.filelists   FileLists   show_formatss   sdist(   s   dep_utils   __revision__s   strings   oss   globs   FileLists   syss   archive_utils   Commands   dir_utils   TextFiles	   file_utils   sdists   show_formats(    (    s-   /usr/lib/python2.2/distutils/command/sdist.pys   ? s   	
"
