��Qc@s�dZddlZddlZddlZddlZddlZddlmZddlm Z ddl
mZmZm
Z
yddlZWnek
r�eZnXy"ddlZddlZeZWnek
r�eZnXddlmZmZddlmZddlmZdd lmZdd
lm Z ddl!m"Z"ddl#m$Z$dd
l%m&Z&dZ'dZ(defd��YZ)d�Z*e+dkr�e
e*��ndS(s"Tests for distutils.command.sdist.i�N(tjoin(tdedent(tcaptured_stdouttcheck_warningstrun_unittest(tsdisttshow_formats(tDistribution(tPyPIRCCommandTestCase(tDistutilsOptionError(tfind_executable(tWARN(tFileList(tARCHIVE_FORMATSsF
from distutils.core import setup
import somecode
setup(name='fake')
s�# file GENERATED by distutils, do NOT edit
README
buildout.cfg
inroot.txt
setup.py
data%(sep)sdata.dt
scripts%(sep)sscript.py
some%(sep)sfile.txt
some%(sep)sother_file.txt
somecode%(sep)s__init__.py
somecode%(sep)sdoc.dat
somecode%(sep)sdoc.txt
t
SDistTestCasecBs�eZd�Zd�Zdd�Zejed�d��Z ejed�d��Z
ejed�d��Zejed�d��Zejed�d��Z
d �Zd
�Zd�Zejed�ejed�d
���Zd�Zd�Zd�Zejejdkd�d��Zejed�d��Zejed�d��Zejed�d��Zejed�d��ZRS(cCs�tt|�j�tj�|_tjt|jd��tjt|jd��|j |jdfd�|j |jddfd�|j |jdft
�tj|j�dS(NtsomecodetdisttREADMEtxxxs__init__.pyt#ssetup.py(tsuperRtsetUptostgetcwdtold_pathtmkdirRttmp_dirt
write_filetSETUP_PYtchdir(tself((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyR;scCs'tj|j�tt|�j�dS(N(RRRRRttearDown(R((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyRIscCs�|dkr8idd6dd6dd6dd6dd6}nt|�}d |_d
g|_t|_t|�}d|_||fS(
s
Returns a cmdtfaketnames1.0tversionRturltauthortauthor_emailssetup.pyRRN(tNoneRtscript_nametpackagestTruetinclude_package_dataRtdist_dir(RtmetadataRtcmd((s0/sys/lib/python2.7/distutils/tests/test_sdist.pytget_cmdNs
s
requires zlibcCs�tjt|jdd��|j|jdddfd�tjt|jdd��|j|jdddfd�tjt|jdd��|j|jdddfd�|j|jddfd�|j�\}}d g|_|j�|j�t|jd
�}tj |�}|j
|dg�tjt|d��}z|j
�}Wd|j�X|j
t|�d�dS(
NRs.svnsok.pyRs.hgtoks.gits.nfs0001tzipRsfake-1.0.zipi(RRRRRR.tformatstensure_finalizedtruntlistdirtassertEqualtzipfiletZipFiletnamelisttclosetlen(RRR-tdist_foldertfilestzip_filetcontent((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_prune_file_list\s*
cCs td�dks$td�dkr(dS|j�\}}ddg|_|j�|j�t|jd�}tj |�}|j
�|j|ddg�tjt|d��tjt|d��ddg|_|j�|j�tj |�}|j
�|j|ddg�dS(NttartgziptgztarRsfake-1.0.tarsfake-1.0.tar.gz(
R
R&R.R1R2R3RRRR4tsortR5tremove(RRR-R;tresult((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_make_distribution�s&
cCs�|jidd6dd6�\}}dg|_|j�|j�t|jd�}tj|�}|j|dg�tj t|d��dS( su
Unicode name or version should not break building to tar.gz format.
Reference issue #11638.
ufakeR!u1.0R"RBRsfake-1.0.tar.gzN(
R.R1R2R3RRRR4R5RD(RRR-R;RE((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_unicode_metadata_tgz�s#
c
Cs�|j�\}}iddgd6dgd6|_|j|jddfd�|j|jddfd�t|jd �}tj|�|j|d
fd�t|jd�}tj|�t|jd�}tj|�|j|d
fd�|j|jdfd�|j|jdfd�|j|dfd�|j|dfd�d ddddgfddg|_t|jd�}tj|�|j|dfd�tdd�g|_dg|_ t
|_|j�|j
�t|jd�}tj|�}|j|dg�tjt|d��} z| j�}
Wd| j�X|jt|
�d�tt|jd��}z|j�}Wd|j�X|j|titjd6�dS(Ns*.cfgs*.datts*.txtRsdoc.txtRsdoc.dattdatasdata.dttsomes.hgslast-message.txtsbuildout.cfgs
inroot.txtsfile.txtsother_file.txtsdata/data.dttnotexistings
some/file.txtssome/other_file.txttscriptss script.pyR0Rsfake-1.0.zipitMANIFESTtsep(R.tpackage_dataRRRRRt
data_filesRLR1R)tuse_defaultsR2R3R4R5R6R7R8R9R:topentreadRMRN(
RRR-tdata_dirtsome_dirthg_dirt
script_dirR;R<R=R>tftmanifest((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_add_defaults�sX
cCs�|jdi�\}}|j�|j�g|jt�D]}|jd�r<|^q<}|jt|�d�|j�|j�\}}|j�d|_ |j�g|jt�D]}|jd�r�|^q�}|jt|�d�dS(NR,swarning: check:ii(
R.R2R3tget_logsRt
startswithR5R:t
clear_logstmetadata_check(RRR-tmsgtwarnings((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_metadata_check_option s
cCsX|j�\}}t��}tjd�|j�|jt|j�d�WdQXdS(Ntalwaysi(R.RR`tsimplefiltertcheck_metadataR5R:(RRR-tw((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_check_metadata_deprecated s
cCs�t��}t�WdQXttj��}g|j�jd�D]!}|j�jd�rA|^qA}|j t|�|�dS(Ns
s
--formats=(
RRR:R
tkeystgetvaluetsplittstripR\R5(Rtstdouttnum_formatstlinetoutput((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_show_formats(s
!cCs�|j�\}}|j�|j|jd�|j|jd�|j|jd�d|_|jt|j�dg|_|j�d|_|jt|j�dS(NRMsMANIFEST.inRiR0tsupazipa( R.tfinalize_optionsR5RYttemplateR+R1tassertRaisesR (RRR-((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_finalize_options2s
sRequires grp and pwd supportcCs�td�dks$td�dkr(dS|j�\}}dg|_tjd�d|_tjd�d|_ |j
�|j�t|j
dd�}tj|�}zAx:|j�D],}|j|jd�|j|jd�q�WWd|j�X|j�\}}dg|_|j
�|j�t|j
dd�}tj|�}z4x-|j�D]}|j|jtj��q_WWd|j�XdS(NR@RARBiRsfake-1.0.tar.gz(R
R&R.R1tpwdtgetpwuidtownertgrptgetgrgidtgroupR2R3RRttarfileRRt
getmembersR5tuidtgidR9Rtgetuid(RRR-tarchive_nametarchivetmember((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt"test_make_distribution_owner_groupFs4
!cCs{|j�\}}tj|j�|jd|�|j�t�|_|j�|j t
�}|jt|�d�dS(NsMANIFEST.ini(
R.RRRRR2Rtfilelistt
read_templateR[RR5R:(RR>RR-R`((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt_check_template{s
cCs|jd�dS(Nstaunt knights *(R�(R((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt%test_invalid_template_unknown_command�scCs|jd�dS(Ntprune(R�(R((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt%test_invalid_template_wrong_arguments�stntstest relevant for Windows onlycCs|jd�dS(Nsinclude examples/(R�(R((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt test_invalid_template_wrong_path�scCs�|j�\}}idgd6|_|j|jddfd�dg|_|j�|j�t|j�}zDg|j �j
d�D]$}|j�dkr�|j�^q�}Wd|j�X|j
t|�d�|j|jdd fd�|jd
�}t|_|j�|j�t|j�}zDg|j �j
d�D]$}|j�dkrH|j�^qH}Wd|j�X|j
t|�d�|jd |d�dS(
Ns*.txtRsdoc.txtRRBs
RHisdoc2.txttbuild_pyii�(R.RORRR1R2R3RRRYRSRiRjR9R5R:tget_command_objtFalset finalizedtassertIn(RRR-RXRmRYR�t manifest2((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_get_file_list�s0
(
(cCs�|j�\}}|j�|j�t|j�}zDg|j�jd�D]$}|j�dkrN|j�^qN}Wd|j�X|j |dd�dS(Ns
RHis*# file GENERATED by distutils, do NOT edit(
R.R2R3RRRYRSRiRjR9R5(RRR-RXRmRY((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_manifest_marker�s
(
cCs�td�}|j�\}}|j�|j|j|jf|�|j|jdfd�|j|jdfd�|j|jdfd�|j�|j|jj dg�dS(NsI # bad.py
#bad.py
good.py
sgood.pys
# pick me!sbad.pys# don't pick me!s#bad.py(
RR.R2RRRYR3R5R�R<(RtcontentsRR-((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_manifest_comments�s
c
Csi|j�\}}dg|_|j�|j|j|jfd�|j|jdfd�|j�|j|jj dg�t
|j�}zDg|j�jd�D]$}|j
�dkr�|j
�^q�}Wd|j�X|j|dg�t|jdd�}tj
|�}z g|D]}|j^q"} Wd|j�X|jt| �dd d
g�dS(NRBs
README.manuals0This project maintains its MANIFEST file itself.s
RHRsfake-1.0.tar.gzsfake-1.0sfake-1.0/PKG-INFOsfake-1.0/README.manual(R.R1R2RRRYR3R5R�R<RRRSRiRjR9RR{R!tsorted(
RRR-RXRmRYR�R�ttarinfot filenames((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyttest_manual_manifest�s*
( N(t__name__t
__module__RRR&R.tunittestt
skipUnlesstzlibR?RFRGRZRaRfRoRttUID_GID_SUPPORTR�R�R�R�tskipIfRR!R�R�R�R�R�(((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyR9s* +#I
4
$*cCs
tjt�S(N(R�t makeSuiteR(((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt
test_suite�st__main__(,t__doc__RR{R�R`R6tos.pathRttextwrapRttest.test_supportRRRR�tImportErrorR&RxRuR)R�R�tdistutils.command.sdistRRtdistutils.coreRtdistutils.tests.test_configRtdistutils.errorsR tdistutils.spawnR
t
distutils.logRtdistutils.filelistRtdistutils.archive_utilR
RRMRR�R�(((s0/sys/lib/python2.7/distutils/tests/test_sdist.pyt<module>sB
�
|