https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/duplicity/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/duplicity/__pycache__/commandline.cpython-310.pyc
o

*pa���@s�dZddlmZddlmZe��ddlmZddlmZddl	m	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZzddlmZWneySdd	lmZYnwdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZgagadada da!da"da#da$gd�Z%dd�Z&dd�Z'dd�Z(dd�Z)dd�Z*dd�Z+dd �Z,d!d"�Z-d#d$�Z.d%d&�Z/Gd'd(�d(e
j0�Z1d)d*�Z2d+d,�Z3d-d.�Z4d/d0�Z5d1d2�Z6d3d4�Z7d5d6�Z8d7d8�Z9d9d:�Z:d;d<�Z;d=d>�Z<dS)?z9Parse command line, check for consistency, and set config�)�print_function)�standard_library)�str)�range)�copyN)�md5)�new)�backend)�dup_time)�config)�gpg)�log)�path)�	selection)�util)�cleanup�collection-status�full�incremental�list-current-files�remove-older-than�remove-all-but-n-full�remove-all-inc-of-but-n-full�restore�verify�	replicatecC�tjtd�|tjdd�dS)NzWarning: Option %s is pending deprecation and will be removed in version 0.9.0.
Use of default filenames is strongly suggested.T��force_print�r
�Log�_�ERROR��opt�r%�7/usr/lib/python3/dist-packages/duplicity/commandline.py�old_fn_deprecationM�

�
�r'cCr)Nz�Warning: Option %s is pending deprecation and will be removed in a future release.
--include-filelist and --exclude-filelist now accept globbing characters and should be used instead.Trrr#r%r%r&�!old_globbing_filelist_deprecationTr(r)cCr)Nz�Warning: Option %s is pending deprecation and will be removed in a future release.
On many GNU/Linux systems, stdin is represented by /dev/stdin and
--include-filelist=/dev/stdin or --exclude-filelist=/dev/stdin could
be used as a substitute.Trrr#r%r%r&�stdin_deprecation[s

�
�r*cCsdS�Nr%r%r%r%r&�noopgsr,cCstj�tj�|��Sr+)�osr�
expanduser�
expandvars)�filenamer%r%r&�	expand_fnksr1cCs$tjdus	Jd��ttj�||��S)zB
    Return expanded version of archdir joined with backname.
    NzAexpand_archive_dir() called prior to config.backup_name being set)r�backup_namer1r-r�join)�archdir�backnamer%r%r&�expand_archive_diros�r6cCst�}|�|���|��S)zZ
    @param backend_url: URL to backend.
    @returns A default backup name (string).
    )r�update�encode�	hexdigest)�backend_url�burlhashr%r%r&�generate_default_backup_nameysr<cC�t|�Sr+)r1)�optionr$�valuer%r%r&�
