def _validate_path_args()

in awscli/customizations/s3/subcommands.py [0:0]


    def _validate_path_args(self):
        # If we're using a mv command, you can't copy the object onto itself.
        params = self.parameters
        if self.cmd == 'mv' and params['paths_type']=='s3s3':
            self._raise_if_mv_same_paths(params['src'], params['dest'])
            if self._should_validate_same_underlying_s3_paths():
                self._validate_same_underlying_s3_paths()
            if self._should_emit_validate_s3_paths_warning():
                self._emit_validate_s3_paths_warning()

        if params.get('checksum_algorithm'):
            self._raise_if_paths_type_incorrect_for_param(
                CHECKSUM_ALGORITHM['name'],
                params['paths_type'],
                ['locals3', 's3s3'])
        if params.get('checksum_mode'):
            self._raise_if_paths_type_incorrect_for_param(
                CHECKSUM_MODE['name'],
                params['paths_type'],
                ['s3local'])

        # If the user provided local path does not exist, hard fail because
        # we know that we will not be able to upload the file.
        if 'locals3' == params['paths_type'] and not params['is_stream']:
            if not os.path.exists(params['src']):
                raise RuntimeError(
                    'The user-provided path %s does not exist.' %
                    params['src'])
        # If the operation is downloading to a directory that does not exist,
        # create the directories so no warnings are thrown during the syncing
        # process.
        elif 's3local' == params['paths_type'] and params['dir_op']:
            if not os.path.exists(params['dest']):
                os.makedirs(params['dest'])