in gslib/commands/rsync.py [0:0]
def _ParseOpts(self):
# exclude_symlinks is handled by Command parent class, so save in Command
# state rather than CopyHelperOpts.
self.exclude_symlinks = False
# continue_on_error is handled by Command parent class, so save in Command
# state rather than CopyHelperOpts.
self.continue_on_error = False
self.delete_extras = False
self.preserve_acl = False
self.preserve_posix_attrs = False
self.compute_file_checksums = False
self.dryrun = False
self.exclude_dirs = False
self.exclude_pattern = None
self.skip_old_files = False
self.ignore_existing = False
self.skip_unsupported_objects = False
# self.recursion_requested is initialized in command.py (so it can be
# checked in parent class for all commands).
canned_acl = None
# canned_acl is handled by a helper function in parent
# Command class, so save in Command state rather than CopyHelperOpts.
self.canned = None
# Files matching these extensions should be compressed.
# The gzip_encoded flag marks if the files should be compressed during
# the upload.
gzip_encoded = False
gzip_arg_exts = None
gzip_arg_all = None
if self.sub_opts:
for o, a in self.sub_opts:
if o == '-a':
canned_acl = a
self.canned = True
if o == '-c':
self.compute_file_checksums = True
# Note: In gsutil cp command this is specified using -c but here we use
# -C so we can use -c for checksum arg (to be consistent with Unix rsync
# command options).
elif o == '-C':
self.continue_on_error = True
elif o == '-d':
self.delete_extras = True
elif o == '-e':
self.exclude_symlinks = True
elif o == '-j':
gzip_encoded = True
gzip_arg_exts = [x.strip() for x in a.split(',')]
elif o == '-J':
gzip_encoded = True
gzip_arg_all = GZIP_ALL_FILES
elif o == '-n':
self.dryrun = True
elif o == '-p':
self.preserve_acl = True
elif o == '-P':
self.preserve_posix_attrs = True
if not IS_WINDOWS:
InitializePreservePosixData()
elif o == '-r' or o == '-R':
self.recursion_requested = True
elif o == '-u':
self.skip_old_files = True
elif o == '-i':
self.ignore_existing = True
elif o == '-U':
self.skip_unsupported_objects = True
elif o == '-x' or o == '-y':
if o == '-y':
self.exclude_dirs = True
if not a:
raise CommandException('Invalid blank exclude filter')
try:
self.exclude_pattern = re.compile(a)
except re.error:
raise CommandException('Invalid exclude filter (%s)' % a)
if self.preserve_acl and canned_acl:
raise CommandException(
'Specifying both the -p and -a options together is invalid.')
if gzip_arg_exts and gzip_arg_all:
raise CommandException(
'Specifying both the -j and -J options together is invalid.')
self.gzip_encoded = gzip_encoded
self.gzip_exts = gzip_arg_exts or gzip_arg_all
return CreateCopyHelperOpts(
canned_acl=canned_acl,
preserve_acl=self.preserve_acl,
skip_unsupported_objects=self.skip_unsupported_objects)