check_file�sr@c
Cs6zt�|�WStjy}zt�t|���d}~wwr+)r
�genstrtotime�
TimeException�optparse�OptionValueErrorr)r>r$r?�er%r%r&�
check_time�s��rFcCs�d}|��}|dvrtj}n<|dvrtj}n4|dvrtj}n,|dvr&tj}n$|dvr.tj}nzt|�}|dks;|dkr=d	}WntyId	}Ynw|rQt	�
d
��|S)NF)rE�error)�w�warning)�n�notice)�i�info)�d�debugr�	Tz�Verbosity must be one of: digit [0-9], character [ewnid], or word ['error', 'warning', 'notice', 'info', 'debug']. The default is 4 (Notice).  It is strongly recommended that verbosity level is set at 2 (Warning) or higher.)�lowerr
r"�WARNING�NOTICE�INFO�DEBUG�int�
ValueErrorrCrD)r>r$r?�fail�verbr%r%r&�check_verbosity�s.��
rZc@steZdZejjdZeejj�Zeed<e	ed<e
ed<ejjdZejjdZejj
dZ
ejjdZdd�ZdS)	�	DupOption)�file�time�	verbosityr\r]r^)�extendc	Csn|dkr)|sdSt||�r!t||�r!t||t||�d|�dSt|||�dStj�|||||||�dS)Nr_� )�hasattr�getattr�setattrrC�Option�take_action)�self�action�destr$r?�values�parserr%r%r&re�s�zDupOption.take_actionN)�__name__�
__module__�__qualname__rCrd�TYPESr�TYPE_CHECKERr@rFrZ�ACTIONS�
STORE_ACTIONS�
TYPED_ACTIONS�ALWAYS_TYPED_ACTIONSrer%r%r%r&r[�sr[c	s\
dd��dd��dd�}dd��d	d
�}dd�}tjtt�d
�}|jddd�|jddtd�d�|jddddd�|jddd�|jddtd�tjd�|jddd�|jddd tjd!�|jd"dd�|jd#d$td%�d&d'd(d)�d*�|jd+d$td�d�|jd,d$td%�d&d'd-d)�d*�|jd.d'td/�d&d$|d0�|jd1d'd&|d2�|jd3dtd4�d&d'�d*�|jd5d'd&d6d)�tjd7�|jd8dtd4�d&d'�fd9d)�tjd:�|jd;td4�d&dd'|d<�|jd=d'd&|d2�|jd>td?�d&d$d'|d<�|jd@dAtdA�d&d'|d*�|jdBdtjdC�|jdDd$dEdFdG�|jdHd$dIdFdG�|jdJd$dKdFdG�|jdLd$dMdFdG�|jdNdtjdC�|jdOdPd'dtd�dQdRd)�dS�|jdTdd�|jdUddVdWd�|jdXddYdWd�|jdZdAd[tdA�d\�|jd]d'd^d_d)�d2�|jd`dtd�d�|jdadbtdc�dd�|jded$td%�d&d'dfd)�d*�|jdgdhdtd�di�|jdjd'dkdld)�d2�|jdmdd�|jdntdo�dp�|jdqd'td/�d&d$|d0�|jdrdtd4�d&d'�d*�|jdsd'd&dtd)�tjd7�|jdudtd4�d&d'�fdvd)�tjd:�|jdwtd?�d&d$d'|d<�|jdxdtdy�d&d'�fdzd)�d*�|jd{dtd4�d&d'd|d)�d*�|jd}d'd~d)�d�|jd�dtd��d�|jd�d�td��d��|jd�d�d�d��|jd�d�d�d��|jd�d�d�d��|jd�dd�|jd�dtd��d�|jd�dd�|jd�dd�|jd�d'd�d�d)�d2�|jd�d�d�d��|jd�dtd��d�|jd�dbtdc�dd�|jd�dtd��d�|jd�dd�|jd�dtd��d�|jd�dd�|jd�dd'd�|d��|jd�d�d�dAtdA�d�|jd�dbtdc�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd�|jd�dd'td��d�d)�d��|jd�dtd��d�|jd�dtd��d�|jd�dd�|jd�dd�d��|jd�dd�d��|jd�dFd�d��|jd�dFd�d��|jd�d$d�dFdG�|jd�d$d�dFdG�|jd�d$td��d�|jd�dtd��d�|jd�dtd��d�|jd�dtd��d�|jd�d$tdƃd�|jd�tdȃdp�|jd�tdȃdp�|jd�td˃dp�|jd�dd�|jd�d'd�d�d)�d2�|jd�d$td%�d&d'd�d)�d*�|jd�dd�|jd�dbtdc�dd�|jd�tdՃdp�|jd�td׃dp�|jd�dd�|jd�d�dtd�di�|jd�dtd܃d�|jd�d$tdރd'�fd�d)�d�|jd�dd�|jd�d�d�d�d&d'd�d)�d*�|jd�d�d'|d�|jd�dd�d�d�}|jd�dd'td��|d��d�d�}|jd�dd'td��|d��|jd�d'dtd�d�d�d)�dS�|jd�dtd܃d�|�|�\}}d�d��t|�D�D]}	t	||	�}
|
d�u�r�t
t|	|
��q�tj
jd�k�r�ttjt��r�ttjd��t_ttjt��r�ttjd��t_ttjt��r�ttjd��t_ttjt��r�ttjd��t_t�tj�d&�d�}|�r4|�d����fd�d��tD�}t|�dk�rtd��|f�nt|�dk�r+|d��n	|�s4|�d����d�k�r>d�ad}n��d�k�rHd�ad}n��d�k�rRd�a d�}n���dk�r^d�t_!d�}n���dk�rid�a"d}n���dk�r�z|�d��}
Wnt#�y�t�d�Ynwt$�%|
�t_&d}n_��dk�s���dk�rۈ�dk�r�d�t_'��dk�r�d�t_(z|�d��}
Wnt#�y�t�d��Ynwt)|
�t_*tj*d�k�s�t��d�d}n��dk�r�d�a+n
��d	k�r�d�a,d�}t|�|k�rt�d
|t|�f�t-t|��D]%}t||t��r||�.�d�||<�d||v�r*t/||�||<�qt|�dk�r9t�d
�nFt|�dk�rE|d�}n:t|�d�k�rzt,�rnt0�1|d���r_t0�1|d��sdt�d�|d�|d}}nt2|d�|d�\}}nt�d�tj3d�u�r�t4|�t_3t5t6tj7tj3��t8�9t�d�tj:j;f�t8�9t�d�tj3f�|S(zParse argument listcSs |dkr	t�d��t�|�dS)N�z!log-fd must be greater than zero.)rCrDr
�add_fd)�fdr%r%r&�
set_log_fd�s
z)parse_cmdline_options.<locals>.set_log_fdcSs$|dkr	t�d��|t_t|�dS)N�-z(Dash ('-') not valid for time-separator.)rCrDr�time_separatorr')�sepr$r%r%r&�set_time_sep�s
z+parse_cmdline_options.<locals>.set_time_sepcSs2|jdvrt�|�}n|}t�t�|�|f�dS)N)�stringr\)�typer�fsdecode�select_opts�append)�or>�additional_arg�p�addargr%r%r&�
add_selection�s
z,parse_cmdline_options.<locals>.add_selectioncSsdt�t�|�t�|�f�zt�tj|ddd��WdSty1t�	t
d�|tjj�YdSw)N�rtzUTF-8)�encodingzError opening file %s)
rr�rr~�select_files�io�open�IOErrorr
�
FatalErrorr!�	ErrorCode�cant_open_filelist)r��sr0r�r%r%r&�add_filelist�s
��z+parse_cmdline_options.<locals>.add_filelistcSstdtj�t�d�dS)Nzduplicity %sr)�printr�version�sys�exit�r�r��vr�r%r%r&�	print_ver�sz(parse_cmdline_options.<locals>.print_vercSs6t�tj�tj�|d���}t�|d�tj|<dS)Nrrt)r�fsencoder-r�normcase�normpathr�rename)r�r�r�r��keyr%r%r&�
add_rename�sz)parse_cmdline_options.<locals>.add_rename)�option_class�usagez--allow-source-mismatch�
store_true)rgz
--archive-dirr\r)r}�metavarz--asynchronous-upload�store_constrt�async_concurrency)rg�constrhz--compare-dataz--config-dir)r}r��helpz--copy-linksz--current-timerV�current_time)r}rhr�z	--dry-runz
--encrypt-keyr|�
gpg-key-id��callbackcS�tjj�|�Sr+)r�gpg_profile�
recipientsr�r�r%r%r&�<lambda>"�z'parse_cmdline_options.<locals>.<lambda>)r}r�rhrgr�z--encrypt-secret-keyringz--encrypt-sign-keycSstjj�|�t|�fSr+)rr�r�r��set_sign_keyr�r%r%r&r�)�z	--exclude�
shell_pattern)rgr�rhr}r�z--exclude-device-files)rgrhr��--exclude-filelistr0z--exclude-filelist-stdincS�t�d�t�tj�t|�fS)N)r��standard input�rr�r�r��stdinr*r�r%r%r&r�9�
�)rgrhr�r�z--exclude-globbing-filelistc��||||�t|�fSr+�r)r��r�r%r&r�?��)r}r�rhrgr�r�z--exclude-if-present)r�rhr}rgr�z--exclude-other-filesystemsz--exclude-regexp�regular_expressionz--exclude-older-thanr]z--fail-on-volume)r}r�z
--file-prefix�file_prefix�store)r}rhrgz--file-prefix-manifest�file_prefix_manifestz--file-prefix-archive�file_prefix_archivez--file-prefix-signature�file_prefix_signaturez
--skip-volumez--file-to-restorez-r�restore_dircSst|jdt�|�d���S)Nr��/)rcrirr��stripr�r%r%r&r�m�)rgr}r�rhr�z--forcez
--ftp-passive�passive�ftp_connectionz
--ftp-regular�regularz--full-if-older-than�full_force_time)r}rhr�z--gio�use_giocS�t|j|jd�t|�fS�NT�rcrirhr'r�r%r%r&r�{��z--gpg-binaryz
--gpg-optionsr_�options)rgr�z--hidden-encrypt-keycSr�r+)rr��hidden_recipientsr�r�r%r%r&r��r�z--idr-fakeroot�fakeroot)rhr}r�z--ignore-errors�
ignore_errorscSs t�td�|�t|jdd�fS)NzVRunning in 'ignore errors' mode due to %s; please re-consider if this was not intendedr�T)r
�Warnr!rcrir�r%r%r&r��s���z--imap-full-addressz--imap-mailbox�imap_mailbox)r�z	--include�--include-filelistz--include-filelist-stdincSr�)N)r�r�r�r�r%r%r&r��r�z--include-globbing-filelistcr�r+r�r�r�r%r&r��r�z--include-regexpz--log-fd�file_descriptorcs�|�Sr+r%r�)rwr%r&r���z
--log-filecS�
t�|�Sr+)r
�add_filer�r%r%r&r���
z--log-timestampcSst�Sr+)r,r�r%r%r&r��s)rgr�z--max-blocksize�numberz--namer2zbackup name)rhr�z--no-encryption�store_false�
encryption)rgrhz--no-compression�compressionz--no-print-statistics�print_statisticsz--null-separatorz
--num-retriesz--numeric-ownerz--do-not-restore-ownershipz--old-filenames�
old_filenamescSr�r�r�r�r%r%r&r��r�z--metadata-sync-mode�partial)rr�)�default�choicesz--par2-redundancyz--par2-optionsz--par2-volumesz
--progressz--progress-ratez--pydevdz--rename�)r}rg�nargsr�z--restore-timez--timez-tz--rsync-optionsz--s3-european-bucketsz--s3-use-rrsz--s3-use-iaz--s3-use-glacierz--s3-use-deep-archivez--s3-use-onezone-iaz--s3-use-new-stylez--s3-unencrypted-connectionz--s3-multipart-chunk-sizecSst|jd|dd�S)N�s3_multipart_chunk_size��rcrir�r%r%r&r�)r�)r}rgr�r�z--s3-multipart-max-procsz--s3-multipart-max-timeoutz--s3-use-multiprocessingz--s3-use-server-side-encryption�
s3_use_ssez#--s3-use-server-side-kms-encryption�s3_use_sse_kmsz--s3-kms-key-id�
s3_kms_key_idz--s3-kms-grant�s3_kms_grantz--s3-region-name�s3_region_namez--s3-endpoint-url�s3_endpoint_urlz--swift-storage-policy�policyz--azure-max-single-put-sizez--azure-max-block-sizez--azure-max-connectionsz--azure-blob-tierzHot|Cool|Archivez
--scp-command�commandz--sftp-commandz--cf-backendzpyrax|cloudfilesz--b2-hide-filesz--short-filenames�short_filenamescSr�r�r�r�r%r%r&r�fr�z
--sign-keycSr=r+)r�r�r%r%r&r�mr�z
--ssh-askpassz
--ssh-optionsz--ssl-cacert-filez/pem formatted bundle of certificate authoritiesz--ssl-cacert-pathz1path to a folder with certificate authority filesz--ssl-no-check-certificatez	--tempdir�temprootz	--timeout�secondsz--time-separator�charcs
�||�Sr+r%r�)r{r%r&r��r�)r}r�rgr�z--use-agentz--verbosityz-vr^z[0-9]cSr�r+)r
�setverbosityr�r%r%r&r��r�z-Vz	--versionz
--mf-purgecSs(t|jd|dd�t|jdd�dS)N�mp_segment_sizer��mp_setTr�r�r%r%r&�
set_mpsize�sz)parse_cmdline_options.<locals>.set_mpsizez--mp-segment-sizecSsHt|jd|dd�t|jdd�s"t|jdttj|jj��dSdS)N�volsizer�r�Fr�)rcrirbrVr�	mp_factorr�r�r%r%r&�set_volsize�s �z*parse_cmdline_options.<locals>.set_volsizez	--volsizez--file-changed�file_changedcSst|jd|�d��S)Nr�r�)rcri�rstripr�r%r%r&r��sz--backend-retry-delaycSsg|]}|r|�d�s|�qS�r!��
startswith)�.0�xr%r%r&�
<listcomp>�sz)parse_cmdline_options.<locals>.<listcomp>N�zutf-8rcsg|]	}|���r|�qSr%r�)r�c)�cmdr%r&r�r�z$command '%s' not unique, could be %srTrrrrrz)Missing time string for remove-older-thanrrzMissing count for z count must be > 0rrzExpected %d args, got %d�utf8z://�Too few argumentsz Two URLs expected for replicate.zToo many argumentszUsing archive dir: %szUsing backup name: %s)<rC�OptionParserr[r��
add_optionr!�
SUPPRESS_HELP�
parse_args�dirrbrcrr��version_info�major�
isinstancer�r�bytesr�r�r��socket�setdefaulttimeout�timeout�pop�commands�len�command_line_error�insertr�collection_status�full_backupr�list_current�	Exceptionr
rA�remove_time�remove_all_but_n_full_mode�!remove_all_inc_of_but_n_full_moderV�keep_chainsrrr�decoder1r	�is_backend_url�args_to_path_backendr2r<�set_archive_dirr6�archive_dirr
�Info�archive_dir_path�uc_name)�arglistr�r�r�rjr�r�r��args�fr��
num_expect�possible�arg�locr:�src_backend_url�lpathr%)r�rrwr{r&�parse_cmdline_options�sr
��������
���������
���
��
���
���������
����
�

�




��
�
 


�r3cCs*t�td�|fdtd�tjj�dS)z&Indicate a command line error and exitzCommand line error: %s�
z)Enter 'duplicity --help' for help screen.N)r
r�r!r��command_line)�messager%r%r&r3s
��rcCs<idtd��dtd��dtd��dtd��dtd��dtd��dtd��dtd��d	td	��d
td��dtd��d
td
��dtd��dtd��dtd��dtd��dtd��td�td�td�td�td�td�td�td�td�td�td�td�td �td!�d"��}d#|}|td$�d%|}|td&�d'|}|S)(a=Returns terse usage info. The code is broken down into pieces for ease of
    translation maintenance. Any comments that look extraneous or redundant should
    be assumed to be for the benefit of translators, since they can get each string
    (paired with its preceding comment, if any) independently of the others.�
