| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | """distutils.command.sdist
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Implements the Distutils 'sdist' command (create a source distribution)."""
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-09 04:11:44 +00:00
										 |  |  | import os | 
					
						
							|  |  |  | import string | 
					
						
							|  |  |  | import sys | 
					
						
							|  |  |  | from types import * | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | from glob import glob | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  | from warnings import warn | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | from distutils.core import Command | 
					
						
							| 
									
										
										
										
											2000-08-05 01:31:54 +00:00
										 |  |  | from distutils import dir_util, dep_util, file_util, archive_util | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | from distutils.text_file import TextFile | 
					
						
							| 
									
										
										
										
											2000-07-30 01:47:16 +00:00
										 |  |  | from distutils.errors import * | 
					
						
							| 
									
										
										
										
											2000-07-30 01:05:02 +00:00
										 |  |  | from distutils.filelist import FileList | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  | from distutils import log | 
					
						
							| 
									
										
										
										
											2009-02-17 09:47:25 +00:00
										 |  |  | from distutils.util import convert_path | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-14 12:45:48 +00:00
										 |  |  | def show_formats(): | 
					
						
							| 
									
										
										
										
											2000-06-24 01:23:37 +00:00
										 |  |  |     """Print all possible values for the 'formats' option (used by
 | 
					
						
							|  |  |  |     the "--help-formats" command-line option). | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     from distutils.fancy_getopt import FancyGetopt | 
					
						
							|  |  |  |     from distutils.archive_util import ARCHIVE_FORMATS | 
					
						
							| 
									
										
										
										
											2009-05-14 12:45:48 +00:00
										 |  |  |     formats = [] | 
					
						
							| 
									
										
										
										
											2000-06-24 01:23:37 +00:00
										 |  |  |     for format in ARCHIVE_FORMATS.keys(): | 
					
						
							|  |  |  |         formats.append(("formats=" + format, None, | 
					
						
							|  |  |  |                         ARCHIVE_FORMATS[format][2])) | 
					
						
							|  |  |  |     formats.sort() | 
					
						
							| 
									
										
										
										
											2009-05-14 12:45:48 +00:00
										 |  |  |     FancyGetopt(formats).print_help( | 
					
						
							| 
									
										
										
										
											2000-06-24 01:23:37 +00:00
										 |  |  |         "List of available source distribution formats:") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-14 15:21:26 +00:00
										 |  |  | class sdist(Command): | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     description = "create a source distribution (tarball, zip file, etc.)" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |     def checking_metadata(self): | 
					
						
							|  |  |  |         """Callable used for the check sub-command.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Placed here so user_options can view it"""
 | 
					
						
							|  |  |  |         return self.metadata_check | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-02-18 00:25:39 +00:00
										 |  |  |     user_options = [ | 
					
						
							|  |  |  |         ('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]"), | 
					
						
							| 
									
										
										
										
											2000-06-29 02:06:29 +00:00
										 |  |  |         ('no-defaults', None, | 
					
						
							|  |  |  |          "don't include the default file set"), | 
					
						
							|  |  |  |         ('prune', None, | 
					
						
							|  |  |  |          "specifically exclude files/directories that should not be " | 
					
						
							|  |  |  |          "distributed (build tree, RCS/CVS dirs, etc.) " | 
					
						
							|  |  |  |          "[default; disable with --no-prune]"), | 
					
						
							|  |  |  |         ('no-prune', None, | 
					
						
							|  |  |  |          "don't automatically exclude anything"), | 
					
						
							| 
									
										
										
										
											2000-04-26 01:14:33 +00:00
										 |  |  |         ('manifest-only', 'o', | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |          "just regenerate the manifest and then stop " | 
					
						
							|  |  |  |          "(implies --force-manifest)"), | 
					
						
							| 
									
										
										
										
											2000-04-26 01:14:33 +00:00
										 |  |  |         ('force-manifest', 'f', | 
					
						
							| 
									
										
										
										
											2010-05-17 11:04:41 +00:00
										 |  |  |          "forcibly regenerate the manifest and carry on as usual. " | 
					
						
							|  |  |  |          "Deprecated: now the manifest is always regenerated."), | 
					
						
							| 
									
										
										
										
											2000-02-18 00:25:39 +00:00
										 |  |  |         ('formats=', None, | 
					
						
							| 
									
										
										
										
											2000-06-24 00:23:20 +00:00
										 |  |  |          "formats for source distribution (comma-separated list)"), | 
					
						
							| 
									
										
										
										
											2000-09-25 01:51:01 +00:00
										 |  |  |         ('keep-temp', 'k', | 
					
						
							| 
									
										
										
										
											2000-02-18 00:25:39 +00:00
										 |  |  |          "keep the distribution tree around after creating " + | 
					
						
							|  |  |  |          "archive file(s)"), | 
					
						
							| 
									
										
										
										
											2000-07-05 03:06:46 +00:00
										 |  |  |         ('dist-dir=', 'd', | 
					
						
							|  |  |  |          "directory to put the source distribution archive(s) in " | 
					
						
							|  |  |  |          "[default: dist]"), | 
					
						
							| 
									
										
										
										
											2010-09-11 15:30:19 +00:00
										 |  |  |         ('metadata-check', None, | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |          "Ensure that all required elements of meta-data " | 
					
						
							|  |  |  |          "are supplied. Warn if any missing. [default]"), | 
					
						
							| 
									
										
										
										
											2000-02-18 00:25:39 +00:00
										 |  |  |         ] | 
					
						
							| 
									
										
										
										
											2000-06-08 00:14:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-25 01:41:15 +00:00
										 |  |  |     boolean_options = ['use-defaults', 'prune', | 
					
						
							|  |  |  |                        'manifest-only', 'force-manifest', | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |                        'keep-temp', 'metadata-check'] | 
					
						
							| 
									
										
										
										
											2000-06-08 00:14:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-07 03:00:06 +00:00
										 |  |  |     help_options = [ | 
					
						
							|  |  |  |         ('help-formats', None, | 
					
						
							| 
									
										
										
										
											2000-06-24 00:23:20 +00:00
										 |  |  |          "list available distribution formats", show_formats), | 
					
						
							| 
									
										
										
										
											2000-10-14 04:06:40 +00:00
										 |  |  |         ] | 
					
						
							| 
									
										
										
										
											2000-06-07 03:00:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-29 02:06:29 +00:00
										 |  |  |     negative_opt = {'no-defaults': 'use-defaults', | 
					
						
							|  |  |  |                     'no-prune': 'prune' } | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-14 15:21:26 +00:00
										 |  |  |     default_format = {'posix': 'gztar', | 
					
						
							|  |  |  |                       'nt': 'zip' } | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |     sub_commands = [('check', checking_metadata)] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def initialize_options(self): | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         # 'template' and 'manifest' are, respectively, the names of | 
					
						
							|  |  |  |         # the manifest template and manifest file. | 
					
						
							|  |  |  |         self.template = None | 
					
						
							|  |  |  |         self.manifest = None | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # 'use_defaults': if true, we will include the default file set | 
					
						
							|  |  |  |         # in the manifest | 
					
						
							|  |  |  |         self.use_defaults = 1 | 
					
						
							| 
									
										
										
										
											2000-06-29 02:06:29 +00:00
										 |  |  |         self.prune = 1 | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.manifest_only = 0 | 
					
						
							|  |  |  |         self.force_manifest = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.formats = None | 
					
						
							| 
									
										
										
										
											2000-09-25 01:51:01 +00:00
										 |  |  |         self.keep_temp = 0 | 
					
						
							| 
									
										
										
										
											2000-07-05 03:06:46 +00:00
										 |  |  |         self.dist_dir = None | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  |         self.archive_files = None | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |         self.metadata_check = 1 | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def finalize_options(self): | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         if self.manifest is None: | 
					
						
							|  |  |  |             self.manifest = "MANIFEST" | 
					
						
							|  |  |  |         if self.template is None: | 
					
						
							|  |  |  |             self.template = "MANIFEST.in" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-04 15:12:51 +00:00
										 |  |  |         self.ensure_string_list('formats') | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         if self.formats is None: | 
					
						
							|  |  |  |             try: | 
					
						
							|  |  |  |                 self.formats = [self.default_format[os.name]] | 
					
						
							|  |  |  |             except KeyError: | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |                 raise DistutilsPlatformError( | 
					
						
							|  |  |  |                       "don't know how to create source distributions " | 
					
						
							|  |  |  |                       "on platform %s" % os.name) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         bad_format = archive_util.check_archive_formats(self.formats) | 
					
						
							| 
									
										
										
										
											2000-04-22 03:11:55 +00:00
										 |  |  |         if bad_format: | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |             raise DistutilsOptionError( | 
					
						
							|  |  |  |                   "unknown archive format '%s'" % bad_format) | 
					
						
							| 
									
										
										
										
											2000-04-22 03:11:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-07-05 03:06:46 +00:00
										 |  |  |         if self.dist_dir is None: | 
					
						
							|  |  |  |             self.dist_dir = "dist" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def run(self): | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         # 'filelist' contains the list of files that will make up the | 
					
						
							|  |  |  |         # manifest | 
					
						
							|  |  |  |         self.filelist = FileList() | 
					
						
							| 
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |         # Run sub commands | 
					
						
							|  |  |  |         for cmd_name in self.get_sub_commands(): | 
					
						
							|  |  |  |             self.run_command(cmd_name) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # Do whatever it takes to get the list of files to process | 
					
						
							|  |  |  |         # (process the manifest template, read an existing manifest, | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         # whatever).  File list is accumulated in 'self.filelist'. | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         self.get_file_list() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # If user just wanted us to regenerate the manifest, stop now. | 
					
						
							|  |  |  |         if self.manifest_only: | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # Otherwise, go ahead and create the source distribution tarball, | 
					
						
							|  |  |  |         # or zipfile, or whatever. | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         self.make_distribution() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def check_metadata(self): | 
					
						
							| 
									
										
										
										
											2009-05-16 16:52:13 +00:00
										 |  |  |         """Deprecated API.""" | 
					
						
							|  |  |  |         warn("distutils.command.sdist.check_metadata is deprecated, \
 | 
					
						
							|  |  |  |               use the check command instead", PendingDeprecationWarning) | 
					
						
							|  |  |  |         check = self.distribution.get_command_obj('check') | 
					
						
							|  |  |  |         check.ensure_finalized() | 
					
						
							|  |  |  |         check.run() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def get_file_list(self): | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         """Figure out the list of files to include in the source
 | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         distribution, and put it in 'self.filelist'.  This might involve | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         reading the manifest template (and writing the manifest), or just | 
					
						
							|  |  |  |         reading the manifest, or just using the default file set -- it all | 
					
						
							| 
									
										
										
										
											2010-05-17 10:48:29 +00:00
										 |  |  |         depends on the user's options. | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |         # new behavior when using a template: | 
					
						
							| 
									
										
										
										
											2010-05-17 10:48:29 +00:00
										 |  |  |         # the file list is recalculated everytime because | 
					
						
							|  |  |  |         # even if MANIFEST.in or setup.py are not changed | 
					
						
							|  |  |  |         # the user might have added some files in the tree that | 
					
						
							|  |  |  |         # need to be included. | 
					
						
							|  |  |  |         # | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |         #  This makes --force the default and only behavior with templates. | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         template_exists = os.path.isfile(self.template) | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |         if not template_exists and self._manifest_is_not_generated(): | 
					
						
							|  |  |  |             self.read_manifest() | 
					
						
							|  |  |  |             self.filelist.sort() | 
					
						
							|  |  |  |             self.filelist.remove_duplicates() | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-17 10:48:29 +00:00
										 |  |  |         if not template_exists: | 
					
						
							|  |  |  |             self.warn(("manifest template '%s' does not exist " + | 
					
						
							|  |  |  |                         "(using default file list)") % | 
					
						
							|  |  |  |                         self.template) | 
					
						
							|  |  |  |         self.filelist.findall() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if self.use_defaults: | 
					
						
							|  |  |  |             self.add_defaults() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         if template_exists: | 
					
						
							| 
									
										
										
										
											2010-05-17 10:48:29 +00:00
										 |  |  |             self.read_template() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if self.prune: | 
					
						
							|  |  |  |             self.prune_file_list() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.filelist.sort() | 
					
						
							|  |  |  |         self.filelist.remove_duplicates() | 
					
						
							|  |  |  |         self.write_manifest() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def add_defaults(self): | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         """Add all the default files to self.filelist:
 | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |           - README or README.txt | 
					
						
							|  |  |  |           - setup.py | 
					
						
							|  |  |  |           - test/test*.py | 
					
						
							|  |  |  |           - all pure Python modules mentioned in setup script | 
					
						
							| 
									
										
										
										
											2009-02-16 21:49:12 +00:00
										 |  |  |           - all files pointed by package_data (build_py) | 
					
						
							|  |  |  |           - all files defined in data_files. | 
					
						
							|  |  |  |           - all files defined as scripts. | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |           - 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. | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2000-09-06 02:08:24 +00:00
										 |  |  |         standards = [('README', 'README.txt'), self.distribution.script_name] | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         for fn in standards: | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |             if isinstance(fn, tuple): | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |                 alts = fn | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |                 got_it = False | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |                 for fn in alts: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                     if os.path.exists(fn): | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |                         got_it = True | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                         self.filelist.append(fn) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |                         break | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if not got_it: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                     self.warn("standard file not found: should have one of " + | 
					
						
							| 
									
										
										
										
											2007-04-17 08:48:32 +00:00
										 |  |  |                               ', '.join(alts)) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |             else: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                 if os.path.exists(fn): | 
					
						
							|  |  |  |                     self.filelist.append(fn) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |                 else: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                     self.warn("standard file '%s' not found" % fn) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-08 01:22:48 +00:00
										 |  |  |         optional = ['test/test*.py', 'setup.cfg'] | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         for pattern in optional: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             files = filter(os.path.isfile, glob(pattern)) | 
					
						
							| 
									
										
										
										
											2010-08-01 19:07:28 +00:00
										 |  |  |             self.filelist.extend(files) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-16 21:49:12 +00:00
										 |  |  |         # build_py is used to get: | 
					
						
							|  |  |  |         #  - python modules | 
					
						
							|  |  |  |         #  - files defined in package_data | 
					
						
							|  |  |  |         build_py = self.get_finalized_command('build_py') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # getting python files | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |         if self.distribution.has_pure_modules(): | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             self.filelist.extend(build_py.get_source_files()) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-16 21:49:12 +00:00
										 |  |  |         # getting package_data files | 
					
						
							|  |  |  |         # (computed in build_py.data_files by build_py.finalize_options) | 
					
						
							|  |  |  |         for pkg, src_dir, build_dir, filenames in build_py.data_files: | 
					
						
							|  |  |  |             for filename in filenames: | 
					
						
							|  |  |  |                 self.filelist.append(os.path.join(src_dir, filename)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # getting distribution.data_files | 
					
						
							|  |  |  |         if self.distribution.has_data_files(): | 
					
						
							| 
									
										
										
										
											2009-02-17 09:47:25 +00:00
										 |  |  |             for item in self.distribution.data_files: | 
					
						
							|  |  |  |                 if isinstance(item, str): # plain file | 
					
						
							|  |  |  |                     item = convert_path(item) | 
					
						
							|  |  |  |                     if os.path.isfile(item): | 
					
						
							|  |  |  |                         self.filelist.append(item) | 
					
						
							|  |  |  |                 else:    # a (dirname, filenames) tuple | 
					
						
							|  |  |  |                     dirname, filenames = item | 
					
						
							|  |  |  |                     for f in filenames: | 
					
						
							| 
									
										
										
										
											2009-02-17 23:10:18 +00:00
										 |  |  |                         f = convert_path(f) | 
					
						
							| 
									
										
										
										
											2009-02-17 09:47:25 +00:00
										 |  |  |                         if os.path.isfile(f): | 
					
						
							|  |  |  |                             self.filelist.append(f) | 
					
						
							| 
									
										
										
										
											2009-02-16 21:49:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |         if self.distribution.has_ext_modules(): | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             build_ext = self.get_finalized_command('build_ext') | 
					
						
							|  |  |  |             self.filelist.extend(build_ext.get_source_files()) | 
					
						
							| 
									
										
										
										
											2000-04-09 03:51:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if self.distribution.has_c_libraries(): | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             build_clib = self.get_finalized_command('build_clib') | 
					
						
							|  |  |  |             self.filelist.extend(build_clib.get_source_files()) | 
					
						
							| 
									
										
										
										
											2004-03-25 22:04:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if self.distribution.has_scripts(): | 
					
						
							|  |  |  |             build_scripts = self.get_finalized_command('build_scripts') | 
					
						
							|  |  |  |             self.filelist.extend(build_scripts.get_source_files()) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def read_template(self): | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |         """Read and parse manifest template file named by self.template.
 | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |         (usually "MANIFEST.in") The parsing and processing is done by | 
					
						
							|  |  |  |         'self.filelist', which updates itself accordingly. | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |         log.info("reading manifest template '%s'", self.template) | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |         template = TextFile(self.template, strip_comments=1, skip_blanks=1, | 
					
						
							|  |  |  |                             join_lines=1, lstrip_ws=1, rstrip_ws=1, | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                             collapse_join=1) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-17 14:27:07 +02:00
										 |  |  |         try: | 
					
						
							|  |  |  |             while True: | 
					
						
							|  |  |  |                 line = template.readline() | 
					
						
							|  |  |  |                 if line is None:            # end of file | 
					
						
							|  |  |  |                     break | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 try: | 
					
						
							|  |  |  |                     self.filelist.process_template_line(line) | 
					
						
							| 
									
										
										
										
											2011-09-03 00:42:04 +02:00
										 |  |  |                 # the call above can raise a DistutilsTemplateError for | 
					
						
							|  |  |  |                 # malformed lines, or a ValueError from the lower-level | 
					
						
							|  |  |  |                 # convert_path function | 
					
						
							|  |  |  |                 except (DistutilsTemplateError, ValueError) as msg: | 
					
						
							| 
									
										
										
										
											2011-04-17 14:27:07 +02:00
										 |  |  |                     self.warn("%s, line %d: %s" % (template.filename, | 
					
						
							|  |  |  |                                                    template.current_line, | 
					
						
							|  |  |  |                                                    msg)) | 
					
						
							|  |  |  |         finally: | 
					
						
							|  |  |  |             template.close() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def prune_file_list(self): | 
					
						
							| 
									
										
										
										
											2000-06-08 01:06:02 +00:00
										 |  |  |         """Prune off branches that might slip into the file list as created
 | 
					
						
							| 
									
										
										
										
											2000-06-29 02:06:29 +00:00
										 |  |  |         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" | 
					
						
							| 
									
										
										
										
											2000-09-25 01:51:01 +00:00
										 |  |  |             previously with --keep-temp, or it aborted) | 
					
						
							| 
									
										
											  
											
												Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
  Add more items; add fragmentary notes
........
  r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
  Issue#2238: some syntax errors from *args or **kwargs expressions
  would give bogus error messages, because of untested exceptions::
      >>> f(**g(1=2))
      XXX undetected error
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: 'int' object is not iterable
  instead of the expected SyntaxError: keyword can't be an expression
  Will backport.
........
  r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
  Remove the files/dirs after closing the DB so the tests work on Windows.
  Patch from Trent Nelson.  Also simplified removing a file by using test_support.
........
  r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
  Get this test to pass even when there is no sound card in the system.
  Patch from Trent Nelson.  (I can't test this.)
........
  r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
  Catch OSError when trying to remove a file in case removal fails. This
  should prevent a failure in tearDown masking any real test failure.
........
  r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
  Make the timeout longer to give slow machines a chance to pass the test
  before timing out.  This doesn't change the duration of the test under
  normal circumstances.  This is targetted at fixing the spurious failures
  on the FreeBSD buildbot primarily.
........
  r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
  Tabs -> spaces
........
  r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
  Use -u urlfetch to run more tests
........
  r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
  test_smtplib sometimes reports leaks too, suppress it
........
  r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
  Fix test_socketserver on Windows after r61099 added several signal.alarm()
  calls (which don't exist on non-Unix platforms).
  Thanks to Trent Nelson for the report and patch.
........
  r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
  Fix some rst.
........
  r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
  News entry for yesterdays commit.
........
  r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
  Issue 1872: Changed the struct module typecode from 't' to '?', for
  compatibility with PEP3118.
........
  r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
  Elaborate on the role of the altinstall target when installing multiple
  versions.
........
  r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
  #2239: PYTHONPATH delimiter is os.pathsep.
........
  r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
  C implementation of itertools.permutations().
........
  r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
  Small code cleanup.
........
  r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
  cd PCbuild only after deleting all pyc files.
........
  r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
  Add examples.
........
  r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
  Add two items
........
  r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
  #1725737: ignore other VC directories other than CVS and SVN's too.
........
  r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
  Patch #2232: os.tmpfile might fail on Windows if the user has no
  permission to create files in the root directory.
  Will backport to 2.5.
........
  r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
  Expand on re.split behavior with captured expressions.
........
  r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
  Little clarification of assignments.
........
  r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
  Add isinstance/issubclass to tutorial.
........
  r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
  Add missing NEWS entry for r61263.
........
  r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
  #2225: return nonzero status code from py_compile if not all files could be compiled.
........
  r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
  #2220: handle matching failure more gracefully.
........
  r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
  Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
  r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
  Rely on x64 platform configuration when building _bsddb on AMD64.
........
  r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
  Update db-4.4.20 build procedure.
........
  r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
  More tests.
........
  r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
  Issue 2246:  itertools grouper object did not participate in GC (should be backported).
........
  r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
  Tweak recipes and tests
........
  r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
  Progress on issue #1193577 by adding a polling .shutdown() method to
  SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
  are mine. I've also rearranged the code for timeouts in order to avoid
  interfering with the shutdown poll.
........
  r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
  Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
  r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
  Grammar fix
........
  r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
  #2253: fix continue vs. finally docs.
........
  r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
  Add new name for Mandrake: Mandriva.
........
  r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
  #1533486: fix types in refcount intro.
........
  r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
  Issue 1106316. post_mortem()'s parameter, traceback, is now
  optional: it defaults to the traceback of the exception that is currently
  being handled.
........
  r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
  Add tests for with and finally performance to pybench.
........
  r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
  Fix pybench for pythons < 2.6, tested back to 2.3.
........
  r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
  Well that was dumb. platform.python_implementation returns a function, not a
  string.
........
  r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
  #2249: document assertTrue and assertFalse.
........
  r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
  Introduce a lock to fix a race condition which caused an exception in the test.
  Some buildbots were consistently failing (e.g., amd64).
  Also remove a couple of semi-colons.
........
  r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
  Add recipe to docs.
........
  r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
  Fix the overflows in expandtabs().  "This time for sure!"
  (Exploit at request.)
........
  r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
  Improve docs for itemgetter().  Show that it works with slices.
........
  r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
  #2265: fix example.
........
  r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
  #2270: fix typo.
........
  r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
  #1720705: add docs about import/threading interaction, wording by Nick.
........
  r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
  Add class decorators
........
  r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
  Add 2-to-3 support for the itertools moved to builtins or renamed.
........
  r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
  Consistent tense.
........
  r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
  Issue 2274:  Add heapq.heappushpop().
........
  r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
  Simplify the nlargest() code using heappushpop().
........
  r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
  Move test_thread over to unittest. Commits GHOP 237.
  Thanks Benjamin Peterson for the patch.
........
  r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
  Move test_tokenize to doctest.
  Done as GHOP 238 by Josip Dzolonga.
........
  r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
  Convert test_contains, test_crypt, and test_select to unittest.
  Patch from GHOP 294 by David Marek.
........
  r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
  Move test_gdbm to use unittest.
  Closes issue #1960. Thanks Giampaolo Rodola.
........
  r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
  Convert test_fcntl to unittest.
  Closes issue #2055. Thanks Giampaolo Rodola.
........
  r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
  Leave heapreplace() unchanged.
........
  r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
  Patch #2284: add -x64 option to rt.bat.
........
  r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
  Use -x64 flag.
........
  r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
  Remove a bad test.
........
  r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
  Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
  across platforms:  it should now raise OverflowError on all
  platforms.  (Previously it raised OverflowError only on
  non IEEE 754 platforms.)
  Also fix the (already existing) test for this behaviour
  so that it actually raises TestFailed instead of just
  referencing it.
........
  r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
  Remove unneeded initializer.
........
  r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
  Run debug version, cd to PCbuild.
........
  r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
  Remove obsolete paragraph. #2288.
........
  r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
  Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
  r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
  note that fork and forkpty raise OSError on failure
........
  r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
  add %f format to datetime - issue 1158
........
  r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
  .
........
											
										 
											2008-03-16 00:07:10 +00:00
										 |  |  |           * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories | 
					
						
							| 
									
										
										
										
											2000-06-08 01:06:02 +00:00
										 |  |  |         """
 | 
					
						
							|  |  |  |         build = self.get_finalized_command('build') | 
					
						
							| 
									
										
										
										
											2000-05-27 03:03:23 +00:00
										 |  |  |         base_dir = self.distribution.get_fullname() | 
					
						
							| 
									
										
										
										
											2000-06-08 00:08:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         self.filelist.exclude_pattern(None, prefix=build.build_base) | 
					
						
							|  |  |  |         self.filelist.exclude_pattern(None, prefix=base_dir) | 
					
						
							| 
									
										
										
										
											2000-06-08 00:08:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-09 04:11:44 +00:00
										 |  |  |         if sys.platform == 'win32': | 
					
						
							|  |  |  |             seps = r'/|\\' | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             seps = '/' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr', | 
					
						
							|  |  |  |                     '_darcs'] | 
					
						
							|  |  |  |         vcs_ptrn = r'(^|%s)(%s)(%s).*' % (seps, '|'.join(vcs_dirs), seps) | 
					
						
							|  |  |  |         self.filelist.exclude_pattern(vcs_ptrn, is_regex=1) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-14 15:21:26 +00:00
										 |  |  |     def write_manifest(self): | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         """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'. | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |         if self._manifest_is_not_generated(): | 
					
						
							|  |  |  |             log.info("not writing to manually maintained " | 
					
						
							|  |  |  |                      "manifest file '%s'" % self.manifest) | 
					
						
							|  |  |  |             return | 
					
						
							| 
									
										
										
										
											2010-08-14 02:36:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         content = self.filelist.files[:] | 
					
						
							|  |  |  |         content.insert(0, '# file GENERATED by distutils, do NOT edit') | 
					
						
							|  |  |  |         self.execute(file_util.write_file, (self.manifest, content), | 
					
						
							| 
									
										
										
										
											2000-06-08 00:08:14 +00:00
										 |  |  |                      "writing manifest file '%s'" % self.manifest) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |     def _manifest_is_not_generated(self): | 
					
						
							|  |  |  |         # check for special comment used in 3.1.3 and higher | 
					
						
							|  |  |  |         if not os.path.isfile(self.manifest): | 
					
						
							|  |  |  |             return False | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         fp = open(self.manifest) | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             first_line = fp.readline() | 
					
						
							|  |  |  |         finally: | 
					
						
							|  |  |  |             fp.close() | 
					
						
							|  |  |  |         return first_line != '# file GENERATED by distutils, do NOT edit\n' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def read_manifest(self): | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         """Read the manifest file (named by 'self.manifest') and use it to
 | 
					
						
							| 
									
										
										
										
											2000-07-30 01:30:31 +00:00
										 |  |  |         fill in 'self.filelist', the list of files to include in the source | 
					
						
							| 
									
										
										
										
											2000-06-08 00:24:01 +00:00
										 |  |  |         distribution. | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |         log.info("reading manifest file '%s'", self.manifest) | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         manifest = open(self.manifest) | 
					
						
							| 
									
										
										
										
											2011-07-31 04:06:12 +02:00
										 |  |  |         for line in manifest: | 
					
						
							|  |  |  |             # ignore comments and blank lines | 
					
						
							|  |  |  |             line = line.strip() | 
					
						
							|  |  |  |             if line.startswith('#') or not line: | 
					
						
							|  |  |  |                 continue | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             self.filelist.append(line) | 
					
						
							| 
									
										
											  
											
												Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r60901 | eric.smith | 2008-02-19 14:21:56 +0100 (Tue, 19 Feb 2008) | 1 line
  Added PEP 3101.
