Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(273809)

Side by Side Diff: Lib/distutils/command/sdist.py

Issue 6516: reset owner/group to root for distutils tarballs
Patch Set: Created 5 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/distutils/command/bdist.py ('k') | Lib/distutils/tests/test_archive_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """distutils.command.sdist 1 """distutils.command.sdist
2 2
3 Implements the Distutils 'sdist' command (create a source distribution).""" 3 Implements the Distutils 'sdist' command (create a source distribution)."""
4 4
5 import os 5 import os
6 import string 6 import string
7 import sys 7 import sys
8 from types import * 8 from types import *
9 from glob import glob 9 from glob import glob
10 from warnings import warn 10 from warnings import warn
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 "formats for source distribution (comma-separated list)"), 67 "formats for source distribution (comma-separated list)"),
68 ('keep-temp', 'k', 68 ('keep-temp', 'k',
69 "keep the distribution tree around after creating " + 69 "keep the distribution tree around after creating " +
70 "archive file(s)"), 70 "archive file(s)"),
71 ('dist-dir=', 'd', 71 ('dist-dir=', 'd',
72 "directory to put the source distribution archive(s) in " 72 "directory to put the source distribution archive(s) in "
73 "[default: dist]"), 73 "[default: dist]"),
74 ('metadata-check', None, 74 ('metadata-check', None,
75 "Ensure that all required elements of meta-data " 75 "Ensure that all required elements of meta-data "
76 "are supplied. Warn if any missing. [default]"), 76 "are supplied. Warn if any missing. [default]"),
77 ('owner=', 'u',
78 "Owner name used when creating a tar file [default: current user]"),
79 ('group=', 'g',
80 "Group name used when creating a tar file [default: current group]"),
77 ] 81 ]
78 82
79 boolean_options = ['use-defaults', 'prune', 83 boolean_options = ['use-defaults', 'prune',
80 'manifest-only', 'force-manifest', 84 'manifest-only', 'force-manifest',
81 'keep-temp', 'metadata-check'] 85 'keep-temp', 'metadata-check']
82 86
83 help_options = [ 87 help_options = [
84 ('help-formats', None, 88 ('help-formats', None,
85 "list available distribution formats", show_formats), 89 "list available distribution formats", show_formats),
86 ] 90 ]
(...skipping 19 matching lines...) Expand all
106 110
107 self.manifest_only = 0 111 self.manifest_only = 0
108 self.force_manifest = 0 112 self.force_manifest = 0
109 113
110 self.formats = None 114 self.formats = None
111 self.keep_temp = 0 115 self.keep_temp = 0
112 self.dist_dir = None 116 self.dist_dir = None
113 117
114 self.archive_files = None 118 self.archive_files = None
115 self.metadata_check = 1 119 self.metadata_check = 1
120 self.owner = None
121 self.group = None
116 122
117 def finalize_options(self): 123 def finalize_options(self):
118 if self.manifest is None: 124 if self.manifest is None:
119 self.manifest = "MANIFEST" 125 self.manifest = "MANIFEST"
120 if self.template is None: 126 if self.template is None:
121 self.template = "MANIFEST.in" 127 self.template = "MANIFEST.in"
122 128
123 self.ensure_string_list('formats') 129 self.ensure_string_list('formats')
124 if self.formats is None: 130 if self.formats is None:
125 try: 131 try:
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 base_dir = self.distribution.get_fullname() 443 base_dir = self.distribution.get_fullname()
438 base_name = os.path.join(self.dist_dir, base_dir) 444 base_name = os.path.join(self.dist_dir, base_dir)
439 445
440 self.make_release_tree(base_dir, self.filelist.files) 446 self.make_release_tree(base_dir, self.filelist.files)
441 archive_files = [] # remember names of files we create 447 archive_files = [] # remember names of files we create
442 # tar archive must be created last to avoid overwrite and remove 448 # tar archive must be created last to avoid overwrite and remove
443 if 'tar' in self.formats: 449 if 'tar' in self.formats:
444 self.formats.append(self.formats.pop(self.formats.index('tar'))) 450 self.formats.append(self.formats.pop(self.formats.index('tar')))
445 451
446 for fmt in self.formats: 452 for fmt in self.formats:
447 file = self.make_archive(base_name, fmt, base_dir=base_dir) 453 file = self.make_archive(base_name, fmt, base_dir=base_dir,
454 owner=self.owner, group=self.group)
448 archive_files.append(file) 455 archive_files.append(file)
449 self.distribution.dist_files.append(('sdist', '', file)) 456 self.distribution.dist_files.append(('sdist', '', file))
450 457
451 self.archive_files = archive_files 458 self.archive_files = archive_files
452 459
453 if not self.keep_temp: 460 if not self.keep_temp:
454 dir_util.remove_tree(base_dir, dry_run=self.dry_run) 461 dir_util.remove_tree(base_dir, dry_run=self.dry_run)
455 462
456 def get_archive_files(self): 463 def get_archive_files(self):
457 """Return the list of archive files created when the command 464 """Return the list of archive files created when the command
458 was run, or None if the command hasn't run yet. 465 was run, or None if the command hasn't run yet.
459 """ 466 """
460 return self.archive_files 467 return self.archive_files
OLDNEW
« no previous file with comments | « Lib/distutils/command/bdist.py ('k') | Lib/distutils/tests/test_archive_util.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+