@@ -328,38 +328,12 @@ def setUp(self):
328328 build_files (EggInfoFile .files , prefix = self .site_dir )
329329
330330
331- def build_files (file_defs , prefix = pathlib .Path ()):
332- """Build a set of files/directories, as described by the
331+ # dedent all text strings before writing
332+ orig = _path .create .registry [str ]
333+ _path .create .register (str , lambda content , path : orig (DALS (content ), path ))
333334
334- file_defs dictionary. Each key/value pair in the dictionary is
335- interpreted as a filename/contents pair. If the contents value is a
336- dictionary, a directory is created, and the dictionary interpreted
337- as the files within it, recursively.
338335
339- For example:
340-
341- {"README.txt": "A README file",
342- "foo": {
343- "__init__.py": "",
344- "bar": {
345- "__init__.py": "",
346- },
347- "baz.py": "# Some code",
348- }
349- }
350- """
351- for name , contents in file_defs .items ():
352- full_name = prefix / name
353- if isinstance (contents , dict ):
354- full_name .mkdir ()
355- build_files (contents , prefix = full_name )
356- else :
357- if isinstance (contents , bytes ):
358- with full_name .open ('wb' ) as f :
359- f .write (contents )
360- else :
361- with full_name .open ('w' , encoding = 'utf-8' ) as f :
362- f .write (DALS (contents ))
336+ build_files = _path .build
363337
364338
365339def build_record (file_defs ):
0 commit comments