Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/distutils/tests/test_archive_util.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�dZdZddlZddlZddlZddlZddlmZddlZddl	m
Z
mZmZm
Z
mZddlmZmZddlmZddlmZmZy"ddlZddlZeZWnek
r�eZnXyddlZeZWnek
r-ed	�ZnXyddlZWnek
rWe ZnXd
�Z!dej"ej#ej$fd��YZ%d
�Z&e'dkr�ee&��ndS(s!Tests for distutils.archive_util.s$Id$i�N(t
splitdrive(tcheck_archive_formatstmake_tarballtmake_zipfiletmake_archivetARCHIVE_FORMATS(tfind_executabletspawn(tsupport(tcheck_warningstrun_unittesttzipcCs@tjjrtSy|jtj��Wntk
r;tSXtS(sF
    Return True if the filename can be saved in the file system.
    (	tostpathtsupports_unicode_filenamestTruetencodetsystgetfilesystemencodingtUnicodeEncodeErrortFalse(tfilename((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt
can_fs_encode&s
tArchiveUtilTestCasecBs�eZejed�d��Zd�Zd�Zd�Zejed�eje	d�ofe	d�d�d	���Z
eje	d
�d�d��Zejed�ejed
�d���Z
d�Zd�Zejed�d��Zejed�ejed�d���Zd�Zejed�d��Zejed�ejed�d�d���Zejed�ejed�d�d���ZRS(s
requires zlibcCs|jd�dS(Ntarchive(t
_make_tarball(tself((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_tarball7scCs�|j�}|j|dgd�|j|dgd�tjtjj|d��|j|ddgd�|j�}tjt|�dt|�dkd�tjj||�}tj	�}tj
|�ztt|�dd	�Wdtj
|�X|d
}|jtjj
|��tjj||�}tj	�}tj
|�z!tt|�dd	dd�Wdtj
|�X|d}|jtjj
|��dS(
Ntfile1txxxtfile2tsubtfile3is)source and target should be on same driveit.s.tar.gztcompresss.tar(tmkdtempt
write_fileRtmkdirR
tjointunittestt
skipUnlessRtgetcwdtchdirRt
assertTruetexiststNone(Rttarget_namettmpdirttmpdir2t	base_nametold_dirttarball((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyR;s0#


!
cCsEtj|�}z$|j�}|j�t|�SWd|j�XdS(N(ttarfiletopentgetnamestsortttupletclose(RR
ttartnames((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt_tarinfo`s
cCs�|j�}tjj|d�}tj|�|j|dgd�|j|dgd�tjtjj|d��|j|ddgd�tjtjj|d��|j�}tjj|d�}|||fS(	NtdistRRRRR tsub2R(R#RR
R&R%R$(RR/R=R0R1((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt
_create_filesis
s
Requires zlibR:tgzipsNeed the tar command to runc	Cs"|j�\}}}tj�}tj|�zt|d�Wdtj|�X|d}|jtjj|��tjj|d�}ddddg}dddg}tj�}tj|�zt	|�t	|�Wdtj|�X|jtjj|��|j
|j|�|j|��tjj|d	�}tj�}tj|�zt|dd
d�Wdtj|�X|d}|jtjj|��tjj|d	�}tj�}tj|�zt|dd
ddt
�Wdtj|�X|d}|jtjj|��dS(
NR=s.tar.gzsarchive2.tar.gzR:s-cfsarchive2.tarR@s-f9RR"s.tartdry_run(R?RR)R*RR+R
R,R&RtassertEqualR<R-R(	RR/R0R1R2R3ttarball2ttar_cmdtgzip_cmd((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_tarfile_vs_tarwsF



"



R"s The compress program is requiredcCs[|j�\}}}tj�}tj|�z6t��}tjd�t|ddd�WdQXWdtj|�X|d}|jtj	j
|��|jt|j�d�tj
|�tj�}tj|�z<t��}tjd�t|ddddt�WdQXWdtj|�X|jtj	j
|��|jt|j�d�dS(NtalwaysR=R"s.tar.ZiRA(R?RR)R*R	twarningstsimplefilterRR+R
R,RBtlentremoveR(RR/R0R1R2twR3((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_compress_deprecated�s,





sNeed zip support to runcCst|j�}|j|dgd�|j|dgd�|j�}tjj|d�}t||�|d}dS(NRRRRs.zip(R#R$RR
R&R(RR/R0R1R3((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_zipfile�s
cCs?|jtdddg�d�|jtddg�d�dS(NtgztarRR(RBRR-(R((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_check_archive_formats�scCs;|j�}tjj|d�}|jtt|d�dS(NRR(R#RR
R&tassertRaisest
ValueErrorR(RR/R1((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_archive�sc	CsItr/tjd�d}tjd�d}n
d}}|j�\}}}tjj|j	�d�}t
|d||d|d|�}|jtjj|��t
|d||�}|jtjj|��t
|d||d|d|�}|jtjj|��t
|d||dddd	�}|jtjj|��dS(
NitrootRRtownertgroupR:t	kjhkjhkjgtoihohoh(
tUID_GID_SUPPORTtgrptgetgrgidtpwdtgetpwuidR?RR
R&R#RR+R,(RRVRUtbase_dirtroot_dirR1tres((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_archive_owner_group�s"
	sRequires grp and pwd supportc
	Cs|j�\}}}tj�}tj|�tjd�d}tjd�d}z%t|dddd|d|�}Wdtj|�X|j
tjj|��t
j|�}zAx:|j�D],}	|j|	jd�|j|	jd�q�WWd|j�XdS(NiR=R"RURV(R?RR)R*RZR[R\R]RR-R+R
R,R4R5t
getmembersRBtuidtgidR9(
RR/R0R1R2RVRUtarchive_nameRtmember((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_tarfile_root_owners 
cCsxtj�}d�}|gdftd<zAytddd|j��WnnX|jtj�|�Wdtd=XdS(Nc_s
t��dS(N(tRuntimeError(targstkw((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt_breaksssxxx fileRR_(RR)RRR#RB(Rtcurrent_dirRk((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_archive_cwds	cCs|jd�dS(sG
        Mirror test_make_tarball, except filename is unicode.
        uarchiveN(R(R((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyttest_make_tarball_unicode)suårchivs'File system cannot handle this filenamecCs|jd�dS(sm
        Mirror test_make_tarball, except filename is unicode and contains
        latin characters.
        uårchivN(R(R((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt test_make_tarball_unicode_latin10suのアーカイブcCs|jd�dS(s�
        Mirror test_make_tarball, except filename is unicode and contains
        characters outside the latin charset.
        uのアーカイブN(R(R((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt"test_make_tarball_unicode_extended:s(t__name__t
__module__R'R(tzlibRRR<R?RRFRMtZIP_SUPPORTRNRPRSRaRYRgRmRnRRoRp(((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyR3s0	%			4			cCs
tjt�S(N(R't	makeSuiteR(((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt
test_suiteDst__main__((t__doc__t__revision__R'RRR4tos.pathRRHtdistutils.archive_utilRRRRRtdistutils.spawnRRtdistutils.testsRttest.test_supportR	R
RZR\RRYtImportErrorRtzipfileRtRsR-RtTempdirManagertLoggingSilencertTestCaseRRvRq(((s7/sys/lib/python2.7/distutils/tests/test_archive_util.pyt<module>sD(






	
	�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].