[Python-checkins] CVS: distutils/distutils/command sdist.py,1.39,1.40

Greg Ward python-dev@python.org
2000年7月29日 18:30:34 -0700


Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv26799
Modified Files:
	sdist.py 
Log Message:
Replaced 'self.files' with 'self.filelist': now we carry around a FileList
instance instead of a list of filenames. Simplifies the "sdist" command
only a bit, but should allow greater simplification of FileList.
Index: sdist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/sdist.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** sdist.py	2000年07月30日 01:05:02	1.39
--- sdist.py	2000年07月30日 01:30:31	1.40
***************
*** 129,134 ****
 def run (self):
 
! # 'files' is the list of files that will make up the manifest
! self.files = []
 
 # Ensure that all required meta-data is given; warn if not (but
--- 129,135 ----
 def run (self):
 
! # 'filelist' contains the list of files that will make up the
! # manifest
! self.filelist = FileList()
 
 # Ensure that all required meta-data is given; warn if not (but
***************
*** 138,142 ****
 # Do whatever it takes to get the list of files to process
 # (process the manifest template, read an existing manifest,
! # whatever). File list is put into 'self.files'.
 self.get_file_list ()
 
--- 139,143 ----
 # Do whatever it takes to get the list of files to process
 # (process the manifest template, read an existing manifest,
! # whatever). File list is accumulated in 'self.filelist'.
 self.get_file_list ()
 
***************
*** 185,189 ****
 def get_file_list (self):
 """Figure out the list of files to include in the source
! distribution, and put it in 'self.files'. 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
--- 186,190 ----
 def 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
***************
*** 193,199 ****
 # If we have a manifest template, see if it's newer than the
 # manifest; if so, we'll regenerate the manifest.
! template_exists = os.path.isfile (self.template)
 if template_exists:
! template_newer = newer (self.template, self.manifest)
 
 # The contents of the manifest file almost certainly depend on the
--- 194,200 ----
 # If we have a manifest template, see if it's newer than the
 # manifest; if so, we'll regenerate the manifest.
! template_exists = os.path.isfile(self.template)
 if template_exists:
! template_newer = newer(self.template, self.manifest)
 
 # The contents of the manifest file almost certainly depend on the
***************
*** 223,237 ****
 
 if not template_exists:
! self.warn (("manifest template '%s' does not exist " +
! "(using default file list)") %
! self.template)
 
 # Add default file set to 'files'
 if self.use_defaults:
! self.add_defaults ()
 
 # Read manifest template if it exists
 if template_exists:
! self.read_template ()
 
 # Prune away any directories that don't belong in the source
--- 224,238 ----
 
 if not template_exists:
! self.warn(("manifest template '%s' does not exist " +
! "(using default file list)") %
! self.template)
 
 # Add default file set to 'files'
 if self.use_defaults:
! self.add_defaults()
 
 # Read manifest template if it exists
 if template_exists:
! self.read_template()
 
 # Prune away any directories that don't belong in the source
***************
*** 242,263 ****
 # File list now complete -- sort it so that higher-level files
 # come first
! sortable_files = map (os.path.split, self.files)
! sortable_files.sort ()
! self.files = []
! for sort_tuple in sortable_files:
! self.files.append (apply (os.path.join, sort_tuple))
 
 # Remove duplicates from the file list
! for i in range (len(self.files)-1, 0, -1):
! if self.files[i] == self.files[i-1]:
! del self.files[i]
 
 # And write complete file list (including default file set) to
 # the manifest.
! self.write_manifest ()
 
 # Don't regenerate the manifest, just read it in.
 else:
! self.read_manifest ()
 
 # get_file_list ()
--- 243,258 ----
 # File list now complete -- sort it so that higher-level files
 # come first
! self.filelist.sort()
 
 # Remove duplicates from the file list
! self.filelist.remove_duplicates()
 
 # And write complete file list (including default file set) to
 # the manifest.
! self.write_manifest()
 
 # Don't regenerate the manifest, just read it in.
 else:
! self.read_manifest()
 
 # get_file_list ()
***************
*** 265,269 ****
 
 def add_defaults (self):
! """Add all the default files to self.files:
 - README or README.txt
 - setup.py
--- 260,264 ----
 
 def add_defaults (self):
