~duplicity-team/duplicity/0.7-series

« back to all changes in this revision

Viewing changes to duplicity/commandline.py

  • Committer: Kenneth Loafman
  • Date: 2014-12-12 14:39:54 UTC
  • Revision ID: kenneth@loafman.com-20141212143954-wyln65yd1ynzsrlx
* Source formatted, using PyDev, all source files to fix some easily fixed
  PEP8 issues. Use ignore space when comparing against previous versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
        encoding = getattr(file, "encoding", None)
192
192
        return encoding or 'utf-8'
193
193
 
194
 
    def print_help(self, file = None):
 
194
    def print_help(self, file=None):
195
195
        """
196
196
        overwrite method with proper utf-8 decoding
197
197
        """
240
240
    def add_rename(o, s, v, p):
241
241
        globals.rename[os.path.normcase(os.path.normpath(v[0]))] = v[1]
242
242
 
243
 
    parser = OPHelpFix(option_class = DupOption, usage = usage())
 
243
    parser = OPHelpFix(option_class=DupOption, usage=usage())
244
244
 
245
245
    # If this is true, only warn and don't raise fatal error when backup
246
246
    # source directory doesn't match previous backup source directory.
247
 
    parser.add_option("--allow-source-mismatch", action = "store_true")
 
247
    parser.add_option("--allow-source-mismatch", action="store_true")
248
248
 
249
249
    # Set to the path of the archive directory (the directory which
250
250
    # contains the signatures and manifests of the relevent backup
251
251
    # collection), and for checkpoint state between volumes.
252
252
    # TRANSL: Used in usage help to represent a Unix-style path name. Example:
253
253
    # --archive-dir <path>
254
 
    parser.add_option("--archive-dir", type = "file", metavar = _("path"))
 
254
    parser.add_option("--archive-dir", type="file", metavar=_("path"))
255
255
 
256
256
    # Asynchronous put/get concurrency limit
257
257
    # (default of 0 disables asynchronicity).
258
 
    parser.add_option("--asynchronous-upload", action = "store_const", const = 1,
259
 
                      dest = "async_concurrency")
 
258
    parser.add_option("--asynchronous-upload", action="store_const", const=1,
 
259
                      dest="async_concurrency")
260
260
 
261
 
    parser.add_option("--compare-data", action = "store_true")
 
261
    parser.add_option("--compare-data", action="store_true")
262
262
 
263
263
    # config dir for future use
264
 
    parser.add_option("--config-dir", type = "file", metavar = _("path"),
265
 
                      help = optparse.SUPPRESS_HELP)
 
264
    parser.add_option("--config-dir", type="file", metavar=_("path"),
 
265
                      help=optparse.SUPPRESS_HELP)
266
266
 
267
267
    # for testing -- set current time
268
 
    parser.add_option("--current-time", type = "int",
269
 
                      dest = "current_time", help = optparse.SUPPRESS_HELP)
 
268
    parser.add_option("--current-time", type="int",
 
269
                      dest="current_time", help=optparse.SUPPRESS_HELP)
270
270
 
271
271
    # Don't actually do anything, but still report what would be done
272
 
    parser.add_option("--dry-run", action = "store_true")
 
272
    parser.add_option("--dry-run", action="store_true")
273
273
 
274
274
    # TRANSL: Used in usage help to represent an ID for a GnuPG key. Example:
275
275
    # --encrypt-key <gpg_key_id>
276
 
    parser.add_option("--encrypt-key", type = "string", metavar = _("gpg-key-id"),
277
 
                      dest = "", action = "callback",
278
 
                      callback = lambda o, s, v, p: globals.gpg_profile.recipients.append(v))  # @UndefinedVariable
 
276
    parser.add_option("--encrypt-key", type="string", metavar=_("gpg-key-id"),
 
277
                      dest="", action="callback",
 
278
                      callback=lambda o, s, v, p: globals.gpg_profile.recipients.append(v))  # @UndefinedVariable