absolute_path�alias�bucket_namer�r��container_name�count�	directoryr0�
gpg_key_idr��moduler�r��
other_hostz
other.host�passwordr�port�prefix�
relative_pathr�r��some_dir�
source_dir�
source_url�
target_dir�
target_urlr]�user�
account_id�application_key�remote)rBrCr�r�rDrErFrGrHr]rIrJrKrLa�
  duplicity [full|incremental] [%(options)s] %(source_dir)s %(target_url)s
  duplicity [restore] [%(options)s] %(source_url)s %(target_dir)s
  duplicity verify [%(options)s] %(source_url)s %(target_dir)s
  duplicity collection-status [%(options)s] %(target_url)s
  duplicity list-current-files [%(options)s] %(target_url)s
  duplicity cleanup [%(options)s] %(target_url)s
  duplicity remove-older-than %(time)s [%(options)s] %(target_url)s
  duplicity remove-all-but-n-full %(count)s [%(options)s] %(target_url)s
  duplicity remove-all-inc-of-but-n-full %(count)s [%(options)s] %(target_url)s
  duplicity replicate %(source_url)s %(target_url)s

zBackends and their URL formats:a�
  azure://%(container_name)s
  b2://%(account_id)s[:%(application_key)s]@%(bucket_name)s/[%(some_dir)s/]
  boto3+s3://%(bucket_name)s[/%(prefix)s]
  cf+http://%(container_name)s
  dpbx:///%(some_dir)s
  file:///%(some_dir)s
  ftp://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  ftps://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  gdocs://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
  for gdrive:// a <service-account-url> like the following is required
        <serviceaccount-name>@<serviceaccount-name>.iam.gserviceaccount.com
  gdrive://<service-account-url>/target-folder/?driveID=<SHARED DRIVE ID> (for GOOGLE Shared Drive)
  gdrive://<service-account-url>/target-folder/?myDriveFolderID=<google-myDrive-folder-id> (for GOOGLE MyDrive)
  hsi://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  imap://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  mega://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
  megav2://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
  mf://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
  onedrive://%(some_dir)s
  pca://%(container_name)s
  pydrive://%(user)s@%(other_host)s/%(some_dir)s
  rclone://%(remote)s:/%(some_dir)s
  rsync://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(relative_path)s
  rsync://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]//%(absolute_path)s
  rsync://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]::/%(module)s/%(some_dir)s
  s3+http://%(bucket_name)s[/%(prefix)s]
  s3://%(other_host)s[:%(port)s]/%(bucket_name)s[/%(prefix)s]
  scp://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  ssh://%(user)s[:%(password)s]@%(other_host)s[:%(port)s]/%(some_dir)s
  swift://%(container_name)s
  tahoe://%(alias)s/%(directory)s
  webdav://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
  webdavs://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s

