@@ -214,6 +214,16 @@ getReverseDeps db dep =
214
214
innerDeps <- getReverseDeps db packageName
215
215
return $ pair : innerDeps
216
216
217
+ getPursPath :: IO Text
218
+ getPursPath = do
219
+ bin <- which " purs" -- *nix binary
220
+ exe <- which " purs.exe" -- windows binary (maybe it putted directly on the PATH)
221
+ cmd <- which " purs.cmd" -- windows binary wrapper (maybe it built with npm)
222
+ let purs = bin <|> exe <|> cmd
223
+ case purs of
224
+ Nothing -> exitWithErr " The \" purs\" executable could not be found. Please make sure your PATH variable is set correctly"
225
+ Just p -> return $ pathToTextUnsafe p
226
+
217
227
getTransitiveDeps :: PackageSet -> [PackageName ] -> IO [(PackageName , PackageInfo )]
218
228
getTransitiveDeps db deps =
219
229
Map. toList . fold <$> traverse (go Set. empty) deps
@@ -266,7 +276,8 @@ installImpl config@PackageConfig{ depends } limitJobs = do
266
276
267
277
getPureScriptVersion :: IO Version
268
278
getPureScriptVersion = do
269
- let pursProc = inproc " purs" [ " --version" ] empty
279
+ pursPath <- getPursPath
280
+ let pursProc = inproc pursPath [ " --version" ] empty
270
281
outputLines <- shellToIOText pursProc
271
282
case outputLines of
272
283
[onlyLine]
@@ -391,13 +402,15 @@ exec execNames onlyDeps passthroughOptions limitJobs = do
391
402
pkg <- readPackageFile
392
403
installImpl pkg limitJobs
393
404
405
+ pursPath <- getPursPath
394
406
paths <- getPaths
395
- let cmdParts = tail execNames
407
+ let cmdName = head execNames
408
+ cmdParts = tail execNames
396
409
srcParts = [ " src" </> " **" </> " *.purs" | not onlyDeps ]
397
410
exit
398
411
=<< Process. waitForProcess
399
412
=<< Process. runProcess
400
- (head execNames )
413
+ (if cmdName == " purs " then T. unpack pursPath else cmdName )
401
414
(cmdParts <> passthroughOptions
402
415
<> map Path. encodeString (srcParts <> paths))
403
416
Nothing -- no special path to the working dir
@@ -526,7 +539,8 @@ verify arg limitJobs = do
526
539
sem <- newQSem max'
527
540
mapConcurrently (bracket_ (waitQSem sem) (signalQSem sem) . dirFor) dependencies
528
541
let srcGlobs = map (pathToTextUnsafe . (</> (" src" </> " **" </> " *.purs" ))) dirs
529
- procs " purs" (" compile" : srcGlobs) empty
542
+ pursPath <- getPursPath
543
+ procs pursPath (" compile" : srcGlobs) empty
530
544
531
545
formatPackageFile :: IO ()
532
546
formatPackageFile =
0 commit comments