279
279
 
280
280
    # secret keyring in which the private encrypt key can be found
281
 
    parser.add_option("--encrypt-secret-keyring", type = "string", metavar = _("path"))
 
281
    parser.add_option("--encrypt-secret-keyring", type="string", metavar=_("path"))
282
282
 
283
 
    parser.add_option("--encrypt-sign-key", type = "string", metavar = _("gpg-key-id"),
284
 
                      dest = "", action = "callback",
285
 
                      callback = lambda o, s, v, p: (globals.gpg_profile.recipients.append(v), set_sign_key(v)))
 
283
    parser.add_option("--encrypt-sign-key", type="string", metavar=_("gpg-key-id"),
 
284
                      dest="", action="callback",
 
285
                      callback=lambda o, s, v, p: (globals.gpg_profile.recipients.append(v), set_sign_key(v)))
286
286
 
287
287
    # TRANSL: Used in usage help to represent a "glob" style pattern for
288
288
    # matching one or more files, as described in the documentation.
289
289
    # Example:
290
290
    # --exclude <shell_pattern>
291
 
    parser.add_option("--exclude", action = "callback", metavar = _("shell_pattern"),
292
 
                      dest = "", type = "string", callback = add_selection)
293
 
 
294
 
    parser.add_option("--exclude-device-files", action = "callback",
295
 
                      dest = "", callback = add_selection)
296
 
 
297
 
    parser.add_option("--exclude-filelist", type = "file", metavar = _("filename"),
298
 
                      dest = "", action = "callback", callback = add_filelist)
