File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -435,8 +435,7 @@ class Github {
435435 }
436436
437437 async fixReqsFile ( filePath ) {
438- // Somehow pip-compile-multi generates replaces the '-e file:.' with a hard-coded local path
439- // hoping they fix it in the future. In the meantime we can fix it here.
438+ // Fixes '-e file:.' lines and strips absolute paths before 'requirements/' in '# -r' lines
440439 try {
441440 // Read the file
442441 const content = await fs . promises . readFile ( filePath , { encoding : 'utf-8' } ) ;
@@ -448,10 +447,18 @@ class Github {
448447 needsUpdate = true ;
449448 return '-e file:.' ;
450449 }
450+ if ( line . trim ( ) . startsWith ( '# -r ' ) ) {
451+ // Replace everything before 'requirements/' with '# -r requirements/'
452+ const fixedLine = line . replace ( / # - r .* ?r e q u i r e m e n t s \/ / , '# -r requirements/' ) ;
453+ if ( fixedLine !== line ) {
454+ needsUpdate = true ;
455+ return fixedLine ;
456+ }
457+ }
451458 return line ;
452459 } ) ;
453460
454- // Join the lines back and write to the file
461+ // Join the lines back and write to the file if any changes were made
455462 if ( needsUpdate ) {
456463 await fs . promises . writeFile ( filePath , updatedLines . join ( '\n' ) , { encoding : 'utf-8' } ) ;
457464 }
You can’t perform that action at this time.
0 commit comments