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

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

Issue 6516: reset owner/group to root for distutils tarballs
Patch Set: Created 5 years, 11 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_dumb.py ('k') | Lib/distutils/command/sdist.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.bdist 1 """distutils.command.bdist
2 2
3 Implements the Distutils 'bdist' command (create a built [binary] 3 Implements the Distutils 'bdist' command (create a built [binary]
4 distribution).""" 4 distribution)."""
5 5
6 import os 6 import os
7 from distutils.core import Command 7 from distutils.core import Command
8 from distutils.errors import * 8 from distutils.errors import *
9 from distutils.util import get_platform 9 from distutils.util import get_platform
10 10
(...skipping 19 matching lines...) Expand all
30 ('plat-name=', 'p', 30 ('plat-name=', 'p',
31 "platform name to embed in generated filenames " 31 "platform name to embed in generated filenames "
32 "(default: %s)" % get_platform()), 32 "(default: %s)" % get_platform()),
33 ('formats=', None, 33 ('formats=', None,
34 "formats for distribution (comma-separated list)"), 34 "formats for distribution (comma-separated list)"),
35 ('dist-dir=', 'd', 35 ('dist-dir=', 'd',
36 "directory to put final built distributions in " 36 "directory to put final built distributions in "
37 "[default: dist]"), 37 "[default: dist]"),
38 ('skip-build', None, 38 ('skip-build', None,
39 "skip rebuilding everything (for testing/debugging)"), 39 "skip rebuilding everything (for testing/debugging)"),
40 ('owner=', 'u',
41 "Owner name used when creating a tar file"
42 " [default: current user]"),
43 ('group=', 'g',
44 "Group name used when creating a tar file"
45 " [default: current group]"),
40 ] 46 ]
41 47
42 boolean_options = ['skip-build'] 48 boolean_options = ['skip-build']
43 49
44 help_options = [ 50 help_options = [
45 ('help-formats', None, 51 ('help-formats', None,
46 "lists available distribution formats", show_formats), 52 "lists available distribution formats", show_formats),
47 ] 53 ]
48 54
49 # The following commands do not take a format option from bdist 55 # The following commands do not take a format option from bdist
(...skipping 20 matching lines...) Expand all
70 'msi': ('bdist_msi', "Microsoft Installer") 76 'msi': ('bdist_msi', "Microsoft Installer")
71 } 77 }
72 78
73 79
74 def initialize_options(self): 80 def initialize_options(self):
75 self.bdist_base = None 81 self.bdist_base = None
76 self.plat_name = None 82 self.plat_name = None
77 self.formats = None 83 self.formats = None
78 self.dist_dir = None 84 self.dist_dir = None
79 self.skip_build = 0 85 self.skip_build = 0
86 self.group = None
87 self.owner = None
80 88
81 def finalize_options(self): 89 def finalize_options(self):
82 # have to finalize 'plat_name' before 'bdist_base' 90 # have to finalize 'plat_name' before 'bdist_base'
83 if self.plat_name is None: 91 if self.plat_name is None:
84 if self.skip_build: 92 if self.skip_build:
85 self.plat_name = get_platform() 93 self.plat_name = get_platform()
86 else: 94 else:
87 self.plat_name = self.get_finalized_command('build').plat_name 95 self.plat_name = self.get_finalized_command('build').plat_name
88 96
89 # 'bdist_base' -- parent of per-built-distribution-format 97 # 'bdist_base' -- parent of per-built-distribution-format
(...skipping 24 matching lines...) Expand all
114 commands.append(self.format_command[format][0]) 122 commands.append(self.format_command[format][0])
115 except KeyError: 123 except KeyError:
116 raise DistutilsOptionError("invalid format '%s'" % format) 124 raise DistutilsOptionError("invalid format '%s'" % format)
117 125
118 # Reinitialize and run each command. 126 # Reinitialize and run each command.
119 for i in range(len(self.formats)): 127 for i in range(len(self.formats)):
120 cmd_name = commands[i] 128 cmd_name = commands[i]
121 sub_cmd = self.reinitialize_command(cmd_name) 129 sub_cmd = self.reinitialize_command(cmd_name)
122 if cmd_name not in self.no_format_option: 130 if cmd_name not in self.no_format_option:
123 sub_cmd.format = self.formats[i] 131 sub_cmd.format = self.formats[i]
132
133 # passing the owner and group names for tar archiving
134 if cmd_name == 'bdist_dumb':
135 sub_cmd.owner = self.owner
136 sub_cmd.group = self.group
124 137
125 # If we're going to need to run this command again, tell it to 138 # If we're going to need to run this command again, tell it to
126 # keep its temporary files around so subsequent runs go faster. 139 # keep its temporary files around so subsequent runs go faster.
127 if cmd_name in commands[i+1:]: 140 if cmd_name in commands[i+1:]:
128 sub_cmd.keep_temp = 1 141 sub_cmd.keep_temp = 1
129 self.run_command(cmd_name) 142 self.run_command(cmd_name)
OLDNEW
« no previous file with comments | « Lib/distutils/command/bdist_dumb.py ('k') | Lib/distutils/command/sdist.py » ('j') | no next file with comments »

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