{"action":"created","issue":{"url":"https://api.github.com/repos/conda/conda-build/issues/706","labels_url":"https://api.github.com/repos/conda/conda-build/issues/706/labels{/name}","comments_url":"https://api.github.com/repos/conda/conda-build/issues/706/comments","events_url":"https://api.github.com/repos/conda/conda-build/issues/706/events","html_url":"https://github.com/conda/conda-build/issues/706","id":121181628,"number":706,"title":"[Feature Request] Add an option to write build scripts in Python","user":{"login":"frol","id":304265,"avatar_url":"https://avatars.githubusercontent.com/u/304265?v=3","gravatar_id":"","url":"https://api.github.com/users/frol","html_url":"https://github.com/frol","followers_url":"https://api.github.com/users/frol/followers","following_url":"https://api.github.com/users/frol/following{/other_user}","gists_url":"https://api.github.com/users/frol/gists{/gist_id}","starred_url":"https://api.github.com/users/frol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frol/subscriptions","organizations_url":"https://api.github.com/users/frol/orgs","repos_url":"https://api.github.com/users/frol/repos","events_url":"https://api.github.com/users/frol/events{/privacy}","received_events_url":"https://api.github.com/users/frol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-12-09T07:50:09Z","updated_at":"2015-12-09T15:35:51Z","closed_at":null,"body":"I do understand that I can write `build.sh` and `bld.bat` where I would call my Python build script (just like it is usually done with `setup.py`), but it adds at least 2 unnecessary `exec`s ((1) - conda-build running `build.sh`/`bld.bat`, and (2) - `build.sh`/`bld.bat` running `python setup.py install` or \"my python build script\").\r\n\r\nCalling Python functions from Python would save a couple of `exec`/`fork`s and would make writing build scripts nicer. Providing simple wrappers around `subprocess.Popen`, and other common `sh` functionality (e.g. `rm -rf`, `ls`) will make build scripts clean and simple, without need to write `sh` and `bat` separately.\r\n\r\nNOTE: I don't suggest to implement all those nice utils from scratch. There are already a couple of projects out there:\r\n\r\n* Python 3.4 introduced `pathlib` module: https://docs.python.org/3/library/pathlib.html\r\n* PyFilesystem (it might be an overkill): http://docs.pyfilesystem.org/en/latest/introduction.html\r\n* python-fs (it might be \"too elementary\"): https://github.com/chaosmail/python-fs\r\n* PyInvoke (it has a nice `run` command): http://www.pyinvoke.org/\r\n* python-sh (it might not work on Windows, but it might be still useful): https://amoffat.github.io/sh/\r\n\r\nNOTE: I have contemplated this feature while reading the discussion about OpenBSD support here #705, where was suggested to downgrade `bash` to `sh`."},"comment":{"url":"https://api.github.com/repos/conda/conda-build/issues/comments/163294728","html_url":"https://github.com/conda/conda-build/issues/706#issuecomment-163294728","issue_url":"https://api.github.com/repos/conda/conda-build/issues/706","id":163294728,"user":{"login":"groutr","id":10678620,"avatar_url":"https://avatars.githubusercontent.com/u/10678620?v=3","gravatar_id":"","url":"https://api.github.com/users/groutr","html_url":"https://github.com/groutr","followers_url":"https://api.github.com/users/groutr/followers","following_url":"https://api.github.com/users/groutr/following{/other_user}","gists_url":"https://api.github.com/users/groutr/gists{/gist_id}","starred_url":"https://api.github.com/users/groutr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groutr/subscriptions","organizations_url":"https://api.github.com/users/groutr/orgs","repos_url":"https://api.github.com/users/groutr/repos","events_url":"https://api.github.com/users/groutr/events{/privacy}","received_events_url":"https://api.github.com/users/groutr/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T15:35:51Z","updated_at":"2015-12-09T15:35:51Z","body":"The `build/script` is pretty cumbersome if your build step is more than a single line."}}