z	Commands:a�
  cleanup <%(target_url)s>
  collection-status <%(target_url)s>
  full <%(source_dir)s> <%(target_url)s>
  incr <%(source_dir)s> <%(target_url)s>
  list-current-files <%(target_url)s>
  remove-all-but-n-full <%(count)s> <%(target_url)s>
  remove-all-inc-of-but-n-full <%(count)s> <%(target_url)s>
  remove-older-than <%(time)s> <%(target_url)s>
  replicate <%(source_url)s> <%(target_url)s>
  restore <%(source_url)s> <%(target_dir)s>
  verify <%(target_url)s> <%(source_dir)s>

r�)�trans�msgr%r%r&r�:s|��������!�%�*�/�4�8�<�@�D�I���#�&
�r�cCsftj�|�szt�|�Wn	tyYnwt�|�}|��s.t�t	d�|j
ftjj�|t
_dS)z Check archive dir and set globalzFSpecified archive directory '%s' does not exist, or is not a directoryN)r-r�exists�makedirsr�Path�isdirr
r�r!r)r��bad_archive_dirrr()�	dirstringr(r%r%r&r%s�

��
r%cCs2t�d|�st�td�|ftjj�|tj_	dS)z-Set config.sign_key assuming proper key givenz7^(0x)?([0-9A-Fa-f]{8}|[0-9A-Fa-f]{16}|[0-9A-Fa-f]{40})$zaSign key should be an 8, 16 alt. 40 character hex string, like 'AA0E73D2'.
Received '%s' instead.N)
�re�searchr
r�r!r��bad_sign_keyrr��sign_key)rXr%r%r&r�!s
��r�cCs&t�tj�}|�tt�|��t_dS)zAReturn selection iter starting at filename with arguments appliedN)	r�Selectr�
local_path�	ParseArgsrr��set_iter�select)�selr%r%r&�
set_selection*sr_cCsVt�|�t�|�}}|s|std�|r|rtd�|r!||fS|r'||fStd��)z�
    Given exactly two arguments, arg1 and arg2, figure out which one
    is the backend URL and which one is a local path, and return
    (local, backend).
    z�One of the arguments must be an URL.  Examples of URL strings are