........
  r60907 | georg.brandl | 2008-02-20 20:12:36 +0100 (Wed, 20 Feb 2008) | 2 lines
  Fixes contributed by Ori Avtalion.
........
  r60909 | eric.smith | 2008-02-21 00:34:22 +0100 (Thu, 21 Feb 2008) | 1 line
  Trim leading zeros from a floating point exponent, per C99.  See issue 1600.  As far as I know, this only affects Windows.  Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description).
........
  r60910 | eric.smith | 2008-02-21 00:39:28 +0100 (Thu, 21 Feb 2008) | 1 line
  Now that PyOS_ascii_formatd supports the 'n' format, simplify the float formatting code to just call it.
........
  r60918 | andrew.kuchling | 2008-02-21 15:23:38 +0100 (Thu, 21 Feb 2008) | 2 lines
  Close manifest file.
  This change doesn't make any difference to CPython, but is a necessary fix for Jython.
........
  r60921 | guido.van.rossum | 2008-02-21 18:46:16 +0100 (Thu, 21 Feb 2008) | 2 lines
  Remove news about float repr() -- issue 1580 is still in limbo.
........
  r60923 | guido.van.rossum | 2008-02-21 19:18:37 +0100 (Thu, 21 Feb 2008) | 5 lines
  Removed uses of dict.has_key() from distutils, and uses of
  callable() from copy_reg.py, so the interpreter now starts up
  without warnings when '-3' is given.  More work like this needs to
  be done in the rest of the stdlib.
