@@ -26,7 +26,7 @@ class Extension:
26
26
name : string
27
27
the full name of the extension, including any packages -- ie.
28
28
*not* a filename or pathname, but Python dotted name
29
- sources : [string]
29
+ sources : [string | os.PathLike ]
30
30
list of source filenames, relative to the distribution root
31
31
(where the setup script lives), in Unix form (slash-separated)
32
32
for portability. Source files may be C, C++, SWIG (.i),
@@ -106,11 +106,16 @@ def __init__(
106
106
):
107
107
if not isinstance (name , str ):
108
108
raise AssertionError ("'name' must be a string" )
109
- if not (isinstance (sources , list ) and all (isinstance (v , str ) for v in sources )):
110
- raise AssertionError ("'sources' must be a list of strings" )
109
+ if not (
110
+ isinstance (sources , list )
111
+ and all (isinstance (v , (str , os .PathLike )) for v in sources )
112
+ ):
113
+ raise AssertionError (
114
+ "'sources' must be a list of strings or PathLike objects."
115
+ )
111
116
112
117
self .name = name
113
- self .sources = sources
118
+ self .sources = list ( map ( os . fspath , sources ))
114
119
self .include_dirs = include_dirs or []
115
120
self .define_macros = define_macros or []
116
121
self .undef_macros = undef_macros or []
0 commit comments