12
12
from functools import partial
13
13
from functools import wraps
14
14
from typing import (TYPE_CHECKING , Callable , Any , Dict , Generic , Iterable , List ,
15
- Optional , Tuple , TypeVar , Union )
15
+ Optional , Set , Tuple , TypeVar , Union )
16
16
17
17
from distutils .errors import DistutilsOptionError , DistutilsFileError
18
18
from setuptools .extern .packaging .requirements import Requirement , InvalidRequirement
@@ -172,6 +172,9 @@ def parse_configuration(
172
172
distribution .src_root ,
173
173
)
174
174
meta .parse ()
175
+ distribution ._referenced_files .update (
176
+ options ._referenced_files , meta ._referenced_files
177
+ )
175
178
176
179
return meta , options
177
180
@@ -247,6 +250,10 @@ def __init__(
247
250
self .sections = sections
248
251
self .set_options : List [str ] = []
249
252
self .ensure_discovered = ensure_discovered
253
+ self ._referenced_files : Set [str ] = set ()
254
+ """After parsing configurations, this property will enumerate
255
+ all files referenced by the "file:" directive. Private API for setuptools only.
256
+ """
250
257
251
258
@property
252
259
def parsers (self ):
@@ -365,8 +372,7 @@ def parser(value):
365
372
366
373
return parser
367
374
368
- @classmethod
369
- def _parse_file (cls , value , root_dir : _Path ):
375
+ def _parse_file (self , value , root_dir : _Path ):
370
376
"""Represents value as a string, allowing including text
371
377
from nearest files using `file:` directive.
372
378
@@ -388,7 +394,8 @@ def _parse_file(cls, value, root_dir: _Path):
388
394
return value
389
395
390
396
spec = value [len (include_directive ) :]
391
- filepaths = (path .strip () for path in spec .split (',' ))
397
+ filepaths = [path .strip () for path in spec .split (',' )]
398
+ self ._referenced_files .update (filepaths )
392
399
return expand .read_files (filepaths , root_dir )
393
400
394
401
def _parse_attr (self , value , package_dir , root_dir : _Path ):
0 commit comments