mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Don't assume GNU tar -- generate tar file and compress in separate steps.
Now supports the full range of intended formats (tar, ztar, gztar, zip). "-f" no longer a short option for "--formats" -- conflicts with new global option "--force"!
This commit is contained in:
		
							parent
							
								
									d6c30f66c7
								
							
						
					
					
						commit
						e1ada50559
					
				
					 1 changed files with 23 additions and 12 deletions
				
			
		|  | @ -129,7 +129,7 @@ | ||||||
| 
 | 
 | ||||||
| class Dist (Command): | class Dist (Command): | ||||||
| 
 | 
 | ||||||
|     options = [('formats=', 'f', |     options = [('formats=', None, | ||||||
|                 "formats for source distribution (tar, ztar, gztar, or zip)"), |                 "formats for source distribution (tar, ztar, gztar, or zip)"), | ||||||
|                ('manifest=', 'm', |                ('manifest=', 'm', | ||||||
|                 "name of manifest file"), |                 "name of manifest file"), | ||||||
|  | @ -385,17 +385,23 @@ def make_release_tree (self, base_dir, files): | ||||||
|     # make_release_tree () |     # make_release_tree () | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     def make_tarball (self, base_dir): |     def make_tarball (self, base_dir, compress="gzip"): | ||||||
| 
 | 
 | ||||||
|         # XXX GNU tar 1.13 has a nifty option to add a prefix directory. |         # XXX GNU tar 1.13 has a nifty option to add a prefix directory. | ||||||
|         # It's pretty new, though, so we certainly can't require it -- but |         # It's pretty new, though, so we certainly can't require it -- | ||||||
|         # it would be nice to take advantage of it to skip the "create a |         # but it would be nice to take advantage of it to skip the | ||||||
|         # tree of hardlinks" step! |         # "create a tree of hardlinks" step!  (Would also be nice to | ||||||
|  |         # detect GNU tar to use its 'z' option and save a step.) | ||||||
| 
 | 
 | ||||||
|         # But I am a lazy bastard, so I require GNU tar anyways. |         if compress is not None and compress not in ('gzip', 'compress'): | ||||||
|  |             raise ValueError, \ | ||||||
|  |                   "if given, 'compress' must be 'gzip' or 'compress'" | ||||||
| 
 | 
 | ||||||
|         archive_name = base_dir + ".tar.gz" |         archive_name = base_dir + ".tar" | ||||||
|         self.spawn (["tar", "-czf", archive_name, base_dir]) |         self.spawn (["tar", "-cf", archive_name, base_dir]) | ||||||
|  | 
 | ||||||
|  |         if compress: | ||||||
|  |             self.spawn ([compress, archive_name]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     def make_zipfile (self, base_dir): |     def make_zipfile (self, base_dir): | ||||||
|  | @ -425,10 +431,15 @@ def make_distribution (self): | ||||||
|         self.exclude_files (base_dir + "*") |         self.exclude_files (base_dir + "*") | ||||||
|   |   | ||||||
|         self.make_release_tree (base_dir, self.files) |         self.make_release_tree (base_dir, self.files) | ||||||
|         if 'gztar' in self.formats: |         for fmt in self.formats: | ||||||
|             self.make_tarball (base_dir) |             if fmt == 'gztar': | ||||||
|         if 'zip' in self.formats: |                 self.make_tarball (base_dir, compress='gzip') | ||||||
|             self.make_zipfile (base_dir) |             elif fmt == 'ztar': | ||||||
|  |                 self.make_tarball (base_dir, compress='compress') | ||||||
|  |             elif fmt == 'tar': | ||||||
|  |                 self.make_tarball (base_dir, compress=None) | ||||||
|  |             elif fmt == 'zip': | ||||||
|  |                 self.make_zipfile (base_dir) | ||||||
| 
 | 
 | ||||||
| # class Dist | # class Dist | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Greg Ward
						Greg Ward