........
  r60924 | thomas.heller | 2008-02-21 19:28:48 +0100 (Thu, 21 Feb 2008) | 4 lines
  configure.ac: Remove the configure check for _Bool, it is already done in the
  top-level Python configure script.
  configure, fficonfig.h.in: regenerated.
........
  r60925 | thomas.heller | 2008-02-21 19:52:20 +0100 (Thu, 21 Feb 2008) | 3 lines
  Replace 'has_key()' with 'in'.
  Replace 'raise Error, stuff' with 'raise Error(stuff)'.
........
  r60927 | raymond.hettinger | 2008-02-21 20:24:53 +0100 (Thu, 21 Feb 2008) | 1 line
  Update more instances of has_key().
........
  r60928 | guido.van.rossum | 2008-02-21 20:46:35 +0100 (Thu, 21 Feb 2008) | 3 lines
  Fix a few typos and layout glitches (more work is needed).
  Move 2.5 news to Misc/HISTORY.
........
  r60936 | georg.brandl | 2008-02-21 21:33:38 +0100 (Thu, 21 Feb 2008) | 2 lines
  #2079: typo in userdict docs.
........
  r60938 | georg.brandl | 2008-02-21 21:38:13 +0100 (Thu, 21 Feb 2008) | 2 lines
  Part of #2154: minimal syntax fixes in doc example snippets.
