From 4770556939a7dfd53c608926a6ccf0320dd5e77f Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Mon, 8 Jan 2018 00:37:20 -0600 Subject: [PATCH] Fix for #280 --- src/nimble.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nimble.nim b/src/nimble.nim index cd7c8c6..a6d52ab 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -468,7 +468,17 @@ proc install(packages: seq[PkgTuple], let (downloadDir, downloadVersion) = downloadPkg(url, pv.ver, meth, options) try: + # Run pre-install hook in download directory now that package is downloaded + cd downloadDir: + if not execHook(options, true): + raise newException(NimbleError, "Pre-hook prevented further execution.") + result = installFromDir(downloadDir, pv.ver, options, url) + + # Run post-install hook in installed directory now that package is installed + # Standard hooks run in current directory so it won't detect this new package + cd result.pkg.myPath.parentDir(): + discard execHook(options, false) except BuildFailed: # The package failed to build. # Check if we tried building a tagged version of the package.