"scp://user@host.net:1234/path" and "file:///usr/local".  See the man
page for more information.z3Two URLs specified.  One argument should be a path.zshould not be reached)r	r#r�AssertionError)�arg1�arg2�arg1_is_backend�arg2_is_backendr%r%r&r$2sr$cCs2t||�\}}t�|�t_||krd|fSd|fS)z�Figure out which arg is url, set backend

    Return value is pair (path_first, path) where is_first is true iff
    path made from arg1.

    Nrt)r$r	�get_backendr)rarbr�bendr%r%r&�set_backendJs
rgcCs�t�t�|����}|dkr(|��r'|��s'tjs't�t	d�|j
ftjj�n3|dkr?|��s>t�t	d�|j
ftjj
�n|dksI|dksIJ�|��s[t�t	d�|j
ftjj�|t_dS)	z,Check local directory, set config.local_pathrzDRestore destination directory %s already exists.
Will not overwrite.rz"Verify directory %s does not existr�incz*Backup source directory %s does not exist.N)rrQ�
get_canonicalrO�
isemptydirr�forcer
r�r!r)r��restore_dir_exists�verify_dir_doesnt_exist�backup_dir_doesnt_existrZ)rg�local_pathnamerZr%r%r&�process_local_dir[s2
���
���
��
rpcCs�dd�}|dvr|tttttjdug�dS|dks|dkrCtr%td�ntjr,td�t	r?|dkrAt
�td	�td
��dSdSdS|dksM|dksMJ�t
rStd
�tjr]td|f�ttjtjtjg�dkrotd�dSdS)zAFinal consistency check, see if something wrong with command linecSs.d}|D]}|r|d7}q|dksJd��dS)z?Raises error if two or more of the elements of arglist are truerrtz/Invalid syntax, two conflicting modes specifiedNr%)r*rJ�mr%r%r&�assert_only_onevs�z*check_consistency.<locals>.assert_only_one)�list-currentrr�
remove-oldrrrNrrz6full option cannot be used when restoring or verifyingz=incremental option cannot be used when restoring or verifyingzCommand line warning: %szXSelection options --exclude/--include
currently work only when backing up,not restoring.rhrz,verify option cannot be used when backing upz*restore option incompatible with %s backupr�zJonly one of --s3-use-rrs, --s3-use-ia, and --s3-use-onezone-ia may be used)rrrrrrrrrrr
r�r!rr��sum�
s3_use_rrs�	s3_use_ia�s3_use_onezone_ia)rgrrr%r%r&�check_consistencyrs.