........
  r60942 | raymond.hettinger | 2008-02-22 04:16:42 +0100 (Fri, 22 Feb 2008) | 1 line
  First draft for itertools.product().  Docs and other updates forthcoming.
........
  r60955 | nick.coghlan | 2008-02-22 11:54:06 +0100 (Fri, 22 Feb 2008) | 1 line
  Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery)
........
  r60956 | georg.brandl | 2008-02-22 13:31:45 +0100 (Fri, 22 Feb 2008) | 2 lines
  A lot more typo fixes by Ori Avtalion.
........
  r60957 | georg.brandl | 2008-02-22 13:56:34 +0100 (Fri, 22 Feb 2008) | 2 lines
  Don't reference pyshell.
........
  r60958 | georg.brandl | 2008-02-22 13:57:05 +0100 (Fri, 22 Feb 2008) | 2 lines
  Another fix.
........
											
										 
											2008-02-22 16:37:40 +00:00
										 |  |  |         manifest.close() | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def make_release_tree(self, base_dir, files): | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |         """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. | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |         # Create all the directories under 'base_dir' necessary to | 
					
						
							| 
									
										
										
										
											2000-09-06 02:18:59 +00:00
										 |  |  |         # put 'files' there; the 'mkpath()' is just so we don't die | 
					
						
							|  |  |  |         # if the manifest happens to be empty. | 
					
						
							|  |  |  |         self.mkpath(base_dir) | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |         dir_util.create_tree(base_dir, files, dry_run=self.dry_run) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # And walk over the list of files, either making a hard link (if | 
					
						
							|  |  |  |         # os.link exists) to each one that doesn't already exist in its | 
					
						
							|  |  |  |         # corresponding location under 'base_dir', or copying each file | 
					
						
							|  |  |  |         # that's out-of-date in 'base_dir'.  (Usually, all files will be | 
					
						
							|  |  |  |         # out-of-date, because by default we blow away 'base_dir' when | 
					
						
							|  |  |  |         # we're done making the distribution archives.) | 
					
						
							| 
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         if hasattr(os, 'link'):        # can make hard links on this system | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |             link = 'hard' | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |             msg = "making hard links in %s..." % base_dir | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |         else:                           # nope, have to copy | 
					
						
							|  |  |  |             link = None | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |             msg = "copying files to %s..." % base_dir | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-06 02:18:59 +00:00
										 |  |  |         if not files: | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |             log.warn("no files to distribute -- empty manifest?") | 
					
						
							| 
									
										
										
										
											2000-09-06 02:18:59 +00:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |             log.info(msg) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         for file in files: | 
					
						
							| 
									
										
										
										
											2000-09-06 02:18:59 +00:00
										 |  |  |             if not os.path.isfile(file): | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |                 log.warn("'%s' not a regular file -- skipping" % file) | 
					
						
							| 
									
										
										
										
											2000-09-06 02:18:59 +00:00
										 |  |  |             else: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |                 dest = os.path.join(base_dir, file) | 
					
						
							|  |  |  |                 self.copy_file(file, dest, link=link) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-03-22 03:10:05 +00:00
										 |  |  |         self.distribution.metadata.write_pkg_info(base_dir) | 
					
						
							| 
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def make_distribution(self): | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |         """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 | 
					
						
							| 
									
										
										
										
											2000-09-25 01:51:01 +00:00
										 |  |  |         'self.keep_temp' is true).  The list of archive files created is | 
					
						
							| 
									
										
										
										
											2000-06-08 00:46:45 +00:00
										 |  |  |         stored so it can be retrieved later by 'get_archive_files()'. | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2000-03-31 02:50:04 +00:00
										 |  |  |         # Don't warn about missing meta-data here -- should be (and is!) | 
					
						
							|  |  |  |         # done elsewhere. | 
					
						
							| 
									
										
										
										
											2000-04-22 02:51:25 +00:00
										 |  |  |         base_dir = self.distribution.get_fullname() | 
					
						
							| 
									
										
										
										
											2000-07-05 03:06:46 +00:00
										 |  |  |         base_name = os.path.join(self.dist_dir, base_dir) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |         self.make_release_tree(base_dir, self.filelist.files) | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  |         archive_files = []              # remember names of files we create | 
					
						
							| 
									
										
										
										
											2009-01-26 17:23:20 +00:00
										 |  |  |         # tar archive must be created last to avoid overwrite and remove | 
					
						
							|  |  |  |         if 'tar' in self.formats: | 
					
						
							|  |  |  |             self.formats.append(self.formats.pop(self.formats.index('tar'))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  |         for fmt in self.formats: | 
					
						
							| 
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 |  |  |             file = self.make_archive(base_name, fmt, base_dir=base_dir) | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  |             archive_files.append(file) | 
					
						
							| 
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 |  |  |             self.distribution.dist_files.append(('sdist', '', file)) | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.archive_files = archive_files | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-25 01:51:01 +00:00
										 |  |  |         if not self.keep_temp: | 
					
						
							| 
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 |  |  |             dir_util.remove_tree(base_dir, dry_run=self.dry_run) | 
					
						
							| 
									
										
										
										
											2000-02-17 23:56:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-30 03:52:21 +00:00
										 |  |  |     def get_archive_files(self): | 
					
						
							| 
									
										
										
										
											2000-06-01 01:10:56 +00:00
										 |  |  |         """Return the list of archive files created when the command
 | 
					
						
							|  |  |  |         was run, or None if the command hasn't run yet. | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         return self.archive_files |