299
 
 
300
 
    parser.add_option("--exclude-filelist-stdin", action = "callback", dest = "",
301
 
                      callback = lambda o, s, v, p: (select_opts.append(("--exclude-filelist", "standard input")),
 
291
    parser.add_option("--exclude", action="callback", metavar=_("shell_pattern"),
 
292
                      dest="", type="string", callback=add_selection)
 
293
 
 
294
    parser.add_option("--exclude-device-files", action="callback",
 
295
                      dest="", callback=add_selection)
 
296
 
 
297
    parser.add_option("--exclude-filelist", type="file", metavar=_("filename"),
 
298
                      dest="", action="callback", callback=add_filelist)
 
299
 
 
300
    parser.add_option("--exclude-filelist-stdin", action="callback", dest="",
 
301
                      callback=lambda o, s, v, p: (select_opts.append(("--exclude-filelist", "standard input")),
302
302
                                                   select_files.append(sys.stdin)))
303
303
 
304
 
    parser.add_option("--exclude-globbing-filelist", type = "file", metavar = _("filename"),
305
 
                      dest = "", action = "callback", callback = add_filelist)
 
304
    parser.add_option("--exclude-globbing-filelist", type="file", metavar=_("filename"),
 
305
                      dest="", action="callback", callback=add_filelist)
306
306
 
307
307
    # TRANSL: Used in usage help to represent the name of a file. Example:
308
308
    # --log-file <filename>
309
 
    parser.add_option("--exclude-if-present", metavar = _("filename"), dest = "",
310
 
                      type = "file", action = "callback", callback = add_selection)
 
309
    parser.add_option("--exclude-if-present", metavar=_("filename"), dest="",
 
310
                      type="file", action="callback", callback=add_selection)
311
311
 
312
 
    parser.add_option("--exclude-other-filesystems", action = "callback",
313
 
                      dest = "", callback = add_selection)
 
312
    parser.add_option("--exclude-other-filesystems", action="callback",
 
313
                      dest="", callback=add_selection)
314
314
 
315
315
    # TRANSL: Used in usage help to represent a regular expression (regexp).
316
 
    parser.add_option("--exclude-regexp", metavar = _("regular_expression"),
317
 
                      dest = "", type = "string", action = "callback", callback = add_selection)
 
316
    parser.add_option("--exclude-regexp", metavar=_("regular_expression"),
 
317
                      dest="", type="string", action="callback", callback=add_selection)
318
318
 
319
319
    # Whether we should be particularly aggressive when cleaning up
320
 
    parser.add_option("--extra-clean", action = "store_true")
 
320
    parser.add_option("--extra-clean", action="store_true")
321
321
 
322
322
    # used in testing only - raises exception after volume
323
 
    parser.add_option("--fail-on-volume", type = "int",
324
 
                      help = optparse.SUPPRESS_HELP)
 
323
    parser.add_option("--fail-on-volume", type="int",
 
324
                      help=optparse.SUPPRESS_HELP)
325
325
 
326
326
    # used to provide a prefix on top of the defaul tar file name
327
 
    parser.add_option("--file-prefix", type = "string", dest = "file_prefix", action = "store")
 
327
    parser.add_option("--file-prefix", type="string", dest="file_prefix", action="store")
328
328
 
329
329
    # used to provide a suffix for manifest files only
330
 
    parser.add_option("--file-prefix-manifest", type = "string", dest = "file_prefix_manifest", action = "store")
 
330
    parser.add_option("--file-prefix-manifest", type="string", dest="file_prefix_manifest", action="store")
331
331
 
332
332
    # used to provide a suffix for archive files only
333
 
    parser.add_option("--file-prefix-archive", type = "string", dest = "file_prefix_archive", action = "store")
 
333
    parser.add_option("--file-prefix-archive", type="string", dest="file_prefix_archive", action="store")
334
334
 
335
335
    # used to provide a suffix for sigature files only
336
 
    parser.add_option("--file-prefix-signature", type = "string", dest = "file_prefix_signature", action = "store")
 
336
    parser.add_option("--file-prefix-signature", type="string", dest="file_prefix_signature", action="store")
337
337
 
338
338
    # used in testing only - skips upload for a given volume
339
 
    parser.add_option("--skip-volume", type = "int",
340
 
                      help = optparse.SUPPRESS_HELP)
 
339
    parser.add_option("--skip-volume", type="int",
 
340
                      help=optparse.SUPPRESS_HELP)
341
341
 
342
342
    # If set, restore only the subdirectory or file specified, not the
343
343
    # whole root.
344
344
    # TRANSL: Used in usage help to represent a Unix-style path name. Example:
345
345
    # --archive-dir <path>
346
 
    parser.add_option("--file-to-restore", "-r", action = "callback", type = "file",
347
 
                      metavar = _("path"), dest = "restore_dir",
348
 
                      callback = lambda o, s, v, p: setattr(p.values, "restore_dir", v.rstrip('/')))
 
346
    parser.add_option("--file-to-restore", "-r", action="callback", type="file",
 
347
                      metavar=_("path"), dest="restore_dir",
 
348
                      callback=lambda o, s, v, p: setattr(p.values, "restore_dir", v.rstrip('/')))
349
349
 
350
350
    # Used to confirm certain destructive operations like deleting old files.
351
 
    parser.add_option("--force", action = "store_true")
 
351
    parser.add_option("--force", action="store_true")
352
352
 
353
353
    # FTP data connection type
354
 
    parser.add_option("--ftp-passive", action = "store_const", const = "passive", dest = "ftp_connection")
355
 
    parser.add_option("--ftp-regular", action = "store_const", const = "regular", dest = "ftp_connection")
 
354
    parser.add_option("--ftp-passive", action="store_const", const="passive", dest="ftp_connection")
 
355
    parser.add_option("--ftp-regular", action="store_const", const="regular", dest="ftp_connection")
356
356
 
357
357
    # If set, forces a full backup if the last full backup is older than
358
358
    # the time specified
359
 
    parser.add_option("--full-if-older-than", type = "time", dest = "full_force_time", metavar = _("time"))
 
359
    parser.add_option("--full-if-older-than", type="time", dest="full_force_time", metavar=_("time"))
360
360
 
361
 
    parser.add_option("--gio",action = "callback", dest = "use_gio",
362
 
                      callback = lambda o, s, v, p: (setattr(p.values, o.dest, True),
 
361
    parser.add_option("--gio", action="callback", dest="use_gio",
 
362
                      callback=lambda o, s, v, p: (setattr(p.values, o.dest, True),
363
363
                                                     old_fn_deprecation(s)))
364
364
 
365
 
    parser.add_option("--gpg-options", action = "extend", metavar = _("options"))
 
365
    parser.add_option("--gpg-options", action="extend", metavar=_("options"))
366
366
 
367
367
    # TRANSL: Used in usage help to represent an ID for a hidden GnuPG key. Example:
368
368
    # --hidden-encrypt-key <gpg_key_id>
369
 
    parser.add_option("--hidden-encrypt-key", type = "string", metavar = _("gpg-key-id"),
370
 
                      dest = "", action = "callback",
371
 
                      callback = lambda o, s, v, p: globals.gpg_profile.hidden_recipients.append(v))  # @UndefinedVariable
 
369
    parser.add_option("--hidden-encrypt-key", type="string", metavar=_("gpg-key-id"),
 
370
                      dest="", action="callback",
 
371
                      callback=lambda o, s, v, p: globals.gpg_profile.hidden_recipients.append(v))  # @UndefinedVariable
372
372
 
373
373
    # ignore (some) errors during operations; supposed to make it more
374
374
    # likely that you are able to restore data under problematic
375
375
    # circumstances. the default should absolutely always be False unless
376
376
    # you know what you are doing.
377
 
    parser.add_option("--ignore-errors", action = "callback",
378
 
                      dest = "ignore_errors",
379
 
                      callback = lambda o, s, v, p: (log.Warn(
 
377
    parser.add_option("--ignore-errors", action="callback",
 
378
                      dest="ignore_errors",
 
379
                      callback=lambda o, s, v, p: (log.Warn(
380
380
                          _("Running in 'ignore errors' mode due to %s; please "
381
381
                            "re-consider if this was not intended") % s),
382
382
                          setattr(p.values, "ignore_errors", True)))
384
384
    # Whether to use the full email address as the user name when
385
385
    # logging into an imap server. If false just the user name
386
386
    # part of the email address is used.
387
 
    parser.add_option("--imap-full-address", action = "store_true",
388
 
                      help = optparse.SUPPRESS_HELP)
 
387
    parser.add_option("--imap-full-address", action="store_true",
 
388
                      help=optparse.SUPPRESS_HELP)
389
389
 
390
390
    # Name of the imap folder where we want to store backups.
391
391
    # Can be changed with a command line argument.
392
392
    # TRANSL: Used in usage help to represent an imap mailbox
393
 
    parser.add_option("--imap-mailbox", metavar = _("imap_mailbox"))
 
393
    parser.add_option("--imap-mailbox", metavar=_("imap_mailbox"))
394
394
 
395
 
    parser.add_option("--include", action = "callback", metavar = _("shell_pattern"),
396
 
                      dest = "", type = "string", callback = add_selection)
397
 
    parser.add_option("--include-filelist", type = "file", metavar = _("filename"),
398
 
                      dest = "", action = "callback", callback = add_filelist)
399
 
    parser.add_option("--include-filelist-stdin", action = "callback", dest = "",
400
 
                      callback = lambda o, s, v, p: (select_opts.append(("--include-filelist", "standard input")),
 
395
    parser.add_option("--include", action="callback", metavar=_("shell_pattern"),
 
396
                      dest="", type="string", callback=add_selection)
 
397
    parser.add_option("--include-filelist", type="file", metavar=_("filename"),
 
398
                      dest="", action="callback", callback=add_filelist)
 
399
    parser.add_option("--include-filelist-stdin", action="callback", dest="",
 
400
                      callback=lambda o, s, v, p: (select_opts.append(("--include-filelist", "standard input")),
401
401
                                                   select_files.append(sys.stdin)))
402
 
    parser.add_option("--include-globbing-filelist", type = "file", metavar = _("filename"),
403
 
                      dest = "", action = "callback", callback = add_filelist)
404
 
    parser.add_option("--include-regexp", metavar = _("regular_expression"), dest = "",
405
 
                      type = "string", action = "callback", callback = add_selection)
 
402
    parser.add_option("--include-globbing-filelist", type="file", metavar=_("filename"),
 
403
                      dest="", action="callback", callback=add_filelist)
 
404
    parser.add_option("--include-regexp", metavar=_("regular_expression"), dest="",
 
405
                      type="string", action="callback", callback=add_selection)
406
406
 
407
 
    parser.add_option("--log-fd", type = "int", metavar = _("file_descriptor"),
408
 
                      dest = "", action = "callback",
409
 
                      callback = lambda o, s, v, p: set_log_fd(v))
 
407
    parser.add_option("--log-fd", type="int", metavar=_("file_descriptor"),
 
408
                      dest="", action="callback",
 
409
                      callback=lambda o, s, v, p: set_log_fd(v))
410
410
 
411
411
    # TRANSL: Used in usage help to represent the name of a file. Example:
412
412
    # --log-file <filename>
413
 
    parser.add_option("--log-file", type = "file", metavar = _("filename"),
414
 
                      dest = "", action = "callback",
415
 
                      callback = lambda o, s, v, p: log.add_file(v))
 
413
    parser.add_option("--log-file", type="file", metavar=_("filename"),
 
414
                      dest="", action="callback",
 
415
                      callback=lambda o, s, v, p: log.add_file(v))
416
416
 
417
417
    # Maximum block size for large files
418
 
    parser.add_option("--max-blocksize", type = "int", metavar = _("number"))
 
418
    parser.add_option("--max-blocksize", type="int", metavar=_("number"))
419
419
 
420
420
    # TRANSL: Used in usage help (noun)
421
 
    parser.add_option("--name", dest = "backup_name", metavar = _("backup name"))
 
421
    parser.add_option("--name", dest="backup_name", metavar=_("backup name"))
422
422
 
423
423
    # If set to false, then do not encrypt files on remote system
424
 
    parser.add_option("--no-encryption", action = "store_false", dest = "encryption")
 
424
    parser.add_option("--no-encryption", action="store_false", dest="encryption")
425
425
 
426
426
    # If set to false, then do not compress files on remote system
427
 
    parser.add_option("--no-compression", action = "store_false", dest = "compression")
 
427
    parser.add_option("--no-compression", action="store_false", dest="compression")
428
428
 
429
429
    # If set, print the statistics after every backup session
430
 
    parser.add_option("--no-print-statistics", action = "store_false", dest = "print_statistics")
 
430
    parser.add_option("--no-print-statistics", action="store_false", dest="print_statistics")
431
431
 
432
432
    # If true, filelists and directory statistics will be split on
433
433
    # nulls instead of newlines.
434
 
    parser.add_option("--null-separator", action = "store_true")
 
434
    parser.add_option("--null-separator", action="store_true")
435
435
 
436
436
    # number of retries on network operations
437
437
    # TRANSL: Used in usage help to represent a desired number of
438
438
    # something. Example:
439
439
    # --num-retries <number>
440
 
    parser.add_option("--num-retries", type = "int", metavar = _("number"))
 
440
    parser.add_option("--num-retries", type="int", metavar=_("number"))
441
441
 
442
442
    # File owner uid keeps number from tar file. Like same option in GNU tar.
443
 
    parser.add_option("--numeric-owner", action = "store_true")
 
443
    parser.add_option("--numeric-owner", action="store_true")
444
444
 
445
445
    # Whether the old filename format is in effect.
446
 
    parser.add_option("--old-filenames", action = "callback",
447
 
                      dest = "old_filenames",
448
 
                      callback = lambda o, s, v, p: (setattr(p.values, o.dest, True),
 
446
    parser.add_option("--old-filenames", action="callback",
 
447
                      dest="old_filenames",
 
448
                      callback=lambda o, s, v, p: (setattr(p.values, o.dest, True),
449
449
                                                   old_fn_deprecation(s)))
450
450
 
451
451
    # Level of Redundancy in % for Par2 files
452
 
    parser.add_option("--par2-redundancy", type = "int", metavar = _("number"))
 
452
    parser.add_option("--par2-redundancy", type="int", metavar=_("number"))
453
453
 
454
454
    # Verbatim par2 options
455
 
    parser.add_option("--par2-options", action = "extend", metavar = _("options"))
 
455
    parser.add_option("--par2-options", action="extend", metavar=_("options"))
456
456
 
457
457
    # Used to display the progress for the full and incremental backup operations
458
 
    parser.add_option("--progress", action = "store_true")
 
458
    parser.add_option("--progress", action="store_true")
459
459
 
460
460
    # Used to control the progress option update rate in seconds. Default: prompts each 3 seconds
461
 
    parser.add_option("--progress-rate", type = "int", metavar = _("number"))
 
461
    parser.add_option("--progress-rate", type="int", metavar=_("number"))
462
462
 
463
463
    # option to trigger Pydev debugger
464
 
    parser.add_option("--pydevd", action = "store_true")
 
464
    parser.add_option("--pydevd", action="store_true")
465
465
 
466
466
    # option to rename files during restore
467
 
    parser.add_option("--rename", type = "file", action = "callback", nargs = 2,
468
 
                      callback = add_rename)
 
467
    parser.add_option("--rename", type="file", action="callback", nargs=2,
 
468
                      callback=add_rename)
469
469
 
470
470
    # Restores will try to bring back the state as of the following time.
471
471
    # If it is None, default to current time.
472
472
    # TRANSL: Used in usage help to represent a time spec for a previous
473
473
    # point in time, as described in the documentation. Example:
474
474
    # duplicity remove-older-than time [options] target_url
475
 
    parser.add_option("--restore-time", "--time", "-t", type = "time", metavar = _("time"))
 
475
    parser.add_option("--restore-time", "--time", "-t", type="time", metavar=_("time"))
476
476
 
477
477
    # user added rsync options
478
 
    parser.add_option("--rsync-options", action = "extend", metavar = _("options"))
 
478
    parser.add_option("--rsync-options", action="extend", metavar=_("options"))
479
479
 
480
480
    # Whether to create European buckets (sorry, hard-coded to only
481
481
    # support european for now).
482
 
    parser.add_option("--s3-european-buckets", action = "store_true")
 
482
    parser.add_option("--s3-european-buckets", action="store_true")
483
483
 
484
484
    # Whether to use S3 Reduced Redudancy Storage
485
 
    parser.add_option("--s3-use-rrs", action = "store_true")
 
485
    parser.add_option("--s3-use-rrs", action="store_true")
486
486
 
487
487
    # Whether to use "new-style" subdomain addressing for S3 buckets. Such
488
488
    # use is not backwards-compatible with upper-case buckets, or buckets
489
489
    # that are otherwise not expressable in a valid hostname.
490
 
    parser.add_option("--s3-use-new-style", action = "store_true")
 
490
    parser.add_option("--s3-use-new-style", action="store_true")
491
491
 
492
492
    # Whether to use plain HTTP (without SSL) to send data to S3
493
493
    # See <https://bugs.launchpad.net/duplicity/+bug/433970>.
494
 
    parser.add_option("--s3-unencrypted-connection", action = "store_true")
 
494
    parser.add_option("--s3-unencrypted-connection", action="store_true")
495
495
 
496
496
    # Chunk size used for S3 multipart uploads.The number of parallel uploads to
497
497
    # S3 be given by chunk size / volume size. Use this to maximize the use of
498
498
    # your bandwidth. Defaults to 25MB
499
 
    parser.add_option("--s3-multipart-chunk-size", type = "int", action = "callback", metavar = _("number"),
500
 
                      callback = lambda o, s, v, p: setattr(p.values, "s3_multipart_chunk_size", v * 1024 * 1024))
 
499
    parser.add_option("--s3-multipart-chunk-size", type="int", action="callback", metavar=_("number"),
 
500
                      callback=lambda o, s, v, p: setattr(p.values, "s3_multipart_chunk_size", v * 1024 * 1024))
501
501
 
502
502
    # Number of processes to set the Processor Pool to when uploading multipart
503
503
    # uploads to S3. Use this to control the maximum simultaneous uploads to S3.
508
508
    parser.add_option("--s3_multipart_max_timeout", type="int", metavar=_("number"))
509
509
 
510
510
    # Option to allow the s3/boto backend use the multiprocessing version.
511
 
    parser.add_option("--s3-use-multiprocessing", action = "store_true")
 
511
    parser.add_option("--s3-use-multiprocessing", action="store_true")
512
512
 
513
513
    # Option to allow use of server side encryption in s3
514
514
    parser.add_option("--s3-use-server-side-encryption", action="store_true", dest="s3_use_sse")
515
515
 
516
516
    # scp command to use (ssh pexpect backend)
517
 
    parser.add_option("--scp-command", metavar = _("command"))
 
517
    parser.add_option("--scp-command", metavar=_("command"))
518
518
 
519
519
    # sftp command to use (ssh pexpect backend)
520
 
    parser.add_option("--sftp-command", metavar = _("command"))
 
520
    parser.add_option("--sftp-command", metavar=_("command"))
521
521
 
522
522
    # allow the user to switch cloudfiles backend
523
 
    parser.add_option("--cf-backend", metavar = _("pyrax|cloudfiles"))
 
523
    parser.add_option("--cf-backend", metavar=_("pyrax|cloudfiles"))
524
524
 
525
525
    # If set, use short (< 30 char) filenames for all the remote files.
526
 
    parser.add_option("--short-filenames", action = "callback",
527
 
                      dest = "short_filenames",
528
 
                      callback = lambda o, s, v, p: (setattr(p.values, o.dest, True),
 
526
    parser.add_option("--short-filenames", action="callback",
 
527
                      dest="short_filenames",
 
528
                      callback=lambda o, s, v, p: (setattr(p.values, o.dest, True),
529
529
                                                   old_fn_deprecation(s)))
530
530
 
531
531
    # TRANSL: Used in usage help to represent an ID for a GnuPG key. Example:
532
532
    # --encrypt-key <gpg_key_id>
533
 
    parser.add_option("--sign-key", type = "string", metavar = _("gpg-key-id"),
534
 
                      dest = "", action = "callback",
535
 
                      callback = lambda o, s, v, p: set_sign_key(v))
 
533
    parser.add_option("--sign-key", type="string", metavar=_("gpg-key-id"),
 
534
                      dest="", action="callback",
 
535
                      callback=lambda o, s, v, p: set_sign_key(v))
536
536
 
537
537
    # default to batch mode using public-key encryption
538
 
    parser.add_option("--ssh-askpass", action = "store_true")
 
538
    parser.add_option("--ssh-askpass", action="store_true")
539
539
 
540
540
    # user added ssh options
541
 
    parser.add_option("--ssh-options", action = "extend", metavar = _("options"))
 
541
    parser.add_option("--ssh-options", action="extend", metavar=_("options"))
542
542
 
543
543
    # user added ssl options (webdav backend)
544
 
    parser.add_option("--ssl-cacert-file", metavar = _("pem formatted bundle of certificate authorities"))
 
544
    parser.add_option("--ssl-cacert-file", metavar=_("pem formatted bundle of certificate authorities"))
545
545
 
546
 
    parser.add_option("--ssl-no-check-certificate", action = "store_true")
 
546
    parser.add_option("--ssl-no-check-certificate", action="store_true")
547
547
 
548
548
    # Working directory for the tempfile module. Defaults to /tmp on most systems.
549
 
    parser.add_option("--tempdir", dest = "temproot", type = "file", metavar = _("path"))
 
549
    parser.add_option("--tempdir", dest="temproot", type="file", metavar=_("path"))
550
550
 
551
551
    # network timeout value
552
552
    # TRANSL: Used in usage help. Example:
553
553
    # --timeout <seconds>
554
 
    parser.add_option("--timeout", type = "int", metavar = _("seconds"))
 
554
    parser.add_option("--timeout", type="int", metavar=_("seconds"))
555
555
 
556
556
    # Character used like the ":" in time strings like
557
557
    # 2002-08-06T04:22:00-07:00.  The colon isn't good for filenames on
558
558
    # windows machines.
559
559
    # TRANSL: abbreviation for "character" (noun)
560
 
    parser.add_option("--time-separator", type = "string", metavar = _("char"),
561
 
                      action = "callback",
562
 
                      callback = lambda o, s, v, p: set_time_sep(v, s))
 
560
    parser.add_option("--time-separator", type="string", metavar=_("char"),
 
561
                      action="callback",
 
562
                      callback=lambda o, s, v, p: set_time_sep(v, s))
563
563
 
564
564
    # Whether to specify --use-agent in GnuPG options
565
 
    parser.add_option("--use-agent", action = "store_true")
566
 
 
567
 
    parser.add_option("--verbosity", "-v", type = "verbosity", metavar = "[0-9]",
568
 
                      dest = "", action = "callback",
569
 
                      callback = lambda o, s, v, p: log.setverbosity(v))
570
 
 
571
 
    parser.add_option("-V", "--version", action = "callback", callback = print_ver)
 
565
    parser.add_option("--use-agent", action="store_true")
 
566
 
 
567
    parser.add_option("--verbosity", "-v", type="verbosity", metavar="[0-9]",
 
568
                      dest="", action="callback",
 
569
                      callback=lambda o, s, v, p: log.setverbosity(v))
 
570
 
 
571
    parser.add_option("-V", "--version", action="callback", callback=print_ver)
572
572
 
573
573
    # volume size
574
574
    # TRANSL: Used in usage help to represent a desired number of
575
575
    # something. Example:
576
576
    # --num-retries <number>
577
 
    parser.add_option("--volsize", type = "int", action = "callback", metavar = _("number"),
578
 
                      callback = lambda o, s, v, p: setattr(p.values, "volsize", v * 1024 * 1024))
 
577
    parser.add_option("--volsize", type="int", action="callback", metavar=_("number"),
 
578
                      callback=lambda o, s, v, p: setattr(p.values, "volsize", v * 1024 * 1024))
579
579
 
580
580
    # parse the options
581
581
    (options, args) = parser.parse_args()
685
685
 
686
686
def command_line_error(message):
687
687
    """Indicate a command line error and exit"""
688
 
    log.FatalError(_("Command line error: %s") % (message,) + "\n" +
 
688
    log.FatalError(_("Command line error: %s") % (message,) + "\n" + 
689
689
                   _("Enter 'duplicity --help' for help screen."),
690
690
                   log.ErrorCode.command_line)
691
691
 
961
961
                           log.ErrorCode.restore_dir_exists)
962
962
    elif action == "verify":
963
963
        if not local_path.exists():
964
 
            log.FatalError(_("Verify directory %s does not exist") %
 
964
            log.FatalError(_("Verify directory %s does not exist") % 
965
965
                           (util.ufn(local_path.name),),
966
966
                           log.ErrorCode.verify_dir_doesnt_exist)
967
967
    else: