Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ÝPfÚ9ã@s¤dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dgZ ej eƒZejdejƒZejd ejejBƒZejdd …ZGd d„deƒZdS) zu Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. éNé)ÚDistlibException)Úfsdecode)Ú convert_pathÚManifestz\\w* z#.*?(?= )| (?=$)éc@szeZdZdZddd„Zdd„Zdd„Zd d „Zdd d „Zdd„Z dd„Z dd„Z ddd„Z d dd„Z d!dd„Zdd„ZdS)"rz~A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. NcCs>tjjtjj|ptjƒƒƒ|_|jtj|_d|_t ƒ|_ dS)zd Initialise an instance. :param base: The base directory to explore under. N) ÚosÚpathÚabspathÚnormpathÚgetcwdÚbaseÚsepÚprefixÚallfilesÚsetÚfiles)Úselfr ©rú/usr/lib/python3.6/manifest.pyÚ__init__*szManifest.__init__cCs²ddlm}m}m}g|_}|j}|g}|j}|j}xv|r¬|ƒ}tj |ƒ} x\| D]T} tj j || ƒ} tj| ƒ} | j } || ƒrŒ|jt | ƒƒqR|| ƒrR|| ƒ rR|| ƒqRWq8WdS)zmFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. r)ÚS_ISREGÚS_ISDIRÚS_ISLNKN)Ústatrrrrr ÚpopÚappendrÚlistdirr ÚjoinÚst_moder)rrrrrÚrootÚstackrÚpushÚnamesÚnameÚfullnamerÚmoderrrÚfindall9s"    zManifest.findallcCs4|j|jƒstjj|j|ƒ}|jjtjj|ƒƒdS)zz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N) Ú startswithrrr rr rÚaddr )rÚitemrrrr)Ts z Manifest.addcCsx|D]}|j|ƒqWdS)z† Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N)r))rÚitemsr*rrrÚadd_many^s zManifest.add_manyFcsf‡‡fdd„‰tˆjƒ}|rJtƒ}x|D]}ˆ|tjj|ƒƒq(W||O}dd„tdd„|DƒƒDƒS)z8 Return sorted files in directory order csJ|j|ƒtjd|ƒ|ˆjkrFtjj|ƒ\}}|dks.add_dircSsg|]}tjj|Ž‘qSr)rr r)Ú.0Z path_tuplerrrú zsz#Manifest.sorted..css|]}tjj|ƒVqdS)N)rr r1)r8r rrrú {sz"Manifest.sorted..)rrrr ÚdirnameÚsorted)rZwantdirsÚresultr3Úfr)r7rrr<gs  zManifest.sortedcCstƒ|_g|_dS)zClear all collected files.N)rrr)rrrrÚclear}szManifest.clearcCs†|j|ƒ\}}}}|dkrFx&|D]}|j|dd�s tjd|ƒq W�n<|dkrnx|D]}|j|dd�}qTW�n|dkr x&|D]}|j|dd�s|tjd|ƒq|Wnâ|d krÆxØ|D]}|j|dd�}q®Wn¼|d k�rüx°|D] }|j||d �sÖtjd ||ƒqÖWn†|d k�r&xz|D]}|j||d �}�q Wn\|dk�rN|jd|d ��s‚tjd|ƒn4|dk�rv|jd|d ��s‚tjd|ƒn td|ƒ‚dS)av Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands ÚincludeT)Úanchorzno files found matching %rÚexcludezglobal-includeFz3no files found matching %r anywhere in distributionzglobal-excludezrecursive-include)rz-no files found matching %r under directory %rzrecursive-excludeÚgraftNz no directories found matching %rÚprunez4no previously-included directories found matching %rzinvalid action %r)Ú_parse_directiveÚ_include_patternr/ZwarningÚ_exclude_patternr)rÚ directiveÚactionÚpatternsÚthedirZ dirpatternÚpatternÚfoundrrrÚprocess_directive‚sD           zManifest.process_directivec Cs|jƒ}t|ƒdkr,|ddkr,|jddƒ|d}d }}}|dkrxt|ƒd kr`td |ƒ‚dd„|dd …Dƒ}n€|dkr¼t|ƒdkr˜td|ƒ‚t|dƒ}dd„|d d …Dƒ}n<|dk�rìt|ƒd krÞtd|ƒ‚t|dƒ}n td|ƒ‚||||fS)zŸ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns rrr@rBúglobal-includeúglobal-excludeúrecursive-includeúrecursive-excluderCrDNrz$%r expects ...cSsg|] }t|ƒ‘qSr)r)r8Úwordrrrr9êsz-Manifest._parse_directive..éz*%r expects ...cSsg|] }t|ƒ‘qSr)r)r8rSrrrr9òsz!%r expects a single zunknown action %r)r@rBrOrPrQrRrCrD)r@rBrOrP)rQrR)rCrD)r1ÚlenÚinsertrr)rrHZwordsrIrJrKZ dir_patternrrrrEÑs:           zManifest._parse_directiveTcCsTd}|j||||ƒ}|jdkr&|jƒx(|jD]}|j|ƒr.|jj|ƒd}q.W|S)a…Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. FNT)Ú_translate_patternrr'Úsearchrr))rrLrArÚis_regexrMÚ pattern_rer$rrrrFs    zManifest._include_patterncCsFd}|j||||ƒ}x,t|jƒD]}|j|ƒr |jj|ƒd}q W|S)atRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions FT)rWÚlistrrXÚremove)rrLrArrYrMrZr>rrrrG)s   zManifest._exclude_patternc Cs¨|rt|tƒrtj|ƒS|Std kr:|jdƒjdƒ\}}}|rj|j|ƒ}td krn|j|ƒrd|j|ƒsnt ‚nd}tj t j j |jdƒƒ} |dk �rftdkrº|jdƒ} |j|ƒdt| ƒ …} n>|j|ƒ} | j|ƒrØ| j|ƒsÜt ‚| t|ƒt| ƒt|ƒ…} t j} t jdk�rd} tdk�r4d| | j | d |fƒ}n0|t|ƒt|ƒt|ƒ…}d || | | ||f}n8|�ržtdk�r„d| |}nd || |t|ƒd…f}tj|ƒS)aTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). rTrr6r-Nú\z\\ú^z.*z%s%s%s%s.*%s%sz%s%s%s)rTr)rTr)rTr)rTr)rTr)Ú isinstanceÚstrÚreÚcompileÚ_PYTHON_VERSIONÚ _glob_to_reÚ partitionr(Úendswithr2Úescaperr rr rUr) rrLrArrYÚstartr6ÚendrZr Z empty_patternZ prefix_rerrrrrW=sB             zManifest._translate_patterncCs8tj|ƒ}tj}tjdkrd}d|}tjd||ƒ}|S)z÷Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). r]z\\\\z\1[^%s]z((? s