@@ -2754,7 +2754,7 @@ def load_graph(sources: List[BuildSource], manager: BuildManager,
2754
2754
2755
2755
# Note: Running this each time could be slow in the daemon. If it's a problem, we
2756
2756
# can do more work to maintain this incrementally.
2757
- seen_files = {os . path . abspath ( st .path ) : st for st in graph .values () if st .path }
2757
+ seen_files = {st .path : st for st in graph .values () if st .path }
2758
2758
2759
2759
# Collect dependencies. We go breadth-first.
2760
2760
# More nodes might get added to new as we go, but that's fine.
@@ -2802,17 +2802,26 @@ def load_graph(sources: List[BuildSource], manager: BuildManager,
2802
2802
st .suppress_dependency (dep )
2803
2803
else :
2804
2804
if newst .path :
2805
- newst_path = os .path .abspath (newst .path )
2805
+ newst_path = newst .path
2806
+ seen_state = seen_files .get (newst_path )
2806
2807
2807
- if newst_path in seen_files :
2808
+ if seen_state is None :
2809
+ if os .path .isabs (newst_path ):
2810
+ newst_path = os .path .relpath (newst_path )
2811
+ else :
2812
+ newst_path = os .path .abspath (newst_path )
2813
+
2814
+ seen_state = seen_files .get (newst_path )
2815
+
2816
+ if seen_state is not None :
2808
2817
manager .errors .report (
2809
2818
- 1 , 0 ,
2810
2819
"Source file found twice under different module names: "
2811
- "'{}' and '{}'" .format (seen_files [ newst_path ] .id , newst .id ),
2820
+ "'{}' and '{}'" .format (seen_state .id , newst .id ),
2812
2821
blocker = True )
2813
2822
manager .errors .raise_error ()
2814
2823
2815
- seen_files [newst_path ] = newst
2824
+ seen_files [newst . path ] = newst
2816
2825
2817
2826
assert newst .id not in graph , newst .id
2818
2827
graph [newst .id ] = newst
0 commit comments