! """Add all the default files to self.filelist:
 - README or README.txt
 - setup.py
***************
*** 287,291 ****
 if os.path.exists (fn):
 got_it = 1
! self.files.append (fn)
 break
 
--- 282,286 ----
 if os.path.exists (fn):
 got_it = 1
! self.filelist.append (fn)
 break
 
***************
*** 295,299 ****
 else:
 if os.path.exists (fn):
! self.files.append (fn)
 else:
 self.warn ("standard file '%s' not found" % fn)
--- 290,294 ----
 else:
 if os.path.exists (fn):
! self.filelist.append (fn)
 else:
 self.warn ("standard file '%s' not found" % fn)
***************
*** 303,319 ****
 files = filter (os.path.isfile, glob (pattern))
 if files:
! self.files.extend (files)
 
 if self.distribution.has_pure_modules():
 build_py = self.get_finalized_command ('build_py')
! self.files.extend (build_py.get_source_files ())
 
 if self.distribution.has_ext_modules():
 build_ext = self.get_finalized_command ('build_ext')
! self.files.extend (build_ext.get_source_files ())
 
 if self.distribution.has_c_libraries():
 build_clib = self.get_finalized_command ('build_clib')
! self.files.extend (build_clib.get_source_files ())
 
 # add_defaults ()
--- 298,314 ----
 files = filter (os.path.isfile, glob (pattern))
 if files:
! self.filelist.extend (files)
 
 if self.distribution.has_pure_modules():
 build_py = self.get_finalized_command ('build_py')
! self.filelist.extend (build_py.get_source_files ())
 
 if self.distribution.has_ext_modules():
 build_ext = self.get_finalized_command ('build_ext')
! self.filelist.extend (build_ext.get_source_files ())
 
 if self.distribution.has_c_libraries():
 build_clib = self.get_finalized_command ('build_clib')
! self.filelist.extend (build_clib.get_source_files ())
 
 # add_defaults ()
***************
*** 321,333 ****
 
 def read_template (self):
 """Read and parse the manifest template file named by
! 'self.template' (usually "MANIFEST.in"). Process all file
! specifications (include and exclude) in the manifest template and
! update 'self.files' accordingly (filenames may be added to
! or removed from 'self.files' based on the manifest template).
 """
- assert self.files is not None and type (self.files) is ListType
 self.announce("reading manifest template '%s'" % self.template)
- 
 template = TextFile (self.template,
 strip_comments=1,
--- 316,326 ----
 
 def read_template (self):
+ 
 """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.
 """
 self.announce("reading manifest template '%s'" % self.template)
 template = TextFile (self.template,
 strip_comments=1,
***************
*** 338,346 ****
 collapse_ws=1)
 
- # if we give Template() a list, it modifies this list
- filelist = FileList(files=self.files,
- warn=self.warn,
- debug_print=self.debug_print)
- 
 while 1:
 line = template.readline()
--- 331,334 ----
***************
*** 348,352 ****
 break
 
! filelist.process_template_line(line)
 
 # read_template ()
--- 336,340 ----
 break
 
! self.filelist.process_template_line(line)
 
 # read_template ()
***************
*** 364,383 ****
 base_dir = self.distribution.get_fullname()
 
! # if we give FileList a list, it modifies this list
! filelist = FileList(files=self.files,
! warn=self.warn,
! debug_print=self.debug_print)
! filelist.exclude_pattern(None, prefix=build.build_base)
! filelist.exclude_pattern(None, prefix=base_dir)
! filelist.exclude_pattern(r'/(RCS|CVS)/.*', is_regex=1)
 
 
 def write_manifest (self):
! """Write the file list in 'self.files' (presumably as filled in by
! 'add_defaults()' and 'read_template()') to the manifest file named
! by 'self.manifest'.
 """
 self.execute(write_file,
! (self.manifest, self.files),
 "writing manifest file '%s'" % self.manifest)
 
--- 352,367 ----
 base_dir = self.distribution.get_fullname()
 
! self.filelist.exclude_pattern(None, prefix=build.build_base)
! self.filelist.exclude_pattern(None, prefix=base_dir)
! self.filelist.exclude_pattern(r'/(RCS|CVS)/.*', is_regex=1)
 
 
 def 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'.
 """
 self.execute(write_file,
! (self.manifest, self.filelist.files),
 "writing manifest file '%s'" % self.manifest)
 
***************
*** 387,391 ****
 def read_manifest (self):
 """Read the manifest file (named by 'self.manifest') and use it to
! fill in 'self.files', the list of files to include in the source
 distribution.
 """
--- 371,375 ----
 def 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.
 """
***************
*** 398,402 ****
 if line[-1] == '\n':
 line = line[0:-1]
! self.files.append (line)
 
 # read_manifest ()
--- 382,386 ----
 if line[-1] == '\n':
 line = line[0:-1]
! self.filelist.append (line)
 
 # read_manifest ()
***************
*** 452,456 ****
 base_name = os.path.join(self.dist_dir, base_dir)
 
! self.make_release_tree (base_dir, self.files)
 archive_files = [] # remember names of files we create
 if self.dist_dir:
--- 436,440 ----
 base_name = os.path.join(self.dist_dir, base_dir)
 
! self.make_release_tree (base_dir, self.filelist.files)
 archive_files = [] # remember names of files we create
 if self.dist_dir:

AltStyle によって変換されたページ (->オリジナル) /