1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
U
G=®d 2ã@s†dZddlZddlZddlZddlZddlmZddlmZm    Z    ddl
m Z Gdd„dƒZ dd    „Z ejfd
d „Zd d „Zddd„ZdS)zsdistutils.filelist
 
Provides the FileList class, used for poking about the filesystem
and building lists of files.
éN©Ú convert_path)ÚDistutilsTemplateErrorÚDistutilsInternalError)Úlogc@s|eZdZdZddd„Zdd„Zejfdd„Zd    d
„Z    d d „Z
d d„Z dd„Z dd„Z dd„Zdd„Zddd„Zddd„ZdS) ÚFileListaÑA list of files built by on exploring the filesystem and filtered by
    applying various patterns to what we find there.
 
    Instance attributes:
      dir
        directory from which files will be taken -- only used if
        'allfiles' not supplied to constructor
      files
        list of filenames currently being built/filtered/manipulated
      allfiles
        complete list of files under consideration (ie. without any
        filtering applied)
    NcCsd|_g|_dS©N)ÚallfilesÚfiles)ÚselfÚwarnÚ debug_print©rúUD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/filelist.pyÚ__init__szFileList.__init__cCs
||_dSr)r    )r r    rrrÚ set_allfiles#szFileList.set_allfilescCst|ƒ|_dSr)Úfindallr    )r Údirrrrr&szFileList.findallcCsddlm}|rt|ƒdS)z~Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        r)ÚDEBUGN)Údistutils.debugrÚprint)r Úmsgrrrrr )s zFileList.debug_printcCs|j |¡dSr)r
Úappend)r Úitemrrrr3szFileList.appendcCs|j |¡dSr)r
Úextend)r Úitemsrrrr6szFileList.extendcCs<tttjj|jƒƒ}g|_|D]}|j tjj|Ž¡qdSr)ÚsortedÚmapÚosÚpathÚsplitr
rÚjoin)r Zsortable_filesZ
sort_tuplerrrÚsort9sz FileList.sortcCs@tt|jƒdddƒD]$}|j||j|dkr|j|=qdS)Néréÿÿÿÿ)ÚrangeÚlenr
)r ÚirrrÚremove_duplicatesCszFileList.remove_duplicatescCsÞ| ¡}|d}d}}}|dkrTt|ƒdkr<td|ƒ‚dd„|dd…Dƒ}n~|dkr˜t|ƒd    krttd
|ƒ‚t|dƒ}d d„|dd…Dƒ}n:|d krÆt|ƒdkr¸td |ƒ‚t|dƒ}n td|ƒ‚||||fS)Nr)ÚincludeÚexcludeúglobal-includeúglobal-excludeéz&'%s' expects <pattern1> <pattern2> ...cSsg|] }t|ƒ‘qSrr©Ú.0ÚwrrrÚ
<listcomp>Wsz1FileList._parse_template_line.<locals>.<listcomp>r#)úrecursive-includeúrecursive-excludeéz,'%s' expects <dir> <pattern1> <pattern2> ...cSsg|] }t|ƒ‘qSrrr.rrrr1]s)ÚgraftÚprunez#'%s' expects a single <dir_pattern>zunknown action '%s')r r&rr)r ÚlineÚwordsÚactionÚpatternsrÚ dir_patternrrrÚ_parse_template_lineLs0  ÿ ÿ  ÿ zFileList._parse_template_linecCs@| |¡\}}}}|dkrV| dd |¡¡|D]}|j|dds2t d|¡q2næ|dkrš| dd |¡¡|D]}|j|ddsvt d    |¡qvn¢|d
krÞ| d d |¡¡|D]}|j|d dsºt d |¡qºn^|dkr(| dd |¡¡|D]"}|j|d dst d|¡qn|dkrv| d|d |¡f¡|D]$}|j||dsNt d||¡qNnÆ|dkrÄ| d|d |¡f¡|D]$}|j||dsœt d||¡qœnx|dkrú| d|¡|jd|ds<t d|¡nB|dkr0| d|¡|jd|ds<t d|¡n td|ƒ‚dS)Nr)zinclude ú r#)Úanchorz%warning: no files found matching '%s'r*zexclude z9warning: no previously-included files found matching '%s'r+zglobal-include rz>warning: no files found matching '%s' anywhere in distributionr,zglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionr2zrecursive-include %s %s)Úprefixz:warning: no files found matching '%s' under directory '%s'r3zrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'r5zgraft z+warning: no directories found matching '%s'r6zprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')r<r r!Úinclude_patternrr Úexclude_patternr)r r7r9r:rr;ÚpatternrrrÚprocess_template_linehs€ÿ
ÿ
ÿ
 
