{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/nimble/issues/549","repository_url":"https://api.github.com/repos/nim-lang/nimble","labels_url":"https://api.github.com/repos/nim-lang/nimble/issues/549/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/nimble/issues/549/comments","events_url":"https://api.github.com/repos/nim-lang/nimble/issues/549/events","html_url":"https://github.com/nim-lang/nimble/issues/549","id":366411735,"node_id":"MDU6SXNzdWUzNjY0MTE3MzU=","number":549,"title":"v0.9.0 doesn't install files generated in `before install`","user":{"login":"genotrance","id":192231,"node_id":"MDQ6VXNlcjE5MjIzMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/192231?v=4","gravatar_id":"","url":"https://api.github.com/users/genotrance","html_url":"https://github.com/genotrance","followers_url":"https://api.github.com/users/genotrance/followers","following_url":"https://api.github.com/users/genotrance/following{/other_user}","gists_url":"https://api.github.com/users/genotrance/gists{/gist_id}","starred_url":"https://api.github.com/users/genotrance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genotrance/subscriptions","organizations_url":"https://api.github.com/users/genotrance/orgs","repos_url":"https://api.github.com/users/genotrance/repos","events_url":"https://api.github.com/users/genotrance/events{/privacy}","received_events_url":"https://api.github.com/users/genotrance/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-10-03T16:00:07Z","updated_at":"2018-10-21T17:55:25Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"All nimgen wrappers download and generate artifacts as part of the `before install` step. This includes checking out git repos of upstream C/C++ code and the generated .nim files from c2nim. All these need to be installed to `~/.nimble` for the package to work.\r\n\r\nThe new design to scan package contents in v0.9.0 is done before `before install` so none of these artifacts are included in the install, effectively breaking every single nimgen wrapper.\r\n\r\nIf I were to add an `installDirs = @[\"libsvm\"]` to all the .nimble files (this directory does not exist in the repo before `before install`), nimble complains that directory does not exist and requires an interactive response to proceed.\r\n\r\nIf instead, I check in an empty `libsvm` sub-directory, nimble fails as below.\r\n\r\n```\r\nnimble install -y\r\nSetting up Git repo\r\nChecking out artifacts\r\nProcessing libsvm/svm.h\r\nGenerating libsvm/svm.nim\r\n  Verifying dependencies for libsvm@0.1.2\r\n      Info: Dependency on nimgen@>= 0.2.3 already satisfied\r\n  Verifying dependencies for nimgen@0.4.0\r\n      Info: Dependency on c2nim@>= 0.9.13 already satisfied\r\n  Verifying dependencies for c2nim@#head\r\n      Info: Dependency on compiler@>= 0.16.0 already satisfied\r\n  Verifying dependencies for compiler@#head\r\n      Info: Dependency on regex@>= 0.7.1 already satisfied\r\n  Verifying dependencies for regex@0.7.3\r\n      Info: Dependency on unicodedb@>= 0.5.1 & < 0.6 already satisfied\r\n  Verifying dependencies for unicodedb@0.5.1\r\n      Info: Dependency on unicodeplus@>= 0.3.0 & < 0.4 already satisfied\r\n  Verifying dependencies for unicodeplus@0.3.2\r\n      Info: Dependency on unicodedb@>= 0.4 & < 0.6 already satisfied\r\n  Verifying dependencies for unicodedb@0.5.1\r\n Installing libsvm@0.1.2\r\nnimble.nim(1106)         nimble\r\nnimble.nim(1044)         doAction\r\nnimble.nim(474)          install\r\nnimble.nim(385)          installFromDir\r\npackageinfo.nim(518)     iterInstallFiles\r\npackageinfo.nim(486)     iterFilesInDir\r\npackageinfo.nim(486)     iterFilesInDir\r\npackageinfo.nim(486)     iterFilesInDir\r\npackageinfo.nim(488)     iterFilesInDir\r\nnimble.nim(389)          :anonymous\r\ntools.nim(98)            copyFileD\r\nos.nim(1204)             copyFileWithPermissions\r\nos.nim(599)              copyFile\r\noserr.nim(66)            raiseOSError\r\nError: unhandled exception: Permission denied [OSError]\r\n```\r\n\r\nIf I now think of @Araq suggestion to check in the generated files, I need to do it for every wrapper for every OS (win/lin/mac) and for every Nim version since c2nim will generate code that potentially isn't compatible with an older version of Nim since it uses the latest compiler code to render.\r\n\r\nIf I decide to take on that effort and proceed that way, I now have to ensure the right .nim files are imported for the right OS / Nim version combo. Right now, I'm unsure if that can be pulled off via a static nim file along with macros and when() statements. If I have to do anything `before install`, it won't work again.\r\n\r\nThe way it stands, scanning package contents before `before install` means you cannot have any dynamic packages, everything has to be static and that kind of defeats the purpose of `before install` in my mind."},"comment":{"url":"https://api.github.com/repos/nim-lang/nimble/issues/comments/431689563","html_url":"https://github.com/nim-lang/nimble/issues/549#issuecomment-431689563","issue_url":"https://api.github.com/repos/nim-lang/nimble/issues/549","id":431689563,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTY4OTU2Mw==","user":{"login":"h3rald","id":1169,"node_id":"MDQ6VXNlcjExNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/1169?v=4","gravatar_id":"","url":"https://api.github.com/users/h3rald","html_url":"https://github.com/h3rald","followers_url":"https://api.github.com/users/h3rald/followers","following_url":"https://api.github.com/users/h3rald/following{/other_user}","gists_url":"https://api.github.com/users/h3rald/gists{/gist_id}","starred_url":"https://api.github.com/users/h3rald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h3rald/subscriptions","organizations_url":"https://api.github.com/users/h3rald/orgs","repos_url":"https://api.github.com/users/h3rald/repos","events_url":"https://api.github.com/users/h3rald/events{/privacy}","received_events_url":"https://api.github.com/users/h3rald/received_events","type":"User","site_admin":false},"created_at":"2018-10-21T17:55:25Z","updated_at":"2018-10-21T17:55:25Z","author_association":"NONE","body":"Errr yeah... right. I tried a) but got lost with the whole script execution. Essentially installDirs, installExt etc. are updated within the script, but the modifications aren't passed to the outer execution scope, so updating any of these in a before hook has no effect.\r\n\r\nIs there any way to read these variables _after_ the script execution and manually update the ones used by tasks? I tried accessing the PSym resulting from the execution but I couldn't get much out of it.\r\n\r\nInstead, I provided a PR for b) 😄 "}}
{"actor":{"display_login":"h3rald"}}