1212import re
1313from functools import total_ordering
1414import sys
15+ from pathlib import PureWindowsPath
16+ import os
1517
1618def get_renamer (filename ):
1719 layout = load (filename )
1820 def rename (path ):
1921 renamed = layout .artificial_path (path )
2022 return path if renamed is None else renamed
23+ if os .name == "nt" :
24+ return lambda path : rename (PureWindowsPath (path ).as_posix ())
2125 return rename
2226
2327def load (filename ):
@@ -257,7 +261,7 @@ def __init__(self, path, line, virtual=None):
257261 exclude = path
258262 self ._line = line ;
259263 self ._original = u'-' + exclude ;
260- if not exclude .startswith (u"/" ):
264+ if os . name != 'nt' and not exclude .startswith (u"/" ):
261265 exclude = u'/' + exclude
262266 if exclude .find (u"//" ) != - 1 :
263267 raise _error (u"Illegal '//' in exclude path" , line )
@@ -274,14 +278,14 @@ def __init__(self, path, line, virtual=None):
274278 include = path
275279 self ._line = line ;
276280 self ._original = include ;
277- if not include .startswith (u"/" ):
281+ if os . name != 'nt' and not include .startswith (u"/" ):
278282 include = u'/' + include
279283 doubleslash = include .find (u"//" )
280284 if doubleslash != include .find (u"//" ):
281285 raise _error (u"More than one '//' in include path (project-layout)" , line )
282286 if self ._verify_stars .match (include ):
283287 raise _error (u"Illegal use of '**' in include path (project-layout)" , line )
284- if not virtual .startswith (u"/" ):
288+ if os . name != 'nt' and not virtual .startswith (u"/" ):
285289 virtual = u"/" + virtual
286290 if virtual .endswith (u"/" ):
287291 virtual = virtual [0 : - 1 ]
0 commit comments