þ 
 ÿþ
 
 ÿþ
 
ÿ
ÿÿzFileList.process_template_liner#rcCsld}t||||ƒ}| d|j¡|jdkr4| ¡|jD],}| |¡r:| d|¡|j |¡d}q:|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, False otherwise.
        Fz%include_pattern: applying regex r'%s'Nz adding T)Útranslate_patternr rBr    rÚsearchr
r)r rBr>r?Úis_regexÚ files_foundÚ
pattern_reÚnamerrrr@´sÿ
 
 
 zFileList.include_patterncCsrd}t||||ƒ}| d|j¡tt|jƒdddƒD]4}| |j|¡r8| d|j|¡|j|=d}q8|S)aRemove 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, False otherwise.
        Fz%exclude_pattern: applying regex r'%s'r#r$z
 removing T)rDr rBr%r&r
rE)r rBr>r?rFrGrHr'rrrrAßsÿzFileList.exclude_pattern)NN)r#Nr)r#Nr)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrÚcurdirrr rrr"r(r<rCr@rArrrrrs 
 
 
    L
,ÿrcCs&dd„tj|ddDƒ}ttjj|ƒS)z%
    Find all files under 'path'
    css,|]$\}}}|D]}tj ||¡VqqdSr)rrr!)r/ÚbaseÚdirsr
ÚfilerrrÚ    <genexpr>úsþz#_find_all_simple.<locals>.<genexpr>T)Ú followlinks)rÚwalkÚfilterrÚisfile)rÚresultsrrrÚ_find_all_simpleös þrXcCs6t|ƒ}|tjkr.tjtjj|d}t||ƒ}t|ƒS)zŒ
    Find all files under 'dir' and return the list of full filenames.
    Unless dir is '.', return full filenames with dir prepended.
    )Ústart)    rXrrNÚ    functoolsÚpartialrÚrelpathrÚlist)rr
Zmake_relrrrrs
 
 
rcCs8t |¡}tj}tjdkrd}d|}t d||¡}|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).
    ú\z\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)ÚfnmatchÚ    translaterÚsepÚreÚsub)rBrHraÚescapedrrrÚ
glob_to_res
 
rer#c
Cs
|rt|tƒrt |¡S|Stdƒ d¡\}}}|rVt|ƒ}| |¡rP| |¡sZt‚nd}|dk    rât|ƒ}| |¡r~| |¡s‚t‚|t    |ƒt    |ƒt    |ƒ…}t
j }    t
j dkr²d}    |t    |ƒt    |ƒt    |ƒ…}d|||    ||f}n|rd||t    |ƒd…f}t |¡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).
    Ú_ÚNr^z\\z%s\A%s%s.*%s%sz%s\A%s) Ú
isinstanceÚstrrbÚcompilereÚ    partitionÚ
startswithÚendswithÚAssertionErrorr&rra)
rBr>r?rFrYrfÚendrHZ    prefix_rerarrrrD%s*
 
 
rD)r#Nr)rMrrbr_rZÚdistutils.utilrÚdistutils.errorsrrÚ    distutilsrrrXrNrrerDrrrrÚ<module>s  i