�
���rycCs�t��t_t|�}tjdurtj}tj|j|j|j|j	d�t_t
�td�tjp(dtjj
f�t��t|�dkr?t|�dksCJd��t|�dkr�trNd}n"trSd	}ntrXd
}ntjdur`d}ntjrfd}n
tjrld
}ntd�t�|d�t_tjs�t
�td�|dft
jj�nNt|�dkr�tr�t�|d�t_t�|d�t_d}n3t|d|d�\}}|r�tr�d}n
d}nt r�d}nd}t!||�|dvr�t"�n
t|�dkr�t#d��t$|�t
�%td�|�|S)z�Process command line, set config, return action

    action will be "list-current", "collection-status", "cleanup",
    "remove-old", "restore", "verify", "full", or "inc".

    N)�
passphraserXr�r�zGPG binary is %s, version %srrtr�z*arg count should have been checked alreadyrsrrrtrrrrz�Bad URL '%s'.
Examples of URL strings are "scp://user@host.net:1234/path" and
"file:///usr/local".  See the man page for more information.rrrhrr)rrhrz!this code should not be reachablez
Main action: )&r�
GPGProfilerr�r3�
gpg_binaryrzrXr�r�r
�Debugr!�gpg_versionr	�import_backendsrrrrrrr rrer�r��bad_urlr�src_backendrgrrrpr_r`ryr')�cmdline_listr+�srcrg�backupror%r%r&�ProcessCommandLine�sv

�
� 

���
�r�)=�__doc__�
__future__r�futurer�install_aliases�builtinsrrrrCr-rUr�rr��hashlibr�ImportErrorr�	duplicityr	r
rrr
rrrrr�rrrrrrrr'r)r*r,r1r6r<r@rFrZrdr[r3rr�r%r�r_r$rgrpryr�r%r%r%r&�<module>s|�
"cY	'

https://t.me/RX1948 - 2025