mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
538 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 731a0cb0bf | |||
| ebd97e9b93 | |||
| 9fcf81c170 | |||
| 1f2cb16dbb | |||
| 827306728f | |||
| f6076cb7f0 | |||
| 694386e233 | |||
| f11928af11 | |||
| acda8f640a | |||
| 4ff3a5d818 | |||
| 314b729c8a | |||
| 9fb676aba9 | |||
| b91741d10d | |||
| f3787356b6 | |||
| def3136c85 | |||
| abb0c9b384 | |||
| 87b2891c1a | |||
| 52c34ef64f | |||
| 40bc836a55 | |||
| d2738ece19 | |||
| f758a5d738 | |||
| 63edc5d89b | |||
| 0db1584f21 | |||
| 1ed173f21d | |||
| b17f3f51f7 | |||
| 4f0556cce7 | |||
| b55a5e5ec8 | |||
| 68acbb064d | |||
| 92df76793f | |||
| 5cda51c7a5 | |||
| 659a406eb8 | |||
| 4cf2dd5b32 | |||
| 100a5ba0bc | |||
| ab16abaa88 | |||
| 989dd1dd2a | |||
| 0468ef22c4 | |||
| 6238994a17 | |||
| 7ba2fe66a0 | |||
| dfaec438d9 | |||
| aaeef59ff6 | |||
| 4d35f5129a | |||
| 84f610347c | |||
| 44bfda1320 | |||
| 330524adba | |||
| 85bddf8f00 | |||
| 7b0d891f4d | |||
| 84f0e2feba | |||
| 76309c35ec | |||
| 3f6b453c0a | |||
| 43dbb49103 | |||
| f08f93f347 | |||
| e0c852f4b9 | |||
| 15373996f4 | |||
| ff1e8da0cb | |||
| 99f7f5b9f1 | |||
| 656f390de8 | |||
| 42a7e79359 | |||
| bf084cc2ac | |||
| eaaba665bc | |||
| 94d311134c | |||
| 0d49ae9851 | |||
| a5c39384a8 | |||
| cb6bc30bc6 | |||
| 82c72a94d9 | |||
| f327afd364 | |||
| d94f4c5bbc | |||
| 8be04ea656 | |||
| de7c16d942 | |||
| 5ea843458a | |||
| 758941d12f | |||
| e01d5bc18b | |||
| 2c16539190 | |||
| ed79e61a2f | |||
| b7bcc69722 | |||
| 3dde375d0b | |||
| 483e30a5ba | |||
| e783556e6b | |||
| 5645a433dc | |||
| 715ab8b96a | |||
| 5f96190eb5 | |||
| c579162ef9 | |||
| a5cca6de75 | |||
| b7f1157693 | |||
| ae7b6fc715 | |||
| e0c3b72950 | |||
| 566f7f4555 | |||
| 4ff62b2b41 | |||
| d47970fd81 | |||
| 69bdca063f | |||
| 63cea99415 | |||
| 5ecd27e3b8 | |||
| 206a2dbc04 | |||
| 2a083791b6 | |||
| d5b2b0b464 | |||
| 2eab1ad845 | |||
| 2b16420d41 | |||
| 9fa0889499 | |||
| 99b17fabeb | |||
| 933d3014d7 | |||
| 018e0f31de | |||
| cf1647e937 | |||
| b9f154bf38 | |||
| 4cc18ce0af | |||
| f5ea1c24a3 | |||
| 952b0bb735 | |||
| 8b7edad8a2 | |||
| 02787ac910 | |||
| bcc3ba09ca | |||
| 31e65dc58b | |||
| 9a227e6c73 | |||
| ddc9c24d34 | |||
| 42488a2be7 | |||
| 839486c25b | |||
| 5d56200179 | |||
| fef1d4f7c0 | |||
| 43defcc17e | |||
| f78460e2a7 | |||
| 3448923b69 | |||
| 58a13bc268 | |||
| c18038f986 | |||
| d4356a1f4c | |||
| 3c8f478b65 | |||
| 23493302e6 | |||
| 35ceaf728d | |||
| 5c9412fc33 | |||
| 825c9329eb | |||
| 9ebb990716 | |||
| f964209589 | |||
| 2e699d392e | |||
| 431ecee509 | |||
| 90696215ae | |||
| 5b55261700 | |||
| 727ff90acf | |||
| 0060fdacd8 | |||
| 85ad1fa988 | |||
| 56c022ca41 | |||
| f68e0989ea | |||
| 7381117bb8 | |||
| c9209ebb3d | |||
| 35345d11f5 | |||
| 6ee17b4c26 | |||
| 86267f93a1 | |||
| 50642e7069 | |||
| 8349f291d2 | |||
| 1aad21382e | |||
| 686ee087a5 | |||
| f137ba213a | |||
| 5ae51010cc | |||
| 29d8e7f670 | |||
| 5be3e0ce52 | |||
| ddde30a12e | |||
| 2db5578998 | |||
| 290250836f | |||
| 0ff4df4dc3 | |||
| 9177aa2c08 | |||
| ad791dc7f8 | |||
| 6b298ff7f3 | |||
| 01e30e938c | |||
| e81632e05e | |||
| 4ab3358851 | |||
| 4ded988907 | |||
| 8637dc05c0 | |||
| 6f65ad0b97 | |||
| c5ec378ea7 | |||
| 37013c2eca | |||
| 54a8a6407e | |||
| 69360fb804 | |||
| 92d296ec24 | |||
| 99557332a0 | |||
| a3d9c5a1b2 | |||
| 235ff64a38 | |||
| 0f7fca9e03 | |||
| 161bf49a3a | |||
| 7ac90f19dd | |||
| 90cc426c82 | |||
| 550a239553 | |||
| 57fea1bd6f | |||
| d758545164 | |||
| 5935632b8b | |||
| 8f3a7b7947 | |||
| 2f47bd12fd | |||
| 86fb607dd4 | |||
| 80823b1e16 | |||
| ff6f56b8c5 | |||
| 5393ba3cb4 | |||
| 4ade6c0457 | |||
| e5c389e677 | |||
| ea27b5a77c | |||
| 18c19e4466 | |||
| 0ea950ee52 | |||
| 2d3033fc71 | |||
| 1687f1cffe | |||
| 2f0263a5b8 | |||
| dfbf20acd2 | |||
| 0b9019ab71 | |||
| b0fc2245f4 | |||
| 113c669041 | |||
| b8b5e12a4a | |||
| bece3de495 | |||
| 89120f7797 | |||
| 99e035495b | |||
| 0c56b0c35c | |||
| 111f92e368 | |||
| 03e666ffea | |||
| 40598be9d4 | |||
| 8f057f3c9b | |||
| 972e6f8054 | |||
| aeb7ef392a | |||
| 930a63d55c | |||
| 544de727a0 | |||
| 466e6b5fe3 | |||
| 1abaaf6cf1 | |||
| 48bd910207 | |||
| 87c580f819 | |||
| db1df1ac67 | |||
| 4005d7ea50 | |||
| d29d4404c3 | |||
| 33779576bd | |||
| 3bddd66637 | |||
| e00a407c91 | |||
| 117dcff4e1 | |||
| 7243afd5b5 | |||
| 0a75bc9744 | |||
| ca3b3808b9 | |||
| 287b398826 | |||
| 76d2eda80e | |||
| 880c498c3f | |||
| 12f053ef7f | |||
| 35ee2f60bd | |||
| 3e480e9aea | |||
| 46ba98a4ee | |||
| 958de9441a | |||
| 74312f5487 | |||
| ecf5278679 | |||
| 863abfb00e | |||
| f782693537 | |||
| a2c2411109 | |||
| 712f02e359 | |||
| 61477e515a | |||
| be9343534a | |||
| 2b4e9be4ad | |||
| 382dff7e3b | |||
| 6f2012c1c9 | |||
| c71fe81f8d | |||
| 91586d6690 | |||
| 046726b864 | |||
| ddf353cff5 | |||
| 160497cb64 | |||
| 6194f94aa7 | |||
| e288332f0e | |||
| e4979f33e3 | |||
| 03c3aebca8 | |||
| 487a5ffb95 | |||
| 01d15d4d0e | |||
| 6655794b4d | |||
| 4beb57a5a0 | |||
| bac517e755 | |||
| 62b68cfcd9 | |||
| 481e800a7c | |||
| 9a7c6c339d | |||
| 23340bcfee | |||
| 102979e985 | |||
| ab9a4fbe5f | |||
| aad72f8e81 | |||
| 72295bf186 | |||
| c45a2c14b2 | |||
| ee177b28ff | |||
| 2e0f2f59a0 | |||
| 9856efa7c4 | |||
| 34878b9638 | |||
| 27abdfe7d7 | |||
| 3b0bdba799 | |||
| b547d8c30c | |||
| 1bd317cd50 | |||
| 60b57fd368 | |||
| 27a22e8ccb | |||
| 0378bbb491 | |||
| bccec5cee9 | |||
| d6fbb29977 | |||
| 9d0bf98a52 | |||
| 795272d625 | |||
| c3866f80b6 | |||
| 580a662f36 | |||
| 5767e0df04 | |||
| eeb63f215a | |||
| 5a6e4e49b4 | |||
| b6eada4e67 | |||
| bbe0acf001 | |||
| 05e65801fa | |||
| 08338a4a26 | |||
| bf913e0016 | |||
| 774ceb3367 | |||
| 335a14c714 | |||
| 4dea56d4a0 | |||
| c9916dd2e3 | |||
| 662a311f95 | |||
| bfd6ea22ca | |||
| c5d7991468 | |||
| c4404694e1 | |||
| e914736956 | |||
| 23833dda9b | |||
| 15573b9d3f | |||
| 86661c1cda | |||
| 9cbace7f76 | |||
| 74cb870488 | |||
| ae9b83f07c | |||
| d70c681c32 | |||
| c312d917a1 | |||
| 5d2ecd2f1f | |||
| a1e1dbd865 | |||
| 12f28894ce | |||
| 538ef6e378 | |||
| 1588ea44b2 | |||
| 3cc9098e25 | |||
| 436e945a91 | |||
| f9b83a4e95 | |||
| b1f8bf9f5e | |||
| 7af5175942 | |||
| c24a9096de | |||
| 36d27c46ed | |||
| 713fa36bca | |||
| 20249f9672 | |||
| 8b55e73f77 | |||
| 2058b3c5bf | |||
| 4eb17eb9a9 | |||
| 7138b7afb2 | |||
| fe9b9401d3 | |||
| 8c870cabfb | |||
| b8182c077a | |||
| fbbdadd347 | |||
| b54faf36f5 | |||
| a0dc2a6f33 | |||
| f775fca31c | |||
| efebff4ce8 | |||
| 94b2ab43a5 | |||
| a21dbc2da1 | |||
| cf5a9d26d1 | |||
| ef4772b87a | |||
| ffda318476 | |||
| 6aff0d0197 | |||
| b9ebd33703 | |||
| 61e17df22d | |||
| b88d0ad800 | |||
| 7e24f94164 | |||
| 3a239aa71a | |||
| 0e1ae7a798 | |||
| 133c308796 | |||
| 7ea8c861a2 | |||
| 20e0af2bf4 | |||
| 5d0ed4e7cd | |||
| 144629d7dc | |||
| cf36e8c7cb | |||
| 233df5d59d | |||
| 375796063b | |||
| d8a70de8a8 | |||
| f1ee7fc04f | |||
| e8585fb4a7 | |||
| e10cc01f7e | |||
| 79d6db74b1 | |||
| 69d607a76e | |||
| 2c03d89213 | |||
| 11bf9833da | |||
| d2d37255d5 | |||
| bea5b4919e | |||
| b67a040474 | |||
| d40199ec00 | |||
| 6f7390921c | |||
| e5fa0473de | |||
| 889b777eeb | |||
| 8d4626ef81 | |||
| 7c7d2bc959 | |||
| d76a7c5ea2 | |||
| 3641a97b5f | |||
| 5e818e85f3 | |||
| c9d10077af | |||
| 6394214b55 | |||
| bfa26b8b05 | |||
| 15172c86b9 | |||
| daa85630c7 | |||
| 9914e50d8a | |||
| ef59b5ad6b | |||
| 98741a0606 | |||
| 6aadf1683a | |||
| e10cb6bfb1 | |||
| 2fd6d7e1f8 | |||
| 30c12d9c63 | |||
| 3313891205 | |||
| 1e914b8558 | |||
| b9fc30f592 | |||
| e8e67fe093 | |||
| 66e49c764c | |||
| 322d19689f | |||
| 07a6853585 | |||
| f34599c5ad | |||
| 97c5f0944d | |||
| 1e598e2511 | |||
| 966a5e35db | |||
| d760946828 | |||
| 3dda7c3731 | |||
| 3441833521 | |||
| 603950ca65 | |||
| a946ce09c0 | |||
| c196347e58 | |||
| 979491a631 | |||
| fef3581417 | |||
| f6d948b0e0 | |||
| 2f42fdb282 | |||
| b16261c158 | |||
| 3e1d657888 | |||
| 06946d3632 | |||
| cd8530a5c2 | |||
| 91015bd2c1 | |||
| 907b66624b | |||
| 193352c616 | |||
| 2e551e9c4e | |||
| 58c625affd | |||
| b13702972d | |||
| 8c16776d72 | |||
| 7e4405989a | |||
| 15b819703a | |||
| bf2372101f | |||
| d87f88ee4d | |||
| 24266be8db | |||
| 3187d73b64 | |||
| 48f52668be | |||
| f7ef15d7d0 | |||
| d084ac8a58 | |||
| 077d93e283 | |||
| 71409e7712 | |||
| 61a7ad7116 | |||
| d1ab3939e9 | |||
| 0f2f10557c | |||
| ad748743cd | |||
| 844a8daad6 | |||
| 93cc65adfc | |||
| 3a1aa3f6af | |||
| 5b5f124082 | |||
| cd17d3948c | |||
| 7c49ceaf2c | |||
| a156996d61 | |||
| 9438005891 | |||
| aefde88d24 | |||
| 347bca0de4 | |||
| a0f2073eb1 | |||
| 1b0fd2e4b6 | |||
| 4be3d87e04 | |||
| 5ffe9203d3 | |||
| 24cd70dc95 | |||
| 6e9b241fb2 | |||
| 4cc660a3a7 | |||
| 7c48f6d17b | |||
| c4d7ae49ba | |||
| 26dd3828df | |||
| ead7b1a04a | |||
| 1ddd5c2515 | |||
| e1fcbc067a | |||
| 9bf33597c3 | |||
| 17a8e05a90 | |||
| 7a01a6850c | |||
| 6fdcc392dd | |||
| 3e5bea876d | |||
| 976089104b | |||
| a8220a20ba | |||
| 123639b436 | |||
| 7b1b24860a | |||
| 2e192e79a6 | |||
| 9662b9a2f0 | |||
| 8f5385f9ca | |||
| 0b46e1d807 | |||
| 35a1b8dd62 | |||
| 760b17431a | |||
| 4d3a352889 | |||
| 3fa65989ea | |||
| 1553d4dbc3 | |||
| ac766e2615 | |||
| fee800cb21 | |||
| 7fd0e8de3c | |||
| 1dd1afc972 | |||
| c1e8b1d80c | |||
| fb19d5fec2 | |||
| b2f01679a5 | |||
| c5703462c2 | |||
| deeea09e5d | |||
| b39ffa8fa3 | |||
| 0b1926f089 | |||
| f05fc7b559 | |||
| 37590bf0e0 | |||
| fd25ce1a0d | |||
| f581e1c685 | |||
| 977c4816ed | |||
| 7a022245d4 | |||
| 503377a00b | |||
| a624be1e20 | |||
| 41ad52e495 | |||
| eaae6b90d4 | |||
| 746ba06894 | |||
| faa349ca19 | |||
| 825d41695d | |||
| de0b6556b6 | |||
| 8486015d7c | |||
| ce268a3c8f | |||
| 8072330640 | |||
| 327b1dea25 | |||
| 8f29269e41 | |||
| 1b4d14e24c | |||
| 710f932184 | |||
| 02e410fd20 | |||
| c90128faf6 | |||
| c5ff543a69 | |||
| 639d1dc9cc | |||
| 118cc029fb | |||
| 54545df970 | |||
| 4c94607882 | |||
| ff893b7a72 | |||
| 034fbc1c8f | |||
| 2eb941b077 | |||
| bedd8ea111 | |||
| 9ed91cd53a | |||
| 17d97cde49 | |||
| 09eff5f4d7 | |||
| 3400cebfd2 | |||
| ac4fb2ad9d | |||
| 13186e4674 | |||
| aaa3f1ee1a | |||
| 74cad013b9 | |||
| 8ec956758e | |||
| c0b4a0e3c7 | |||
| 8566a65067 | |||
| 9c82d44129 | |||
| 4e2dd4b6cf | |||
| f9f9ae54fa | |||
| a00b4900cd | |||
| cd01dc0c17 | |||
| 2750238a0c | |||
| f2596e4cbc | |||
| b6955dd9b6 | |||
| 36994d02b3 | |||
| 9902caea79 |
@@ -1 +1,2 @@
|
||||
*.pyc
|
||||
site
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
language: python
|
||||
python:
|
||||
- 2.7
|
||||
script: make tests
|
||||
notifications:
|
||||
email: false
|
||||
+112
-1
@@ -1,9 +1,119 @@
|
||||
## v14
|
||||
|
||||
Features:
|
||||
|
||||
* Full removal of Django settings injection for new apps.
|
||||
* Support for profile.d
|
||||
* Fresh app detection.
|
||||
* Update to Virtualenv v1.7.2
|
||||
* Updated to Pip v1.1 (patched)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Default pip path exists action.
|
||||
|
||||
## v13
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fix pip quoting error.
|
||||
* Only talk about collectstatic in buildpack output when it's configured.
|
||||
|
||||
## v12
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Catch database setting corner case.
|
||||
|
||||
## v11
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Cleanup collectstatic output.
|
||||
|
||||
|
||||
## v10
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Check for collectstatic validity with --dry-run instead of --help for Django 1.4.
|
||||
|
||||
## v9
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Unset PYTHONHOME in buildpack for [user_env_compile](http://devcenter.heroku.com/articles/labs-user-env-compile).
|
||||
|
||||
## v8
|
||||
|
||||
Features:
|
||||
|
||||
* Disable Django collectstatic with `$DISABLE_COLLECTSTATIC` + [user_env_compile](http://devcenter.heroku.com/articles/labs-user-env-compile).
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Don't disbable injection for new Django apps.
|
||||
* Inform user of July 1, 2012 deprecation of Django injection.
|
||||
|
||||
## v7
|
||||
|
||||
Features:
|
||||
|
||||
* Full removal of Django setting injection for new apps.
|
||||
* Automatic execution of collectstatic.
|
||||
* Suppress collectstatic errors via env SILENCE_COLLECTSTATIC.
|
||||
* Increase settings.py search depth to 3.
|
||||
* Search recursively from included requirements.txt files.
|
||||
|
||||
|
||||
## v6 (03/23/2012)
|
||||
|
||||
Features:
|
||||
|
||||
* Dist packages (setup.py) support.
|
||||
* Move new virtualenvs to `/app/.heroku/venv`.
|
||||
* Heavily improved Django app detection, accounting for `Django` in `requirements.txt`.
|
||||
* Literate [documentation](http://python-buildpack.herokuapp.com).
|
||||
* Default `$PYTHONHOME`, `$PYTHONPATH`, and `$LANG` configurations.
|
||||
* Disable Django setting injection with `$DISABLE_INJECTION` + [user_env_compile](http://devcenter.heroku.com/articles/labs-user-env-compile).
|
||||
* General code refactor and improved messaging.
|
||||
* Unit tests.
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Django 1.4 startproject template layout support.
|
||||
* Django `manage.py` location can now be independent from `settings.py`.
|
||||
|
||||
## v5 (02/01/2012)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Git requirements 100% work.
|
||||
|
||||
|
||||
## v4 (01/20/2012)
|
||||
|
||||
Features:
|
||||
|
||||
* Updated to virtualenv v1.7 with patched pip v1.2.
|
||||
* Actually activate created virtualenv within compile process.
|
||||
* Use distribute instead of deprecated setuptools.
|
||||
* Automatically destroy and rebuild corrupt virtualenvs.
|
||||
* Refactor django and pylibmc detection.
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fixed `package==dev` in requirements with patched pip embedded within virtualenv. Patch upstreamed.
|
||||
* Minor curl/rm flag fixes (thanks, contributors!)
|
||||
|
||||
|
||||
## v3 (12/07/2011)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Better django setup.py injection.
|
||||
|
||||
|
||||
## v2 (11/15/2011)
|
||||
|
||||
Features:
|
||||
@@ -14,6 +124,7 @@ Bugfixes:
|
||||
|
||||
* Detect when virtualenv is checked in and alert user.
|
||||
|
||||
|
||||
## v1 (10/01/2011)
|
||||
|
||||
* Conception.
|
||||
* Conception.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License:
|
||||
|
||||
Copyright (C) 2013 Heroku, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,8 +1,8 @@
|
||||
Heroku buildpack: Python
|
||||
========================
|
||||
|
||||
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for Python apps.
|
||||
It uses [virtualenv](http://www.virtualenv.org/) and [pip](http://www.pip-installer.org/).
|
||||
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](http://www.pip-installer.org/).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
@@ -12,32 +12,43 @@ Example usage:
|
||||
$ ls
|
||||
Procfile requirements.txt web.py
|
||||
|
||||
$ heroku create --stack cedar --buildpack git@github.com:heroku/heroku-buildpack-python.git
|
||||
$ heroku create --buildpack git://github.com/heroku/heroku-buildpack-python.git
|
||||
|
||||
$ git push heroku master
|
||||
...
|
||||
-----> Heroku receiving push
|
||||
-----> Fetching custom build pack... done
|
||||
-----> Python app detected
|
||||
-----> Preparing virtualenv version 1.6.4
|
||||
New python executable in ./bin/python
|
||||
Installing setuptools............done.
|
||||
Installing pip...............done.
|
||||
-----> Installing dependencies using pip version 1.0.2
|
||||
Downloading/unpacking Flask==0.7.2 (from -r requirements.txt (line 1))
|
||||
Downloading/unpacking Werkzeug>=0.6.1 (from Flask==0.7.2->-r requirements.txt (line 1))
|
||||
Downloading/unpacking Jinja2>=2.4 (from Flask==0.7.2->-r requirements.txt (line 1))
|
||||
Installing collected packages: Flask, Werkzeug, Jinja2
|
||||
Successfully installed Flask Werkzeug Jinja2
|
||||
-----> No runtime.txt provided; assuming python-2.7.6.
|
||||
-----> Preparing Python runtime (python-2.7.6)
|
||||
-----> Installing Setuptools (3.6)
|
||||
-----> Installing Pip (1.5.6)
|
||||
-----> Installing dependencies using Pip (1.5.6)
|
||||
Downloading/unpacking requests (from -r requirements.txt (line 1))
|
||||
Installing collected packages: requests
|
||||
Successfully installed requests
|
||||
Cleaning up...
|
||||
-----> Discovering process types
|
||||
Procfile declares types -> (none)
|
||||
|
||||
The buildpack will detect your app as Python if it has the file `requirements.txt` in the root. It will detect your app as Python/Django if there is an additional `settings.py` in a project subdirectory.
|
||||
You can also add it to upcoming builds of an existing application:
|
||||
|
||||
It will use virtualenv and pip to install your dependencies, vendoring a copy of the Python runtime into your slug. The `bin/`, `include/` and `lib/` directories will be cached between builds to allow for faster pip install time.
|
||||
$ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
|
||||
|
||||
Hacking
|
||||
-------
|
||||
The buildpack will detect your app as Python if it has the file `requirements.txt` in the root.
|
||||
|
||||
To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with `--buildpack <your-github-url>` and push to it.
|
||||
It will use Pip to install your dependencies, vendoring a copy of the Python runtime into your slug.
|
||||
|
||||
To change the vendored virtualenv, unpack the desired version to the `src/` folder, and update the virtualenv() function in `bin/compile` to prepend the virtualenv module directory to the path. The virtualenv release vendors its own versions of pip and setuptools.
|
||||
Specify a Runtime
|
||||
-----------------
|
||||
|
||||
You can also provide arbitrary releases Python with a `runtime.txt` file.
|
||||
|
||||
$ cat runtime.txt
|
||||
python-3.4.0
|
||||
|
||||
Runtime options include:
|
||||
|
||||
- python-2.7.6
|
||||
- python-3.4.0
|
||||
- pypy-1.9 (experimental)
|
||||
|
||||
Other [unsupported runtimes](https://github.com/kennethreitz/python-versions/tree/master/formula) are available as well.
|
||||
|
||||
+253
-126
@@ -1,153 +1,280 @@
|
||||
#!/usr/bin/env bash
|
||||
# bin/compile <build-dir> <cache-dir>
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# $ bin/compile <build-dir> <cache-dir> <env-path>
|
||||
|
||||
# Fail fast and fail hard.
|
||||
set -eo pipefail
|
||||
|
||||
# Prepend proper path for virtualenv hackery. This will be deprecated soon.
|
||||
export PATH=:/usr/local/bin:$PATH
|
||||
|
||||
# Paths.
|
||||
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
|
||||
ROOT_DIR=$(dirname $BIN_DIR)
|
||||
BUILD_DIR=$1
|
||||
CACHE_DIR=$2
|
||||
ENV_DIR=$3
|
||||
|
||||
NAME=$($BIN_DIR/detect $BUILD_DIR)
|
||||
PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-$CACHE_DIR/pip_downloads}
|
||||
VIRTUALENV_DIRS="bin include lib"
|
||||
VENDORED_MEMCACHED="http://cl.ly/0a191R3K160t1w1P0N25/vendor-libmemcached.tar.gz"
|
||||
|
||||
indent() {
|
||||
RE="s/^/ /"
|
||||
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
|
||||
}
|
||||
CACHED_DIRS=".heroku"
|
||||
|
||||
virtualenv() {
|
||||
python - "$@" <<EOF
|
||||
import sys
|
||||
sys.path.insert(0, "$ROOT_DIR/src/virtualenv-1.6.4")
|
||||
import virtualenv
|
||||
virtualenv.main()
|
||||
EOF
|
||||
}
|
||||
# Static configurations for virtualenv caches.
|
||||
VIRTUALENV_LOC=".heroku/venv"
|
||||
LEGACY_TRIGGER="lib/python2.7"
|
||||
PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh"
|
||||
|
||||
DEFAULT_PYTHON_VERSION="python-2.7.7"
|
||||
PYTHON_EXE="/app/.heroku/python/bin/python"
|
||||
PIP_VERSION="1.5.6"
|
||||
SETUPTOOLS_VERSION="3.6"
|
||||
|
||||
# Setup bpwatch
|
||||
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
|
||||
LOGPLEX_KEY="t.b90d9d29-5388-4908-9737-b4576af1d4ce"
|
||||
export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json
|
||||
BUILDPACK_VERSION=v28
|
||||
|
||||
# Support Anvil Build_IDs
|
||||
[ ! "$SLUG_ID" ] && SLUG_ID="defaultslug"
|
||||
[ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID
|
||||
|
||||
# Sanitizing environment variables.
|
||||
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
|
||||
|
||||
bpwatch init $LOGPLEX_KEY
|
||||
bpwatch build python $BUILDPACK_VERSION $REQUEST_ID
|
||||
TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
|
||||
|
||||
bpwatch start compile
|
||||
|
||||
|
||||
# We'll need to send these statics to other scripts we `source`.
|
||||
export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH
|
||||
|
||||
# Syntax sugar.
|
||||
source $BIN_DIR/utils
|
||||
|
||||
# Directory Hacks for path consistiency.
|
||||
APP_DIR='/app'
|
||||
TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
|
||||
|
||||
# Copy Anvil app dir to temporary storage...
|
||||
bpwatch start anvil_appdir_stage
|
||||
if [ "$SLUG_ID" ]; then
|
||||
mkdir -p $TMP_APP_DIR
|
||||
deep-mv $APP_DIR $TMP_APP_DIR
|
||||
else
|
||||
deep-rm $APP_DIR
|
||||
fi
|
||||
bpwatch stop anvil_appdir_stage
|
||||
|
||||
# Copy Application code in.
|
||||
bpwatch start appdir_stage
|
||||
deep-mv $BUILD_DIR $APP_DIR
|
||||
bpwatch stop appdir_stage
|
||||
|
||||
# Set new context.
|
||||
ORIG_BUILD_DIR=$BUILD_DIR
|
||||
BUILD_DIR=$APP_DIR
|
||||
|
||||
# Prepend proper path buildpack use.
|
||||
export PATH=$BUILD_DIR/.heroku/python/bin:$BUILD_DIR/.heroku/vendor/bin:$PATH
|
||||
export PYTHONUNBUFFERED=1
|
||||
export LANG=en_US.UTF-8
|
||||
export C_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include:/app/.heroku/python/include
|
||||
export CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include:/app/.heroku/python/include
|
||||
export LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib:/app/.heroku/python/lib
|
||||
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib:/app/.heroku/python/lib
|
||||
export PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:$BUILD_DIR/.heroku/vendor/lib/pkg-config:/app/.heroku/python/lib/pkg-config
|
||||
|
||||
# Switch to the repo's context.
|
||||
cd $BUILD_DIR
|
||||
|
||||
# reject a non-packaged Django app
|
||||
if [ "$NAME" = "Python" ]; then
|
||||
[ -f manage.py ] && [ -f settings.py ] && { echo " ! Django app must be in a package subdirectory"; exit 1; }
|
||||
# Experimental pre_compile hook.
|
||||
bpwatch start pre_compile
|
||||
source $BIN_DIR/steps/hooks/pre_compile
|
||||
bpwatch stop pre_compile
|
||||
|
||||
# If no requirements given, assume `setup.py develop`.
|
||||
if [ ! -f requirements.txt ]; then
|
||||
puts-step "No requirements.txt provided; assuming dist package."
|
||||
echo "-e ." > requirements.txt
|
||||
fi
|
||||
|
||||
# warn a checked-in virtualenv
|
||||
if [ -d "lib" ] || [ -d "bin" ]; then
|
||||
echo " ! You have a virtualenv checked in. You should ignore the appropriate paths in your repo. See http://devcenter.heroku.com/articles/gitignore for more info.";
|
||||
# Sticky runtimes.
|
||||
if [ -f $CACHE_DIR/.heroku/python-version ]; then
|
||||
DEFAULT_PYTHON_VERSION=$(cat $CACHE_DIR/.heroku/python-version)
|
||||
fi
|
||||
|
||||
# reject a conflicting checked-in virtualenv
|
||||
if [ -f "lib/python2.7" ]; then
|
||||
echo " ! Checked-in virtualenv conflict."
|
||||
exit 1;
|
||||
# If no runtime given, assume default version.
|
||||
if [ ! -f runtime.txt ]; then
|
||||
echo $DEFAULT_PYTHON_VERSION > runtime.txt
|
||||
fi
|
||||
|
||||
|
||||
# copy artifacts out of cache if exists
|
||||
# ### The Cache
|
||||
mkdir -p $CACHE_DIR
|
||||
for dir in $VIRTUALENV_DIRS; do
|
||||
cp -R $CACHE_DIR/$dir . &> /dev/null || true
|
||||
done
|
||||
|
||||
echo "-----> Preparing virtualenv version $(virtualenv --version)"
|
||||
virtualenv --no-site-packages . | indent
|
||||
# Purge "old-style" virtualenvs.
|
||||
bpwatch start clear_old_venvs
|
||||
[ -d $CACHE_DIR/$LEGACY_TRIGGER ] && rm -fr $CACHE_DIR/.heroku/bin $CACHE_DIR/.heroku/lib $CACHE_DIR/.heroku/include
|
||||
[ -d $CACHE_DIR/$VIRTUALENV_LOC ] && rm -fr $CACHE_DIR/.heroku/venv $CACHE_DIR/.heroku/src
|
||||
bpwatch stop clear_old_venvs
|
||||
|
||||
# create set-aside .heroku folder.
|
||||
mkdir .heroku
|
||||
|
||||
|
||||
# if pylibmc within requirements, use vendored libmemcached
|
||||
if (grep -Fxiq "pylibmc" requirements.txt) || (grep -Fiq "pylibmc=" requirements.txt)
|
||||
then
|
||||
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
|
||||
cd .heroku
|
||||
|
||||
if [ -d "vendor/lib/sasl2" ]; then
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
else
|
||||
curl -s -L -O $VENDORED_MEMCACHED
|
||||
tar -zxvf vendor-libmemcached.tar.gz > /dev/null
|
||||
rm vendor-libmemcached.tar.gz
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# if Django, append settings
|
||||
if [ "$NAME" = "Python/Django" ]; then
|
||||
echo "-----> Django settings injection"
|
||||
|
||||
SETTINGS_FILE=$(ls **/settings.py | head -1)
|
||||
PROJECT=$(dirname $SETTINGS_FILE)
|
||||
echo "Injecting code into $SETTINGS_FILE to read from DATABASE_URL" | indent
|
||||
|
||||
cat >>$SETTINGS_FILE <<EOF
|
||||
|
||||
import os
|
||||
import sys
|
||||
import urlparse
|
||||
urlparse.uses_netloc.append('postgres')
|
||||
urlparse.uses_netloc.append('mysql')
|
||||
|
||||
try:
|
||||
|
||||
# Check to make sure DATABASES is set in settings.py file.
|
||||
# If not default to {}
|
||||
|
||||
if 'DATABASES' not in locals():
|
||||
DATABASES = {}
|
||||
|
||||
if 'DATABASE_URL' in os.environ:
|
||||
url = urlparse.urlparse(os.environ['DATABASE_URL'])
|
||||
|
||||
# Ensure default database exists.
|
||||
DATABASES['default'] = DATABASES.get('default', {})
|
||||
|
||||
# Update with environment configuration.
|
||||
DATABASES['default'].update({
|
||||
'NAME': url.path[1:],
|
||||
'USER': url.username,
|
||||
'PASSWORD': url.password,
|
||||
'HOST': url.hostname,
|
||||
'PORT': url.port,
|
||||
})
|
||||
if url.scheme == 'postgres':
|
||||
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
|
||||
|
||||
if url.scheme == 'mysql':
|
||||
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
|
||||
except:
|
||||
print 'Unexpected error:', sys.exc_info()
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if (grep -Fiq "hg+" requirements.txt) then
|
||||
PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install --use-mirrors mercurial | indent
|
||||
source bin/activate
|
||||
fi
|
||||
|
||||
echo "-----> Installing dependencies using pip version $(bin/pip --version | awk '{print $2}')"
|
||||
PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install --use-mirrors -r requirements.txt | indent
|
||||
# Restore old artifacts from the cache.
|
||||
bpwatch start restore_cache
|
||||
for dir in $CACHED_DIRS; do
|
||||
cp -R $CACHE_DIR/$dir . &> /dev/null || true
|
||||
done
|
||||
bpwatch stop restore_cache
|
||||
|
||||
set +e
|
||||
OUT=$(virtualenv --relocatable .)
|
||||
[ $? -ne 0 ] && {
|
||||
echo " ! Error making virtualenv relocatable"
|
||||
echo "$OUT" | indent
|
||||
exit 1
|
||||
}
|
||||
# Create set-aside `.heroku` folder.
|
||||
mkdir .heroku &> /dev/null
|
||||
set -e
|
||||
|
||||
# store new artifacts in cache
|
||||
for dir in $VIRTUALENV_DIRS; do
|
||||
rm -rf $CACHE_DIR/$dir
|
||||
cp -R $dir $CACHE_DIR/
|
||||
done
|
||||
mkdir -p $(dirname $PROFILE_PATH)
|
||||
|
||||
set +e
|
||||
PYTHON_VERSION=$(cat runtime.txt)
|
||||
|
||||
# Install Python.
|
||||
if [ -f .heroku/python-version ]; then
|
||||
if [ ! $(cat .heroku/python-version) = $PYTHON_VERSION ]; then
|
||||
bpwatch start uninstall_python
|
||||
puts-step "Found $(cat .heroku/python-version), removing."
|
||||
rm -fr .heroku/python
|
||||
bpwatch stop uninstall_python
|
||||
else
|
||||
SKIP_INSTALL=1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! "$SKIP_INSTALL" ]; then
|
||||
bpwatch start install_python
|
||||
puts-step "Preparing Python runtime ($PYTHON_VERSION)"
|
||||
|
||||
# Prepare destination directory.
|
||||
mkdir -p .heroku/python
|
||||
|
||||
curl http://lang-python.s3.amazonaws.com/runtimes/$PYTHON_VERSION.tar.gz -s | tar zxv -C .heroku/python &> /dev/null
|
||||
if [[ $? != 0 ]] ; then
|
||||
puts-warn "Requested runtime ($PYTHON_VERSION) was not found."
|
||||
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bpwatch stop install_python
|
||||
|
||||
# Record for future reference.
|
||||
echo $PYTHON_VERSION > .heroku/python-version
|
||||
FRESH_PYTHON=true
|
||||
|
||||
hash -r
|
||||
else
|
||||
puts-step "Using Python runtime ($PYTHON_VERSION)"
|
||||
fi
|
||||
|
||||
# If Pip isn't up to date:
|
||||
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then
|
||||
WORKING_DIR=$(pwd)
|
||||
|
||||
bpwatch start prepare_environment
|
||||
|
||||
bpwatch start install_setuptools
|
||||
# Prepare it for the real world
|
||||
puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
|
||||
cd $ROOT_DIR/vendor/
|
||||
tar zxf setuptools-$SETUPTOOLS_VERSION.tar.gz
|
||||
cd $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION/
|
||||
python setup.py install &> /dev/null
|
||||
cd $WORKING_DIR
|
||||
bpwatch stop install_setuptoools
|
||||
|
||||
bpwatch start install_pip
|
||||
puts-step "Installing Pip ($PIP_VERSION)"
|
||||
|
||||
cd $ROOT_DIR/vendor/
|
||||
tar zxf pip-$PIP_VERSION.tar.gz
|
||||
cd $ROOT_DIR/vendor/pip-$PIP_VERSION/
|
||||
python setup.py install &> /dev/null
|
||||
cd $WORKING_DIR
|
||||
|
||||
bpwatch stop install_pip
|
||||
bpwatch stop prepare_environment
|
||||
fi
|
||||
|
||||
set -e
|
||||
hash -r
|
||||
|
||||
# Pylibmc support.
|
||||
# See [`bin/steps/pylibmc`](pylibmc.html).
|
||||
bpwatch start pylibmc_install
|
||||
source $BIN_DIR/steps/pylibmc
|
||||
bpwatch stop pylibmc_install
|
||||
|
||||
# Install Mercurial if it appears to be required.
|
||||
if (grep -Fiq "hg+" requirements.txt) then
|
||||
bpwatch start mercurial_install
|
||||
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
||||
bpwatch stop mercurial_install
|
||||
fi
|
||||
|
||||
# Install dependencies with Pip.
|
||||
puts-step "Installing dependencies using Pip ($PIP_VERSION)"
|
||||
|
||||
|
||||
[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
|
||||
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
|
||||
|
||||
/app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --allow-all-external | cleanup | indent
|
||||
|
||||
[ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install
|
||||
[ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first
|
||||
|
||||
# Django collectstatic support.
|
||||
bpwatch start collectstatic
|
||||
sub-env $BIN_DIR/steps/collectstatic
|
||||
bpwatch stop collectstatic
|
||||
|
||||
# ### Finalize
|
||||
#
|
||||
|
||||
# Set context environment variables.
|
||||
set-env PATH '$HOME/.heroku/python/bin:$PATH'
|
||||
set-env PYTHONUNBUFFERED true
|
||||
set-env PYTHONHOME /app/.heroku/python
|
||||
set-env LIBRARY_PATH /app/.heroku/vendor/lib:/app/.heroku/python/lib
|
||||
set-env LD_LIBRARY_PATH /app/.heroku/vendor/lib:/app/.heroku/python/lib
|
||||
set-default-env LANG en_US.UTF-8
|
||||
set-default-env PYTHONHASHSEED random
|
||||
set-default-env PYTHONPATH /app/
|
||||
|
||||
|
||||
# Experimental post_compile hook.
|
||||
bpwatch start post_compile
|
||||
source $BIN_DIR/steps/hooks/post_compile
|
||||
bpwatch stop post_compile
|
||||
|
||||
# Store new artifacts in cache.
|
||||
bpwatch start dump_cache
|
||||
for dir in $CACHED_DIRS; do
|
||||
rm -rf $CACHE_DIR/$dir
|
||||
cp -R $dir $CACHE_DIR/
|
||||
done
|
||||
bpwatch stop dump_cache
|
||||
|
||||
# ### Fin.
|
||||
bpwatch start appdir_commit
|
||||
deep-mv $BUILD_DIR $ORIG_BUILD_DIR
|
||||
bpwatch stop appdir_commit
|
||||
|
||||
bpwatch start anvil_appdir_commit
|
||||
if [ "$SLUG_ID" ]; then
|
||||
deep-mv $TMP_APP_DIR $APP_DIR
|
||||
fi
|
||||
|
||||
bpwatch stop anvil_appdir_commit
|
||||
bpwatch stop compile
|
||||
|
||||
+18
-4
@@ -1,8 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# bin/detect <build-dir>
|
||||
|
||||
# This script serves as the
|
||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
||||
# detector.
|
||||
#
|
||||
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
|
||||
# adapter between a Python application and Heroku's runtime.
|
||||
|
||||
# ## Usage
|
||||
# Compiling an app into a slug is simple:
|
||||
#
|
||||
# $ bin/detect <build-dir> <cache-dir>
|
||||
|
||||
BUILD_DIR=$1
|
||||
[ -f $BUILD_DIR/requirements.txt ] || exit 1 # fail fast if no requirements.txt
|
||||
|
||||
# 'Python/Django' if there is a [mysite]/settings.py file present; otherwise 'Python'
|
||||
ls $BUILD_DIR/**/settings.py &> /dev/null && echo Python/Django || echo Python
|
||||
# Exit early if app is clearly not Python.
|
||||
if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Python
|
||||
|
||||
+7
-14
@@ -3,28 +3,21 @@
|
||||
|
||||
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
|
||||
BUILD_DIR=$1
|
||||
NAME=$($BIN_DIR/detect $BUILD_DIR) || exit 1
|
||||
|
||||
MANAGE_FILE=$(cd $BUILD_DIR && find . -maxdepth 3 -type f -name 'manage.py' | head -1)
|
||||
MANAGE_FILE=${MANAGE_FILE:2}
|
||||
|
||||
cat <<EOF
|
||||
---
|
||||
config_vars:
|
||||
PATH: bin:/usr/local/bin:/usr/bin:/bin
|
||||
PYTHONUNBUFFERED: true
|
||||
LIBRARY_PATH: .heroku/vendor/lib
|
||||
LD_LIBRARY_PATH: .heroku/vendor/lib
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
[ "$NAME" = "Python/Django" ] || exit 0
|
||||
|
||||
SETTINGS_FILE=$(cd $BUILD_DIR && ls **/settings.py | head -1)
|
||||
PROJECT=$(dirname $SETTINGS_FILE)
|
||||
|
||||
if [[ $MANAGE_FILE ]]; then
|
||||
cat <<EOF
|
||||
|
||||
addons:
|
||||
shared-database:5mb
|
||||
|
||||
default_process_types:
|
||||
web: python $PROJECT/manage.py runserver 0.0.0.0:\$PORT --noreload
|
||||
heroku-postgresql:hobby-dev
|
||||
EOF
|
||||
fi
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source $BIN_DIR/utils
|
||||
|
||||
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
|
||||
MANAGE_FILE=${MANAGE_FILE:-fakepath}
|
||||
|
||||
[ -f .heroku/collectstatic_disabled ] && DISABLE_COLLECTSTATIC=1
|
||||
|
||||
if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ]; then
|
||||
set +e
|
||||
|
||||
echo "-----> Preparing static assets"
|
||||
# Check if collectstatic is configured properly.
|
||||
python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true
|
||||
|
||||
# Compile assets if collectstatic appears to be kosher.
|
||||
if [ "$RUN_COLLECTSTATIC" ]; then
|
||||
|
||||
echo " Running collectstatic..."
|
||||
python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
|
||||
|
||||
[ $? -ne 0 ] && {
|
||||
echo " ! Error running 'manage.py collectstatic'. More info:"
|
||||
echo " http://devcenter.heroku.com/articles/django-assets"
|
||||
}
|
||||
else
|
||||
echo " Collectstatic configuration error. To debug, run:"
|
||||
echo " $ heroku run python $MANAGE_FILE collectstatic --noinput"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
|
||||
fi
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f bin/post_compile ]; then
|
||||
echo "-----> Running post-compile hook"
|
||||
chmod +x bin/post_compile
|
||||
sub-env bin/post_compile
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f bin/pre_compile ]; then
|
||||
echo "-----> Running pre-compile hook"
|
||||
chmod +x bin/pre_compile
|
||||
sub-env bin/pre_compile
|
||||
fi
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script serves as the Pylibmc build step of the
|
||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
||||
# compiler.
|
||||
#
|
||||
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
|
||||
# adapter between a Python application and Heroku's runtime.
|
||||
#
|
||||
# This script is invoked by [`bin/compile`](/).
|
||||
|
||||
# The location of the pre-compiled libmemcached binary.
|
||||
VENDORED_MEMCACHED="http://cl.ly/0a191R3K160t1w1P0N25/vendor-libmemcached.tar.gz"
|
||||
|
||||
# Syntax sugar.
|
||||
source $BIN_DIR/utils
|
||||
|
||||
# If pylibmc exists within requirements, use vendored libmemcached.
|
||||
if (grep -Eiq "^\s*pylibmc" requirements.txt) then
|
||||
echo "-----> Noticed pylibmc. Bootstrapping libmemcached."
|
||||
cd .heroku
|
||||
|
||||
if [ -d "vendor/lib/sasl2" ]; then
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
else
|
||||
# Download and extract libmemcached into target vendor directory.
|
||||
curl -s -L -o tmp-libmemcached.tar.gz $VENDORED_MEMCACHED
|
||||
tar -zxvf tmp-libmemcached.tar.gz > /dev/null
|
||||
rm tmp-libmemcached.tar.gz
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
fi
|
||||
|
||||
export LIBMEMCACHED=$(pwd)/vendor
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Create a Heroku app with the following buildpack:
|
||||
# https://github.com/ddollar/buildpack-test
|
||||
#
|
||||
# Push this Python buildpack to that Heroku app to
|
||||
# run the tests.
|
||||
#
|
||||
|
||||
testDetectWithReqs() {
|
||||
detect "simple-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithEmptyReqs() {
|
||||
detect "empty-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango16() {
|
||||
detect "django-1.6-skeleton"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango15() {
|
||||
detect "django-1.5-skeleton"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango14() {
|
||||
detect "django-1.4-skeleton"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango13() {
|
||||
detect "django-1.3-skeleton"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectNotDjangoWithSettings() {
|
||||
detect "not-django"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithSetupPy() {
|
||||
detect "distutils"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithSetupRequires() {
|
||||
detect "no-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectNotPython() {
|
||||
detect "not-python"
|
||||
assertNotCaptured "Python"
|
||||
assertEquals "1" "${RETURN}"
|
||||
}
|
||||
|
||||
testDetectSimpleRuntimePypy2() {
|
||||
detect "simple-runtime-pypy2"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectSimpleRuntimePython2() {
|
||||
detect "simple-runtime-python2"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectSimpleRuntimePython3() {
|
||||
detect "simple-runtime" # should probably be renamed simple-runtime-python3
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
## utils ########################################
|
||||
|
||||
pushd $(dirname 0) >/dev/null
|
||||
BASE=$(pwd)
|
||||
popd >/dev/null
|
||||
|
||||
source ${BASE}/vendor/test-utils
|
||||
|
||||
detect() {
|
||||
capture ${BASE}/bin/detect ${BASE}/test/$1
|
||||
}
|
||||
|
||||
compile() {
|
||||
capture ${BASE}/bin/compile ${BASE}/test/$1
|
||||
}
|
||||
|
||||
source ${BASE}/vendor/shunit2
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
shopt -s extglob
|
||||
|
||||
if [ $(uname) == Darwin ]; then
|
||||
sed() { command sed -l "$@"; }
|
||||
else
|
||||
sed() { command sed -u "$@"; }
|
||||
fi
|
||||
|
||||
# Syntax sugar.
|
||||
indent() {
|
||||
sed "s/^/ /"
|
||||
}
|
||||
|
||||
# Clean up pip output
|
||||
cleanup() {
|
||||
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
|
||||
}
|
||||
|
||||
# Buildpack Steps.
|
||||
puts-step() {
|
||||
echo "-----> $@"
|
||||
}
|
||||
|
||||
# Buildpack Warnings.
|
||||
puts-warn() {
|
||||
echo " ! $@"
|
||||
}
|
||||
|
||||
# Usage: $ set-env key value
|
||||
set-env() {
|
||||
echo "export $1=$2" >> $PROFILE_PATH
|
||||
}
|
||||
|
||||
# Usage: $ set-default-env key value
|
||||
set-default-env() {
|
||||
echo "export $1=\${$1:-$2}" >> $PROFILE_PATH
|
||||
}
|
||||
|
||||
# Usage: $ set-default-env key value
|
||||
un-set-env() {
|
||||
echo "unset $1" >> $PROFILE_PATH
|
||||
}
|
||||
|
||||
# Does some serious copying.
|
||||
deep-cp() {
|
||||
declare source="$1" target="$2"
|
||||
|
||||
mkdir -p "$target"
|
||||
|
||||
# cp doesn't like being called without source params,
|
||||
# so make sure they expand to something first.
|
||||
# subshell to avoid surprising caller with shopts.
|
||||
(
|
||||
shopt -s nullglob dotglob
|
||||
set -- "$source"/!(tmp|.|..)
|
||||
[[ $# == 0 ]] || cp -a "$@" "$target"
|
||||
)
|
||||
}
|
||||
|
||||
# Does some serious moving.
|
||||
deep-mv() {
|
||||
deep-cp "$1" "$2"
|
||||
deep-rm "$1"
|
||||
}
|
||||
|
||||
# Does some serious deleting.
|
||||
deep-rm() {
|
||||
# subshell to avoid surprising caller with shopts.
|
||||
(
|
||||
shopt -s dotglob
|
||||
rm -rf "$1"/!(tmp|.|..)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
sub-env() {
|
||||
|
||||
WHITELIST=${2:-''}
|
||||
BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'}
|
||||
|
||||
(
|
||||
if [ -d "$ENV_DIR" ]; then
|
||||
for e in $(ls $ENV_DIR); do
|
||||
echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" &&
|
||||
export "$e=$(cat $ENV_DIR/$e)"
|
||||
:
|
||||
done
|
||||
fi
|
||||
|
||||
$1
|
||||
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# Python Buildpack Binaries
|
||||
|
||||
|
||||
To get started with it, create an app on Heroku inside a clone of this repository, and set your S3 config vars:
|
||||
|
||||
$ heroku create --buildpack https://github.com/heroku/heroku-buildpack-python#not-heroku
|
||||
$ heroku config:set WORKSPACE_DIR=builds
|
||||
$ heroku config:set AWS_ACCESS_KEY_ID=<your_aws_key>
|
||||
$ heroku config:set AWS_SECRET_ACCESS_KEY=<your_aws_secret>
|
||||
$ heroku config:set S3_BUCKET=<your_s3_bucket_name>
|
||||
|
||||
|
||||
Then, shell into an instance and run a build by giving the name of the formula inside `builds`:
|
||||
|
||||
$ heroku run bash
|
||||
Running `bash` attached to terminal... up, run.6880
|
||||
~ $ bob build runtimes/python-2.7.6
|
||||
|
||||
Fetching dependencies... found 2:
|
||||
- libraries/sqlite
|
||||
|
||||
Building formula runtimes/python-2.7.6:
|
||||
=== Building Python 2.7.6
|
||||
Fetching Python v2.7.6 source...
|
||||
Compiling...
|
||||
|
||||
If this works, run `bob deploy` instead of `bob build` to have the result uploaded to S3 for you.
|
||||
|
||||
To speed things up drastically, it'll usually be a good idea to `heroku run bash --size PX` instead.
|
||||
|
||||
Enjoy :)
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building SQLite..."
|
||||
|
||||
|
||||
SOURCE_TARBALL='http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz'
|
||||
|
||||
curl $SOURCE_TARBALL | tar xz
|
||||
# jx
|
||||
mv sqlite-autoconf-3070900 sqlite
|
||||
|
||||
cd sqlite
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
|
||||
# Cleanup
|
||||
cd ..
|
||||
rm -fr sqlite
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bitbucket.org/pypy/pypy/downloads/pypy-1.7-linux64.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy-1.7/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy-1.8/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building PyPy..."
|
||||
SOURCE_TARBALL='https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
cp -R pypy-1.9/* $OUT_PREFIX
|
||||
|
||||
ln $OUT_PREFIX/bin/pypy $OUT_PREFIX/bin/python
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.4 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.4.4/Python-2.4.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.4.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.4 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.4.5/Python-2.4.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.4.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.4 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.4.6/Python-2.4.6.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.4.6 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5/Python-2.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.1/Python-2.5.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.2/Python-2.5.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.3/Python-2.5.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.4/Python-2.5.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.5/Python-2.5.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.5 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.5.6/Python-2.5.6.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.5.6 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://www.python.org/ftp/python/2.6/Python-2.6.tar.bz2'
|
||||
curl -L $SOURCE_TARBALL | tar jx
|
||||
mv Python-2.6 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.1/Python-2.6.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.2/Python-2.6.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.3/Python-2.6.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.4/Python-2.6.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.5/Python-2.6.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.6/Python-2.6.6.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.6 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.7/Python-2.6.7.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.7 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.8/Python-2.6.8.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.8 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
# Protect 2.6 builds from parent Python (causes segfault during build).
|
||||
unset LANG PYTHONHOME PYTHONPATH
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.6.9/Python-2.6.9.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.6.9 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7/Python-2.7.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.1/Python-2.7.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.4/Python-2.7.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.6 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/2.7.7/Python-2.7.7.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-2.7.7 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1/Python-3.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1.1/Python-3.1.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1.2/Python-3.1.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1.3/Python-3.1.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1.4/Python-3.1.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.1.5/Python-3.1.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.1.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2/Python-3.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2.1/Python-3.2.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2.2/Python-3.2.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2.3/Python-3.2.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2.4/Python-3.2.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.2.5/Python-3.2.5.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.2.5 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.3.0 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.3.1/Python-3.3.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.3.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.3.2/Python-3.3.2.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.3.2 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.3.3/Python-3.3.3.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.3.3 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.3.4/Python-3.3.4.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.3.4 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.4.0/Python-3.4.0.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.4.0 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --with-ensurepip=no --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Path: /app/.heroku/python/
|
||||
# Build Deps: libraries/sqlite
|
||||
|
||||
OUT_PREFIX=$1
|
||||
|
||||
echo "Building Python..."
|
||||
SOURCE_TARBALL='http://python.org/ftp/python/3.4.1/Python-3.4.1.tgz'
|
||||
curl -L $SOURCE_TARBALL | tar xz
|
||||
mv Python-3.4.1 src
|
||||
cd src
|
||||
|
||||
./configure --prefix=$OUT_PREFIX --with-ensurepip=no --enable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bob-builder==0.0.5
|
||||
@@ -1,29 +0,0 @@
|
||||
Author
|
||||
------
|
||||
|
||||
Ian Bicking
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
Brian Rosner
|
||||
Carl Meyer
|
||||
Jannis Leidel
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
Antonio Cuni
|
||||
Armin Ronacher
|
||||
Christopher Nilsson
|
||||
Curt Micol
|
||||
Douglas Creager
|
||||
Jeff Hammel
|
||||
Jorge Vargas
|
||||
Josh Bronson
|
||||
Kumar McMillan
|
||||
Lars Francke
|
||||
Philip Jenvey
|
||||
Ronny Pfannschmidt
|
||||
Tarek Ziadé
|
||||
Vinay Sajip
|
||||
@@ -1,22 +0,0 @@
|
||||
Copyright (c) 2007 Ian Bicking and Contributors
|
||||
Copyright (c) 2009 Ian Bicking, The Open Planning Project
|
||||
Copyright (c) 2011 The virtualenv developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,9 +0,0 @@
|
||||
recursive-include docs *.txt
|
||||
recursive-include scripts *
|
||||
recursive-include virtualenv_support *.egg *.tar.gz
|
||||
recursive-exclude virtualenv_support *.py
|
||||
recursive-exclude docs/_templates *.*
|
||||
include virtualenv_support/__init__.py
|
||||
include *.py
|
||||
include AUTHORS.txt
|
||||
include LICENSE.txt
|
||||
@@ -1,827 +0,0 @@
|
||||
Metadata-Version: 1.0
|
||||
Name: virtualenv
|
||||
Version: 1.6.4
|
||||
Summary: Virtual Python Environment builder
|
||||
Home-page: http://www.virtualenv.org
|
||||
Author: Jannis Leidel, Carl Meyer and Brian Rosner
|
||||
Author-email: python-virtualenv@groups.google.com
|
||||
License: MIT
|
||||
Description:
|
||||
|
||||
Status and License
|
||||
------------------
|
||||
|
||||
``virtualenv`` is a successor to `workingenv
|
||||
<http://cheeseshop.python.org/pypi/workingenv.py>`_, and an extension
|
||||
of `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_.
|
||||
|
||||
It was written by Ian Bicking, sponsored by the `Open Planning
|
||||
Project <http://openplans.org>`_ and is now maintained by a
|
||||
`group of developers <https://github.com/pypa/virtualenv/raw/master/AUTHORS.txt>`_.
|
||||
It is licensed under an
|
||||
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
|
||||
|
||||
You can install it with ``easy_install virtualenv``, or the `latest
|
||||
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
|
||||
with ``easy_install virtualenv==dev``.
|
||||
|
||||
What It Does
|
||||
------------
|
||||
|
||||
``virtualenv`` is a tool to create isolated Python environments.
|
||||
|
||||
The basic problem being addressed is one of dependencies and versions,
|
||||
and indirectly permissions. Imagine you have an application that
|
||||
needs version 1 of LibFoo, but another application requires version
|
||||
2. How can you use both these applications? If you install
|
||||
everything into ``/usr/lib/python2.7/site-packages`` (or whatever your
|
||||
platform's standard location is), it's easy to end up in a situation
|
||||
where you unintentionally upgrade an application that shouldn't be
|
||||
upgraded.
|
||||
|
||||
Or more generally, what if you want to install an application *and
|
||||
leave it be*? If an application works, any change in its libraries or
|
||||
the versions of those libraries can break the application.
|
||||
|
||||
Also, what if you can't install packages into the global
|
||||
``site-packages`` directory? For instance, on a shared host.
|
||||
|
||||
In all these cases, ``virtualenv`` can help you. It creates an
|
||||
environment that has its own installation directories, that doesn't
|
||||
share libraries with other virtualenv environments (and optionally
|
||||
doesn't access the globally installed libraries either).
|
||||
|
||||
The basic usage is::
|
||||
|
||||
$ python virtualenv.py ENV
|
||||
|
||||
If you install it you can also just do ``virtualenv ENV``.
|
||||
|
||||
This creates ``ENV/lib/pythonX.X/site-packages``, where any libraries you
|
||||
install will go. It also creates ``ENV/bin/python``, which is a Python
|
||||
interpreter that uses this environment. Anytime you use that interpreter
|
||||
(including when a script has ``#!/path/to/ENV/bin/python`` in it) the libraries
|
||||
in that environment will be used.
|
||||
|
||||
It also installs either `Setuptools
|
||||
<http://peak.telecommunity.com/DevCenter/setuptools>`_ or `distribute
|
||||
<http://pypi.python.org/pypi/distribute>`_ into the environment. To use
|
||||
Distribute instead of setuptools, just call virtualenv like this::
|
||||
|
||||
$ python virtualenv.py --distribute ENV
|
||||
|
||||
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
|
||||
|
||||
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
|
||||
installer, so you can use `ENV/bin/pip`` to install additional packages into
|
||||
the environment.
|
||||
|
||||
Windows Notes
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Some paths within the virtualenv are slightly different on Windows: scripts and
|
||||
executables on Windows go in ``ENV\Scripts\`` instead of ``ENV/bin/`` and
|
||||
libraries go in ``ENV\Lib\`` rather than ``ENV/lib/``.
|
||||
|
||||
To create a virtualenv under a path with spaces in it on Windows, you'll need
|
||||
the `win32api <http://sourceforge.net/projects/pywin32/>`_ library installed.
|
||||
|
||||
PyPy Support
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Beginning with virtualenv version 1.5 `PyPy <http://pypy.org>`_ is
|
||||
supported. To use PyPy 1.4 or 1.4.1, you need a version of virtualenv >= 1.5.
|
||||
To use PyPy 1.5, you need a version of virtualenv >= 1.6.1.
|
||||
|
||||
Creating Your Own Bootstrap Scripts
|
||||
-----------------------------------
|
||||
|
||||
While this creates an environment, it doesn't put anything into the
|
||||
environment. Developers may find it useful to distribute a script
|
||||
that sets up a particular environment, for example a script that
|
||||
installs a particular web application.
|
||||
|
||||
To create a script like this, call
|
||||
``virtualenv.create_bootstrap_script(extra_text)``, and write the
|
||||
result to your new bootstrapping script. Here's the documentation
|
||||
from the docstring:
|
||||
|
||||
Creates a bootstrap script, which is like this script but with
|
||||
extend_parser, adjust_options, and after_install hooks.
|
||||
|
||||
This returns a string that (written to disk of course) can be used
|
||||
as a bootstrap script with your own customizations. The script
|
||||
will be the standard virtualenv.py script, with your extra text
|
||||
added (your extra text should be Python code).
|
||||
|
||||
If you include these functions, they will be called:
|
||||
|
||||
``extend_parser(optparse_parser)``:
|
||||
You can add or remove options from the parser here.
|
||||
|
||||
``adjust_options(options, args)``:
|
||||
You can change options here, or change the args (if you accept
|
||||
different kinds of arguments, be sure you modify ``args`` so it is
|
||||
only ``[DEST_DIR]``).
|
||||
|
||||
``after_install(options, home_dir)``:
|
||||
|
||||
After everything is installed, this function is called. This
|
||||
is probably the function you are most likely to use. An
|
||||
example would be::
|
||||
|
||||
def after_install(options, home_dir):
|
||||
if sys.platform == 'win32':
|
||||
bin = 'Scripts'
|
||||
else:
|
||||
bin = 'bin'
|
||||
subprocess.call([join(home_dir, bin, 'easy_install'),
|
||||
'MyPackage'])
|
||||
subprocess.call([join(home_dir, bin, 'my-package-script'),
|
||||
'setup', home_dir])
|
||||
|
||||
This example immediately installs a package, and runs a setup
|
||||
script from that package.
|
||||
|
||||
Bootstrap Example
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Here's a more concrete example of how you could use this::
|
||||
|
||||
import virtualenv, textwrap
|
||||
output = virtualenv.create_bootstrap_script(textwrap.dedent("""
|
||||
import os, subprocess
|
||||
def after_install(options, home_dir):
|
||||
etc = join(home_dir, 'etc')
|
||||
if not os.path.exists(etc):
|
||||
os.makedirs(etc)
|
||||
subprocess.call([join(home_dir, 'bin', 'easy_install'),
|
||||
'BlogApplication'])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'make-config', 'BlogApplication',
|
||||
join(etc, 'blog.ini')])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'setup-app', join(etc, 'blog.ini')])
|
||||
"""))
|
||||
f = open('blog-bootstrap.py', 'w').write(output)
|
||||
|
||||
Another example is available `here
|
||||
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_.
|
||||
|
||||
activate script
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
In a newly created virtualenv there will be a ``bin/activate`` shell
|
||||
script, or a ``Scripts/activate.bat`` batch file on Windows.
|
||||
|
||||
On Posix systems you can do::
|
||||
|
||||
$ source bin/activate
|
||||
|
||||
This will change your ``$PATH`` to point to the virtualenv's ``bin/``
|
||||
directory. (You have to use ``source`` because it changes your shell
|
||||
environment in-place.) This is all it does; it's purely a convenience. If
|
||||
you directly run a script or the python interpreter from the virtualenv's
|
||||
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
|
||||
``/path/to/env/bin/python script.py``) there's no need for activation.
|
||||
|
||||
After activating an environment you can use the function ``deactivate`` to
|
||||
undo the changes to your ``$PATH``.
|
||||
|
||||
The ``activate`` script will also modify your shell prompt to indicate
|
||||
which environment is currently active. You can disable this behavior,
|
||||
which can be useful if you have your own custom prompt that already
|
||||
displays the active environment name. To do so, set the
|
||||
``VIRTUAL_ENV_DISABLE_PROMPT`` environment variable to any non-empty
|
||||
value before running the ``activate`` script.
|
||||
|
||||
On Windows you just do::
|
||||
|
||||
> \path\to\env\Scripts\activate.bat
|
||||
|
||||
And use ``deactivate.bat`` to undo the changes.
|
||||
|
||||
The ``--no-site-packages`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you build with ``virtualenv --no-site-packages ENV`` it will *not*
|
||||
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or
|
||||
wherever your global site-packages directory is). This can be used if
|
||||
you don't have control over site-packages and don't want to depend on
|
||||
the packages there, or you just want more isolation from the global
|
||||
system.
|
||||
|
||||
Using Virtualenv without ``bin/python``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sometimes you can't or don't want to use the Python interpreter
|
||||
created by the virtualenv. For instance, in a `mod_python
|
||||
<http://www.modpython.org/>`_ or `mod_wsgi <http://www.modwsgi.org/>`_
|
||||
environment, there is only one interpreter.
|
||||
|
||||
Luckily, it's easy. You must use the custom Python interpreter to
|
||||
*install* libraries. But to *use* libraries, you just have to be sure
|
||||
the path is correct. A script is available to correct the path. You
|
||||
can setup the environment like::
|
||||
|
||||
activate_this = '/path/to/env/bin/activate_this.py'
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
This will change ``sys.path`` and even change ``sys.prefix``, but also allow
|
||||
you to use an existing interpreter. Items in your environment will show up
|
||||
first on ``sys.path``, before global items. However, global items will
|
||||
always be accessible -- this technique does not support the
|
||||
``--no-site-packages`` flag. Also, this cannot undo the activation of other
|
||||
environments, or modules that have been imported. You shouldn't try to, for
|
||||
instance, activate an environment before a web request; you should activate
|
||||
*one* environment as early as possible, and not do it again in that process.
|
||||
|
||||
Making Environments Relocatable
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Note: this option is somewhat experimental, and there are probably
|
||||
caveats that have not yet been identified. Also this does not
|
||||
currently work on Windows.
|
||||
|
||||
Normally environments are tied to a specific path. That means that
|
||||
you cannot move an environment around or copy it to another computer.
|
||||
You can fix up an environment to make it relocatable with the
|
||||
command::
|
||||
|
||||
$ virtualenv --relocatable ENV
|
||||
|
||||
This will make some of the files created by setuptools or distribute
|
||||
use relative paths, and will change all the scripts to use ``activate_this.py``
|
||||
instead of using the location of the Python interpreter to select the
|
||||
environment.
|
||||
|
||||
**Note:** you must run this after you've installed *any* packages into
|
||||
the environment. If you make an environment relocatable, then
|
||||
install a new package, you must run ``virtualenv --relocatable``
|
||||
again.
|
||||
|
||||
Also, this **does not make your packages cross-platform**. You can
|
||||
move the directory around, but it can only be used on other similar
|
||||
computers. Some known environmental differences that can cause
|
||||
incompatibilities: a different version of Python, when one platform
|
||||
uses UCS2 for its internal unicode representation and another uses
|
||||
UCS4 (a compile-time option), obvious platform changes like Windows
|
||||
vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C
|
||||
libraries on the system, if those C libraries are located somewhere
|
||||
different (either different versions, or a different filesystem
|
||||
layout).
|
||||
|
||||
Currently the ``--no-site-packages`` option will not be honored if you
|
||||
use this on an environment.
|
||||
|
||||
The ``--extra-search-dir`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When it creates a new environment, virtualenv installs either
|
||||
setuptools or distribute, and pip. In normal operation, the latest
|
||||
releases of these packages are fetched from the `Python Package Index
|
||||
<http://pypi.python.org>`_ (PyPI). In some circumstances, this
|
||||
behavior may not be wanted, for example if you are using virtualenv
|
||||
during a deployment and do not want to depend on Internet access and
|
||||
PyPI availability.
|
||||
|
||||
As an alternative, you can provide your own versions of setuptools,
|
||||
distribute and/or pip on the filesystem, and tell virtualenv to use
|
||||
those distributions instead of downloading them from the Internet. To
|
||||
use this feature, pass one or more ``--extra-search-dir`` options to
|
||||
virtualenv like this::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions ENV
|
||||
|
||||
The ``/path/to/distributions`` path should point to a directory that
|
||||
contains setuptools, distribute and/or pip distributions. Setuptools
|
||||
distributions must be ``.egg`` files; distribute and pip distributions
|
||||
should be `.tar.gz` source distributions.
|
||||
|
||||
Virtualenv will still download these packages if no satisfactory local
|
||||
distributions are found.
|
||||
|
||||
If you are really concerned about virtualenv fetching these packages
|
||||
from the Internet and want to ensure that it never will, you can also
|
||||
provide an option ``--never-download`` like so::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions --never-download ENV
|
||||
|
||||
If this option is provided, virtualenv will never try to download
|
||||
setuptools/distribute or pip. Instead, it will exit with status code 1
|
||||
if it fails to find local distributions for any of these required
|
||||
packages.
|
||||
|
||||
Compare & Contrast with Alternatives
|
||||
------------------------------------
|
||||
|
||||
There are several alternatives that create isolated environments:
|
||||
|
||||
* ``workingenv`` (which I do not suggest you use anymore) is the
|
||||
predecessor to this library. It used the main Python interpreter,
|
||||
but relied on setting ``$PYTHONPATH`` to activate the environment.
|
||||
This causes problems when running Python scripts that aren't part of
|
||||
the environment (e.g., a globally installed ``hg`` or ``bzr``). It
|
||||
also conflicted a lot with Setuptools.
|
||||
|
||||
* `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_
|
||||
is also a predecessor to this library. It uses only symlinks, so it
|
||||
couldn't work on Windows. It also symlinks over the *entire*
|
||||
standard library and global ``site-packages``. As a result, it
|
||||
won't see new additions to the global ``site-packages``.
|
||||
|
||||
This script only symlinks a small portion of the standard library
|
||||
into the environment, and so on Windows it is feasible to simply
|
||||
copy these files over. Also, it creates a new/empty
|
||||
``site-packages`` and also adds the global ``site-packages`` to the
|
||||
path, so updates are tracked separately. This script also installs
|
||||
Setuptools automatically, saving a step and avoiding the need for
|
||||
network access.
|
||||
|
||||
* `zc.buildout <http://pypi.python.org/pypi/zc.buildout>`_ doesn't
|
||||
create an isolated Python environment in the same style, but
|
||||
achieves similar results through a declarative config file that sets
|
||||
up scripts with very particular packages. As a declarative system,
|
||||
it is somewhat easier to repeat and manage, but more difficult to
|
||||
experiment with. ``zc.buildout`` includes the ability to setup
|
||||
non-Python systems (e.g., a database server or an Apache instance).
|
||||
|
||||
I *strongly* recommend anyone doing application development or
|
||||
deployment use one of these tools.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Refer to the `contributing to pip`_ documentation - it applies equally to
|
||||
virtualenv.
|
||||
|
||||
Virtualenv's release schedule is tied to pip's -- each time there's a new pip
|
||||
release, there will be a new virtualenv release that bundles the new version of
|
||||
pip.
|
||||
|
||||
.. _contributing to pip: http://www.pip-installer.org/en/latest/how-to-contribute.html
|
||||
|
||||
Running the tests
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Virtualenv's test suite is small and not yet at all comprehensive, but we aim
|
||||
to grow it.
|
||||
|
||||
The easy way to run tests (handles test dependencies automatically)::
|
||||
|
||||
$ python setup.py test
|
||||
|
||||
If you want to run only a selection of the tests, you'll need to run them
|
||||
directly with nose instead. Create a virtualenv, and install required
|
||||
packages::
|
||||
|
||||
$ pip install nose mock
|
||||
|
||||
Run nosetests::
|
||||
|
||||
$ nosetests
|
||||
|
||||
Or select just a single test file to run::
|
||||
|
||||
$ nosetests tests.test_virtualenv
|
||||
|
||||
|
||||
Other Documentation and Links
|
||||
-----------------------------
|
||||
|
||||
* James Gardner has written a tutorial on using `virtualenv with
|
||||
Pylons
|
||||
<http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox>`_.
|
||||
|
||||
* `Blog announcement
|
||||
<http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/>`_.
|
||||
|
||||
* Doug Hellmann wrote a description of his `command-line work flow
|
||||
using virtualenv (virtualenvwrapper)
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_
|
||||
including some handy scripts to make working with multiple
|
||||
environments easier. He also wrote `an example of using virtualenv
|
||||
to try IPython
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html>`_.
|
||||
|
||||
* Chris Perkins created a `showmedo video including virtualenv
|
||||
<http://showmedo.com/videos/video?name=2910000&fromSeriesID=291>`_.
|
||||
|
||||
* `Using virtualenv with mod_wsgi
|
||||
<http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
|
||||
* `virtualenv commands
|
||||
<http://thisismedium.com/tech/extending-virtualenv/>`_ for some more
|
||||
workflow-related tools around virtualenv.
|
||||
|
||||
Changes & News
|
||||
--------------
|
||||
|
||||
Next release (1.7) schedule
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Beta release mid-July 2011, final release early August.
|
||||
|
||||
1.6.4 (2011-07-21)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python 2.4, too.
|
||||
|
||||
1.6.3 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python < 2.7.
|
||||
|
||||
1.6.2 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Updated embedded distribute release to 0.6.19.
|
||||
|
||||
* Updated embedded pip release to 1.0.2.
|
||||
|
||||
* Fixed #141 - Be smarter about finding pkg_resources when using the
|
||||
non-default Python intepreter (by using the ``-p`` option).
|
||||
|
||||
* Fixed #112 - Fixed path in docs.
|
||||
|
||||
* Fixed #109 - Corrected doctests of a Logger method.
|
||||
|
||||
* Fixed #118 - Fixed creating virtualenvs on platforms that use the
|
||||
"posix_local" install scheme, such as Ubuntu with Python 2.7.
|
||||
|
||||
* Add missing library to Python 3 virtualenvs (``_dummy_thread``).
|
||||
|
||||
|
||||
1.6.1 (2011-04-30)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Start to use git-flow.
|
||||
|
||||
* Added support for PyPy 1.5
|
||||
|
||||
* Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
|
||||
|
||||
* Added progress meter for pip installation as well as setuptools. Thanks Ethan
|
||||
Jucovy.
|
||||
|
||||
* Added --never-download and --search-dir options. Thanks Ethan Jucovy.
|
||||
|
||||
1.6
|
||||
~~~
|
||||
|
||||
* Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
|
||||
|
||||
* Fixed creation of virtualenvs on Mac OS X when standard library modules
|
||||
(readline) are installed outside the standard library.
|
||||
|
||||
* Updated bundled pip to 1.0.
|
||||
|
||||
1.5.2
|
||||
~~~~~
|
||||
|
||||
* Moved main repository to Github: https://github.com/pypa/virtualenv
|
||||
|
||||
* Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer and Brian Rosner
|
||||
|
||||
* Fixed a few more pypy related bugs.
|
||||
|
||||
* Updated bundled pip to 0.8.2.
|
||||
|
||||
* Handed project over to new team of maintainers.
|
||||
|
||||
* Moved virtualenv to Github at https://github.com/pypa/virtualenv
|
||||
|
||||
1.5.1
|
||||
~~~~~
|
||||
|
||||
* Added ``_weakrefset`` requirement for Python 2.7.1.
|
||||
|
||||
* Fixed Windows regression in 1.5
|
||||
|
||||
1.5
|
||||
~~~
|
||||
|
||||
* Include pip 0.8.1.
|
||||
|
||||
* Add support for PyPy.
|
||||
|
||||
* Uses a proper temporary dir when installing environment requirements.
|
||||
|
||||
* Add ``--prompt`` option to be able to override the default prompt prefix.
|
||||
|
||||
* Fix an issue with ``--relocatable`` on Windows.
|
||||
|
||||
* Fix issue with installing the wrong version of distribute.
|
||||
|
||||
* Add fish and csh activate scripts.
|
||||
|
||||
1.4.9
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7.2
|
||||
|
||||
1.4.8
|
||||
~~~~~
|
||||
|
||||
* Fix for Mac OS X Framework builds that use
|
||||
``--universal-archs=intel``
|
||||
|
||||
* Fix ``activate_this.py`` on Windows.
|
||||
|
||||
* Allow ``$PYTHONHOME`` to be set, so long as you use ``source
|
||||
bin/activate`` it will get unset; if you leave it set and do not
|
||||
activate the environment it will still break the environment.
|
||||
|
||||
* Include pip 0.7.1
|
||||
|
||||
1.4.7
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7
|
||||
|
||||
1.4.6
|
||||
~~~~~
|
||||
|
||||
* Allow ``activate.sh`` to skip updating the prompt (by setting
|
||||
``$VIRTUAL_ENV_DISABLE_PROMPT``).
|
||||
|
||||
1.4.5
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.3
|
||||
|
||||
* Fix ``activate.bat`` and ``deactivate.bat`` under Windows when
|
||||
``PATH`` contained a parenthesis
|
||||
|
||||
1.4.4
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.2 and Distribute 0.6.10
|
||||
|
||||
* Create the ``virtualenv`` script even when Setuptools isn't
|
||||
installed
|
||||
|
||||
* Fix problem with ``virtualenv --relocate`` when ``bin/`` has
|
||||
subdirectories (e.g., ``bin/.svn/``); from Alan Franzoni.
|
||||
|
||||
* If you set ``$VIRTUALENV_USE_DISTRIBUTE`` then virtualenv will use
|
||||
Distribute by default (so you don't have to remember to use
|
||||
``--distribute``).
|
||||
|
||||
1.4.3
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.1
|
||||
|
||||
1.4.2
|
||||
~~~~~
|
||||
|
||||
* Fix pip installation on Windows
|
||||
|
||||
* Fix use of stand-alone ``virtualenv.py`` (and boot scripts)
|
||||
|
||||
* Exclude ~/.local (user site-packages) from environments when using
|
||||
``--no-site-packages``
|
||||
|
||||
1.4.1
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6
|
||||
|
||||
1.4
|
||||
~~~
|
||||
|
||||
* Updated setuptools to 0.6c11
|
||||
|
||||
* Added the --distribute option
|
||||
|
||||
* Fixed packaging problem of support-files
|
||||
|
||||
1.3.4
|
||||
~~~~~
|
||||
|
||||
* Virtualenv now copies the actual embedded Python binary on
|
||||
Mac OS X to fix a hang on Snow Leopard (10.6).
|
||||
|
||||
* Fail more gracefully on Windows when ``win32api`` is not installed.
|
||||
|
||||
* Fix site-packages taking precedent over Jython's ``__classpath__``
|
||||
and also specially handle the new ``__pyclasspath__`` entry in
|
||||
``sys.path``.
|
||||
|
||||
* Now copies Jython's ``registry`` file to the virtualenv if it exists.
|
||||
|
||||
* Better find libraries when compiling extensions on Windows.
|
||||
|
||||
* Create ``Scripts\pythonw.exe`` on Windows.
|
||||
|
||||
* Added support for the Debian/Ubuntu
|
||||
``/usr/lib/pythonX.Y/dist-packages`` directory.
|
||||
|
||||
* Set ``distutils.sysconfig.get_config_vars()['LIBDIR']`` (based on
|
||||
``sys.real_prefix``) which is reported to help building on Windows.
|
||||
|
||||
* Make ``deactivate`` work on ksh
|
||||
|
||||
* Fixes for ``--python``: make it work with ``--relocatable`` and the
|
||||
symlink created to the exact Python version.
|
||||
|
||||
1.3.3
|
||||
~~~~~
|
||||
|
||||
* Use Windows newlines in ``activate.bat``, which has been reported to help
|
||||
when using non-ASCII directory names.
|
||||
|
||||
* Fixed compatibility with Jython 2.5b1.
|
||||
|
||||
* Added a function ``virtualenv.install_python`` for more fine-grained
|
||||
access to what ``virtualenv.create_environment`` does.
|
||||
|
||||
* Fix `a problem <https://bugs.launchpad.net/virtualenv/+bug/241581>`_
|
||||
with Windows and paths that contain spaces.
|
||||
|
||||
* If ``/path/to/env/.pydistutils.cfg`` exists (or
|
||||
``/path/to/env/pydistutils.cfg`` on Windows systems) then ignore
|
||||
``~/.pydistutils.cfg`` and use that other file instead.
|
||||
|
||||
* Fix ` a problem
|
||||
<https://bugs.launchpad.net/virtualenv/+bug/340050>`_ picking up
|
||||
some ``.so`` libraries in ``/usr/local``.
|
||||
|
||||
1.3.2
|
||||
~~~~~
|
||||
|
||||
* Remove the ``[install] prefix = ...`` setting from the virtualenv
|
||||
``distutils.cfg`` -- this has been causing problems for a lot of
|
||||
people, in rather obscure ways.
|
||||
|
||||
* If you use a `boot script <./index.html#boot-script>`_ it will attempt to import ``virtualenv``
|
||||
and find a pre-downloaded Setuptools egg using that.
|
||||
|
||||
* Added platform-specific paths, like ``/usr/lib/pythonX.Y/plat-linux2``
|
||||
|
||||
1.3.1
|
||||
~~~~~
|
||||
|
||||
* Real Python 2.6 compatibility. Backported the Python 2.6 updates to
|
||||
``site.py``, including `user directories
|
||||
<http://docs.python.org/dev/whatsnew/2.6.html#pep-370-per-user-site-packages-directory>`_
|
||||
(this means older versions of Python will support user directories,
|
||||
whether intended or not).
|
||||
|
||||
* Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
|
||||
on some platforms where a system-wide ``distutils.cfg`` was present
|
||||
with a ``prefix`` setting, packages would be installed globally
|
||||
(usually in ``/usr/local/lib/pythonX.Y/site-packages``).
|
||||
|
||||
* Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
|
||||
workaround is added.
|
||||
|
||||
* Fix ``--python`` option.
|
||||
|
||||
* Fixed handling of Jython environments that use a
|
||||
jython-complete.jar.
|
||||
|
||||
1.3
|
||||
~~~
|
||||
|
||||
* Update to Setuptools 0.6c9
|
||||
* Added an option ``virtualenv --relocatable EXISTING_ENV``, which
|
||||
will make an existing environment "relocatable" -- the paths will
|
||||
not be absolute in scripts, ``.egg-info`` and ``.pth`` files. This
|
||||
may assist in building environments that can be moved and copied.
|
||||
You have to run this *after* any new packages installed.
|
||||
* Added ``bin/activate_this.py``, a file you can use like
|
||||
``execfile("path_to/activate_this.py",
|
||||
dict(__file__="path_to/activate_this.py"))`` -- this will activate
|
||||
the environment in place, similar to what `the mod_wsgi example
|
||||
does <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
* For Mac framework builds of Python, the site-packages directory
|
||||
``/Library/Python/X.Y/site-packages`` is added to ``sys.path``, from
|
||||
Andrea Rech.
|
||||
* Some platform-specific modules in Macs are added to the path now
|
||||
(``plat-darwin/``, ``plat-mac/``, ``plat-mac/lib-scriptpackages``),
|
||||
from Andrea Rech.
|
||||
* Fixed a small Bashism in the ``bin/activate`` shell script.
|
||||
* Added ``__future__`` to the list of required modules, for Python
|
||||
2.3. You'll still need to backport your own ``subprocess`` module.
|
||||
* Fixed the ``__classpath__`` entry in Jython's ``sys.path`` taking
|
||||
precedent over virtualenv's libs.
|
||||
|
||||
1.2
|
||||
~~~
|
||||
|
||||
* Added a ``--python`` option to select the Python interpreter.
|
||||
* Add ``warnings`` to the modules copied over, for Python 2.6 support.
|
||||
* Add ``sets`` to the module copied over for Python 2.3 (though Python
|
||||
2.3 still probably doesn't work).
|
||||
|
||||
1.1.1
|
||||
~~~~~
|
||||
|
||||
* Added support for Jython 2.5.
|
||||
|
||||
1.1
|
||||
~~~
|
||||
|
||||
* Added support for Python 2.6.
|
||||
* Fix a problem with missing ``DLLs/zlib.pyd`` on Windows. Create
|
||||
* ``bin/python`` (or ``bin/python.exe``) even when you run virtualenv
|
||||
with an interpreter named, e.g., ``python2.4``
|
||||
* Fix MacPorts Python
|
||||
* Added --unzip-setuptools option
|
||||
* Update to Setuptools 0.6c8
|
||||
* If the current directory is not writable, run ez_setup.py in ``/tmp``
|
||||
* Copy or symlink over the ``include`` directory so that packages will
|
||||
more consistently compile.
|
||||
|
||||
1.0
|
||||
~~~
|
||||
|
||||
* Fix build on systems that use ``/usr/lib64``, distinct from
|
||||
``/usr/lib`` (specifically CentOS x64).
|
||||
* Fixed bug in ``--clear``.
|
||||
* Fixed typos in ``deactivate.bat``.
|
||||
* Preserve ``$PYTHONPATH`` when calling subprocesses.
|
||||
|
||||
0.9.2
|
||||
~~~~~
|
||||
|
||||
* Fix include dir copying on Windows (makes compiling possible).
|
||||
* Include the main ``lib-tk`` in the path.
|
||||
* Patch ``distutils.sysconfig``: ``get_python_inc`` and
|
||||
``get_python_lib`` to point to the global locations.
|
||||
* Install ``distutils.cfg`` before Setuptools, so that system
|
||||
customizations of ``distutils.cfg`` won't effect the installation.
|
||||
* Add ``bin/pythonX.Y`` to the virtualenv (in addition to
|
||||
``bin/python``).
|
||||
* Fixed an issue with Mac Framework Python builds, and absolute paths
|
||||
(from Ronald Oussoren).
|
||||
|
||||
0.9.1
|
||||
~~~~~
|
||||
|
||||
* Improve ability to create a virtualenv from inside a virtualenv.
|
||||
* Fix a little bug in ``bin/activate``.
|
||||
* Actually get ``distutils.cfg`` to work reliably.
|
||||
|
||||
0.9
|
||||
~~~
|
||||
|
||||
* Added ``lib-dynload`` and ``config`` to things that need to be
|
||||
copied over in an environment.
|
||||
* Copy over or symlink the ``include`` directory, so that you can
|
||||
build packages that need the C headers.
|
||||
* Include a ``distutils`` package, so you can locally update
|
||||
``distutils.cfg`` (in ``lib/pythonX.Y/distutils/distutils.cfg``).
|
||||
* Better avoid downloading Setuptools, and hitting PyPI on environment
|
||||
creation.
|
||||
* Fix a problem creating a ``lib64/`` directory.
|
||||
* Should work on MacOSX Framework builds (the default Python
|
||||
installations on Mac). Thanks to Ronald Oussoren.
|
||||
|
||||
0.8.4
|
||||
~~~~~
|
||||
|
||||
* Windows installs would sometimes give errors about ``sys.prefix`` that
|
||||
were inaccurate.
|
||||
* Slightly prettier output.
|
||||
|
||||
0.8.3
|
||||
~~~~~
|
||||
|
||||
* Added support for Windows.
|
||||
|
||||
0.8.2
|
||||
~~~~~
|
||||
|
||||
* Give a better warning if you are on an unsupported platform (Mac
|
||||
Framework Pythons, and Windows).
|
||||
* Give error about running while inside a workingenv.
|
||||
* Give better error message about Python 2.3.
|
||||
|
||||
0.8.1
|
||||
~~~~~
|
||||
|
||||
Fixed packaging of the library.
|
||||
|
||||
0.8
|
||||
~~~
|
||||
|
||||
Initial release. Everything is changed and new!
|
||||
|
||||
Keywords: setuptools deployment installation distutils
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.4
|
||||
Classifier: Programming Language :: Python :: 2.5
|
||||
Classifier: Programming Language :: Python :: 2.6
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.1
|
||||
Classifier: Programming Language :: Python :: 3.2
|
||||
@@ -1,422 +0,0 @@
|
||||
virtualenv
|
||||
==========
|
||||
|
||||
* `Discussion list <http://groups.google.com/group/python-virtualenv/>`_
|
||||
* `Bugs <https://github.com/pypa/virtualenv/issues/>`_
|
||||
|
||||
.. contents::
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
news
|
||||
|
||||
.. comment: split here
|
||||
|
||||
Status and License
|
||||
------------------
|
||||
|
||||
``virtualenv`` is a successor to `workingenv
|
||||
<http://cheeseshop.python.org/pypi/workingenv.py>`_, and an extension
|
||||
of `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_.
|
||||
|
||||
It was written by Ian Bicking, sponsored by the `Open Planning
|
||||
Project <http://openplans.org>`_ and is now maintained by a
|
||||
`group of developers <https://github.com/pypa/virtualenv/raw/master/AUTHORS.txt>`_.
|
||||
It is licensed under an
|
||||
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
|
||||
|
||||
You can install it with ``easy_install virtualenv``, or the `latest
|
||||
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
|
||||
with ``easy_install virtualenv==dev``.
|
||||
|
||||
What It Does
|
||||
------------
|
||||
|
||||
``virtualenv`` is a tool to create isolated Python environments.
|
||||
|
||||
The basic problem being addressed is one of dependencies and versions,
|
||||
and indirectly permissions. Imagine you have an application that
|
||||
needs version 1 of LibFoo, but another application requires version
|
||||
2. How can you use both these applications? If you install
|
||||
everything into ``/usr/lib/python2.7/site-packages`` (or whatever your
|
||||
platform's standard location is), it's easy to end up in a situation
|
||||
where you unintentionally upgrade an application that shouldn't be
|
||||
upgraded.
|
||||
|
||||
Or more generally, what if you want to install an application *and
|
||||
leave it be*? If an application works, any change in its libraries or
|
||||
the versions of those libraries can break the application.
|
||||
|
||||
Also, what if you can't install packages into the global
|
||||
``site-packages`` directory? For instance, on a shared host.
|
||||
|
||||
In all these cases, ``virtualenv`` can help you. It creates an
|
||||
environment that has its own installation directories, that doesn't
|
||||
share libraries with other virtualenv environments (and optionally
|
||||
doesn't access the globally installed libraries either).
|
||||
|
||||
The basic usage is::
|
||||
|
||||
$ python virtualenv.py ENV
|
||||
|
||||
If you install it you can also just do ``virtualenv ENV``.
|
||||
|
||||
This creates ``ENV/lib/pythonX.X/site-packages``, where any libraries you
|
||||
install will go. It also creates ``ENV/bin/python``, which is a Python
|
||||
interpreter that uses this environment. Anytime you use that interpreter
|
||||
(including when a script has ``#!/path/to/ENV/bin/python`` in it) the libraries
|
||||
in that environment will be used.
|
||||
|
||||
It also installs either `Setuptools
|
||||
<http://peak.telecommunity.com/DevCenter/setuptools>`_ or `distribute
|
||||
<http://pypi.python.org/pypi/distribute>`_ into the environment. To use
|
||||
Distribute instead of setuptools, just call virtualenv like this::
|
||||
|
||||
$ python virtualenv.py --distribute ENV
|
||||
|
||||
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
|
||||
|
||||
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
|
||||
installer, so you can use `ENV/bin/pip`` to install additional packages into
|
||||
the environment.
|
||||
|
||||
Windows Notes
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Some paths within the virtualenv are slightly different on Windows: scripts and
|
||||
executables on Windows go in ``ENV\Scripts\`` instead of ``ENV/bin/`` and
|
||||
libraries go in ``ENV\Lib\`` rather than ``ENV/lib/``.
|
||||
|
||||
To create a virtualenv under a path with spaces in it on Windows, you'll need
|
||||
the `win32api <http://sourceforge.net/projects/pywin32/>`_ library installed.
|
||||
|
||||
PyPy Support
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Beginning with virtualenv version 1.5 `PyPy <http://pypy.org>`_ is
|
||||
supported. To use PyPy 1.4 or 1.4.1, you need a version of virtualenv >= 1.5.
|
||||
To use PyPy 1.5, you need a version of virtualenv >= 1.6.1.
|
||||
|
||||
Creating Your Own Bootstrap Scripts
|
||||
-----------------------------------
|
||||
|
||||
While this creates an environment, it doesn't put anything into the
|
||||
environment. Developers may find it useful to distribute a script
|
||||
that sets up a particular environment, for example a script that
|
||||
installs a particular web application.
|
||||
|
||||
To create a script like this, call
|
||||
``virtualenv.create_bootstrap_script(extra_text)``, and write the
|
||||
result to your new bootstrapping script. Here's the documentation
|
||||
from the docstring:
|
||||
|
||||
Creates a bootstrap script, which is like this script but with
|
||||
extend_parser, adjust_options, and after_install hooks.
|
||||
|
||||
This returns a string that (written to disk of course) can be used
|
||||
as a bootstrap script with your own customizations. The script
|
||||
will be the standard virtualenv.py script, with your extra text
|
||||
added (your extra text should be Python code).
|
||||
|
||||
If you include these functions, they will be called:
|
||||
|
||||
``extend_parser(optparse_parser)``:
|
||||
You can add or remove options from the parser here.
|
||||
|
||||
``adjust_options(options, args)``:
|
||||
You can change options here, or change the args (if you accept
|
||||
different kinds of arguments, be sure you modify ``args`` so it is
|
||||
only ``[DEST_DIR]``).
|
||||
|
||||
``after_install(options, home_dir)``:
|
||||
|
||||
After everything is installed, this function is called. This
|
||||
is probably the function you are most likely to use. An
|
||||
example would be::
|
||||
|
||||
def after_install(options, home_dir):
|
||||
if sys.platform == 'win32':
|
||||
bin = 'Scripts'
|
||||
else:
|
||||
bin = 'bin'
|
||||
subprocess.call([join(home_dir, bin, 'easy_install'),
|
||||
'MyPackage'])
|
||||
subprocess.call([join(home_dir, bin, 'my-package-script'),
|
||||
'setup', home_dir])
|
||||
|
||||
This example immediately installs a package, and runs a setup
|
||||
script from that package.
|
||||
|
||||
Bootstrap Example
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Here's a more concrete example of how you could use this::
|
||||
|
||||
import virtualenv, textwrap
|
||||
output = virtualenv.create_bootstrap_script(textwrap.dedent("""
|
||||
import os, subprocess
|
||||
def after_install(options, home_dir):
|
||||
etc = join(home_dir, 'etc')
|
||||
if not os.path.exists(etc):
|
||||
os.makedirs(etc)
|
||||
subprocess.call([join(home_dir, 'bin', 'easy_install'),
|
||||
'BlogApplication'])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'make-config', 'BlogApplication',
|
||||
join(etc, 'blog.ini')])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'setup-app', join(etc, 'blog.ini')])
|
||||
"""))
|
||||
f = open('blog-bootstrap.py', 'w').write(output)
|
||||
|
||||
Another example is available `here
|
||||
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_.
|
||||
|
||||
activate script
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
In a newly created virtualenv there will be a ``bin/activate`` shell
|
||||
script, or a ``Scripts/activate.bat`` batch file on Windows.
|
||||
|
||||
On Posix systems you can do::
|
||||
|
||||
$ source bin/activate
|
||||
|
||||
This will change your ``$PATH`` to point to the virtualenv's ``bin/``
|
||||
directory. (You have to use ``source`` because it changes your shell
|
||||
environment in-place.) This is all it does; it's purely a convenience. If
|
||||
you directly run a script or the python interpreter from the virtualenv's
|
||||
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
|
||||
``/path/to/env/bin/python script.py``) there's no need for activation.
|
||||
|
||||
After activating an environment you can use the function ``deactivate`` to
|
||||
undo the changes to your ``$PATH``.
|
||||
|
||||
The ``activate`` script will also modify your shell prompt to indicate
|
||||
which environment is currently active. You can disable this behavior,
|
||||
which can be useful if you have your own custom prompt that already
|
||||
displays the active environment name. To do so, set the
|
||||
``VIRTUAL_ENV_DISABLE_PROMPT`` environment variable to any non-empty
|
||||
value before running the ``activate`` script.
|
||||
|
||||
On Windows you just do::
|
||||
|
||||
> \path\to\env\Scripts\activate.bat
|
||||
|
||||
And use ``deactivate.bat`` to undo the changes.
|
||||
|
||||
The ``--no-site-packages`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you build with ``virtualenv --no-site-packages ENV`` it will *not*
|
||||
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or
|
||||
wherever your global site-packages directory is). This can be used if
|
||||
you don't have control over site-packages and don't want to depend on
|
||||
the packages there, or you just want more isolation from the global
|
||||
system.
|
||||
|
||||
Using Virtualenv without ``bin/python``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sometimes you can't or don't want to use the Python interpreter
|
||||
created by the virtualenv. For instance, in a `mod_python
|
||||
<http://www.modpython.org/>`_ or `mod_wsgi <http://www.modwsgi.org/>`_
|
||||
environment, there is only one interpreter.
|
||||
|
||||
Luckily, it's easy. You must use the custom Python interpreter to
|
||||
*install* libraries. But to *use* libraries, you just have to be sure
|
||||
the path is correct. A script is available to correct the path. You
|
||||
can setup the environment like::
|
||||
|
||||
activate_this = '/path/to/env/bin/activate_this.py'
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
This will change ``sys.path`` and even change ``sys.prefix``, but also allow
|
||||
you to use an existing interpreter. Items in your environment will show up
|
||||
first on ``sys.path``, before global items. However, global items will
|
||||
always be accessible -- this technique does not support the
|
||||
``--no-site-packages`` flag. Also, this cannot undo the activation of other
|
||||
environments, or modules that have been imported. You shouldn't try to, for
|
||||
instance, activate an environment before a web request; you should activate
|
||||
*one* environment as early as possible, and not do it again in that process.
|
||||
|
||||
Making Environments Relocatable
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Note: this option is somewhat experimental, and there are probably
|
||||
caveats that have not yet been identified. Also this does not
|
||||
currently work on Windows.
|
||||
|
||||
Normally environments are tied to a specific path. That means that
|
||||
you cannot move an environment around or copy it to another computer.
|
||||
You can fix up an environment to make it relocatable with the
|
||||
command::
|
||||
|
||||
$ virtualenv --relocatable ENV
|
||||
|
||||
This will make some of the files created by setuptools or distribute
|
||||
use relative paths, and will change all the scripts to use ``activate_this.py``
|
||||
instead of using the location of the Python interpreter to select the
|
||||
environment.
|
||||
|
||||
**Note:** you must run this after you've installed *any* packages into
|
||||
the environment. If you make an environment relocatable, then
|
||||
install a new package, you must run ``virtualenv --relocatable``
|
||||
again.
|
||||
|
||||
Also, this **does not make your packages cross-platform**. You can
|
||||
move the directory around, but it can only be used on other similar
|
||||
computers. Some known environmental differences that can cause
|
||||
incompatibilities: a different version of Python, when one platform
|
||||
uses UCS2 for its internal unicode representation and another uses
|
||||
UCS4 (a compile-time option), obvious platform changes like Windows
|
||||
vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C
|
||||
libraries on the system, if those C libraries are located somewhere
|
||||
different (either different versions, or a different filesystem
|
||||
layout).
|
||||
|
||||
Currently the ``--no-site-packages`` option will not be honored if you
|
||||
use this on an environment.
|
||||
|
||||
The ``--extra-search-dir`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When it creates a new environment, virtualenv installs either
|
||||
setuptools or distribute, and pip. In normal operation, the latest
|
||||
releases of these packages are fetched from the `Python Package Index
|
||||
<http://pypi.python.org>`_ (PyPI). In some circumstances, this
|
||||
behavior may not be wanted, for example if you are using virtualenv
|
||||
during a deployment and do not want to depend on Internet access and
|
||||
PyPI availability.
|
||||
|
||||
As an alternative, you can provide your own versions of setuptools,
|
||||
distribute and/or pip on the filesystem, and tell virtualenv to use
|
||||
those distributions instead of downloading them from the Internet. To
|
||||
use this feature, pass one or more ``--extra-search-dir`` options to
|
||||
virtualenv like this::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions ENV
|
||||
|
||||
The ``/path/to/distributions`` path should point to a directory that
|
||||
contains setuptools, distribute and/or pip distributions. Setuptools
|
||||
distributions must be ``.egg`` files; distribute and pip distributions
|
||||
should be `.tar.gz` source distributions.
|
||||
|
||||
Virtualenv will still download these packages if no satisfactory local
|
||||
distributions are found.
|
||||
|
||||
If you are really concerned about virtualenv fetching these packages
|
||||
from the Internet and want to ensure that it never will, you can also
|
||||
provide an option ``--never-download`` like so::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions --never-download ENV
|
||||
|
||||
If this option is provided, virtualenv will never try to download
|
||||
setuptools/distribute or pip. Instead, it will exit with status code 1
|
||||
if it fails to find local distributions for any of these required
|
||||
packages.
|
||||
|
||||
Compare & Contrast with Alternatives
|
||||
------------------------------------
|
||||
|
||||
There are several alternatives that create isolated environments:
|
||||
|
||||
* ``workingenv`` (which I do not suggest you use anymore) is the
|
||||
predecessor to this library. It used the main Python interpreter,
|
||||
but relied on setting ``$PYTHONPATH`` to activate the environment.
|
||||
This causes problems when running Python scripts that aren't part of
|
||||
the environment (e.g., a globally installed ``hg`` or ``bzr``). It
|
||||
also conflicted a lot with Setuptools.
|
||||
|
||||
* `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_
|
||||
is also a predecessor to this library. It uses only symlinks, so it
|
||||
couldn't work on Windows. It also symlinks over the *entire*
|
||||
standard library and global ``site-packages``. As a result, it
|
||||
won't see new additions to the global ``site-packages``.
|
||||
|
||||
This script only symlinks a small portion of the standard library
|
||||
into the environment, and so on Windows it is feasible to simply
|
||||
copy these files over. Also, it creates a new/empty
|
||||
``site-packages`` and also adds the global ``site-packages`` to the
|
||||
path, so updates are tracked separately. This script also installs
|
||||
Setuptools automatically, saving a step and avoiding the need for
|
||||
network access.
|
||||
|
||||
* `zc.buildout <http://pypi.python.org/pypi/zc.buildout>`_ doesn't
|
||||
create an isolated Python environment in the same style, but
|
||||
achieves similar results through a declarative config file that sets
|
||||
up scripts with very particular packages. As a declarative system,
|
||||
it is somewhat easier to repeat and manage, but more difficult to
|
||||
experiment with. ``zc.buildout`` includes the ability to setup
|
||||
non-Python systems (e.g., a database server or an Apache instance).
|
||||
|
||||
I *strongly* recommend anyone doing application development or
|
||||
deployment use one of these tools.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Refer to the `contributing to pip`_ documentation - it applies equally to
|
||||
virtualenv.
|
||||
|
||||
Virtualenv's release schedule is tied to pip's -- each time there's a new pip
|
||||
release, there will be a new virtualenv release that bundles the new version of
|
||||
pip.
|
||||
|
||||
.. _contributing to pip: http://www.pip-installer.org/en/latest/how-to-contribute.html
|
||||
|
||||
Running the tests
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Virtualenv's test suite is small and not yet at all comprehensive, but we aim
|
||||
to grow it.
|
||||
|
||||
The easy way to run tests (handles test dependencies automatically)::
|
||||
|
||||
$ python setup.py test
|
||||
|
||||
If you want to run only a selection of the tests, you'll need to run them
|
||||
directly with nose instead. Create a virtualenv, and install required
|
||||
packages::
|
||||
|
||||
$ pip install nose mock
|
||||
|
||||
Run nosetests::
|
||||
|
||||
$ nosetests
|
||||
|
||||
Or select just a single test file to run::
|
||||
|
||||
$ nosetests tests.test_virtualenv
|
||||
|
||||
|
||||
Other Documentation and Links
|
||||
-----------------------------
|
||||
|
||||
* James Gardner has written a tutorial on using `virtualenv with
|
||||
Pylons
|
||||
<http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox>`_.
|
||||
|
||||
* `Blog announcement
|
||||
<http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/>`_.
|
||||
|
||||
* Doug Hellmann wrote a description of his `command-line work flow
|
||||
using virtualenv (virtualenvwrapper)
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_
|
||||
including some handy scripts to make working with multiple
|
||||
environments easier. He also wrote `an example of using virtualenv
|
||||
to try IPython
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html>`_.
|
||||
|
||||
* Chris Perkins created a `showmedo video including virtualenv
|
||||
<http://showmedo.com/videos/video?name=2910000&fromSeriesID=291>`_.
|
||||
|
||||
* `Using virtualenv with mod_wsgi
|
||||
<http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
|
||||
* `virtualenv commands
|
||||
<http://thisismedium.com/tech/extending-virtualenv/>`_ for some more
|
||||
workflow-related tools around virtualenv.
|
||||
@@ -1,395 +0,0 @@
|
||||
Changes & News
|
||||
--------------
|
||||
|
||||
Next release (1.7) schedule
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Beta release mid-July 2011, final release early August.
|
||||
|
||||
1.6.4 (2011-07-21)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python 2.4, too.
|
||||
|
||||
1.6.3 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python < 2.7.
|
||||
|
||||
1.6.2 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Updated embedded distribute release to 0.6.19.
|
||||
|
||||
* Updated embedded pip release to 1.0.2.
|
||||
|
||||
* Fixed #141 - Be smarter about finding pkg_resources when using the
|
||||
non-default Python intepreter (by using the ``-p`` option).
|
||||
|
||||
* Fixed #112 - Fixed path in docs.
|
||||
|
||||
* Fixed #109 - Corrected doctests of a Logger method.
|
||||
|
||||
* Fixed #118 - Fixed creating virtualenvs on platforms that use the
|
||||
"posix_local" install scheme, such as Ubuntu with Python 2.7.
|
||||
|
||||
* Add missing library to Python 3 virtualenvs (``_dummy_thread``).
|
||||
|
||||
|
||||
1.6.1 (2011-04-30)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Start to use git-flow.
|
||||
|
||||
* Added support for PyPy 1.5
|
||||
|
||||
* Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
|
||||
|
||||
* Added progress meter for pip installation as well as setuptools. Thanks Ethan
|
||||
Jucovy.
|
||||
|
||||
* Added --never-download and --search-dir options. Thanks Ethan Jucovy.
|
||||
|
||||
1.6
|
||||
~~~
|
||||
|
||||
* Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
|
||||
|
||||
* Fixed creation of virtualenvs on Mac OS X when standard library modules
|
||||
(readline) are installed outside the standard library.
|
||||
|
||||
* Updated bundled pip to 1.0.
|
||||
|
||||
1.5.2
|
||||
~~~~~
|
||||
|
||||
* Moved main repository to Github: https://github.com/pypa/virtualenv
|
||||
|
||||
* Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer and Brian Rosner
|
||||
|
||||
* Fixed a few more pypy related bugs.
|
||||
|
||||
* Updated bundled pip to 0.8.2.
|
||||
|
||||
* Handed project over to new team of maintainers.
|
||||
|
||||
* Moved virtualenv to Github at https://github.com/pypa/virtualenv
|
||||
|
||||
1.5.1
|
||||
~~~~~
|
||||
|
||||
* Added ``_weakrefset`` requirement for Python 2.7.1.
|
||||
|
||||
* Fixed Windows regression in 1.5
|
||||
|
||||
1.5
|
||||
~~~
|
||||
|
||||
* Include pip 0.8.1.
|
||||
|
||||
* Add support for PyPy.
|
||||
|
||||
* Uses a proper temporary dir when installing environment requirements.
|
||||
|
||||
* Add ``--prompt`` option to be able to override the default prompt prefix.
|
||||
|
||||
* Fix an issue with ``--relocatable`` on Windows.
|
||||
|
||||
* Fix issue with installing the wrong version of distribute.
|
||||
|
||||
* Add fish and csh activate scripts.
|
||||
|
||||
1.4.9
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7.2
|
||||
|
||||
1.4.8
|
||||
~~~~~
|
||||
|
||||
* Fix for Mac OS X Framework builds that use
|
||||
``--universal-archs=intel``
|
||||
|
||||
* Fix ``activate_this.py`` on Windows.
|
||||
|
||||
* Allow ``$PYTHONHOME`` to be set, so long as you use ``source
|
||||
bin/activate`` it will get unset; if you leave it set and do not
|
||||
activate the environment it will still break the environment.
|
||||
|
||||
* Include pip 0.7.1
|
||||
|
||||
1.4.7
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7
|
||||
|
||||
1.4.6
|
||||
~~~~~
|
||||
|
||||
* Allow ``activate.sh`` to skip updating the prompt (by setting
|
||||
``$VIRTUAL_ENV_DISABLE_PROMPT``).
|
||||
|
||||
1.4.5
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.3
|
||||
|
||||
* Fix ``activate.bat`` and ``deactivate.bat`` under Windows when
|
||||
``PATH`` contained a parenthesis
|
||||
|
||||
1.4.4
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.2 and Distribute 0.6.10
|
||||
|
||||
* Create the ``virtualenv`` script even when Setuptools isn't
|
||||
installed
|
||||
|
||||
* Fix problem with ``virtualenv --relocate`` when ``bin/`` has
|
||||
subdirectories (e.g., ``bin/.svn/``); from Alan Franzoni.
|
||||
|
||||
* If you set ``$VIRTUALENV_USE_DISTRIBUTE`` then virtualenv will use
|
||||
Distribute by default (so you don't have to remember to use
|
||||
``--distribute``).
|
||||
|
||||
1.4.3
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.1
|
||||
|
||||
1.4.2
|
||||
~~~~~
|
||||
|
||||
* Fix pip installation on Windows
|
||||
|
||||
* Fix use of stand-alone ``virtualenv.py`` (and boot scripts)
|
||||
|
||||
* Exclude ~/.local (user site-packages) from environments when using
|
||||
``--no-site-packages``
|
||||
|
||||
1.4.1
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6
|
||||
|
||||
1.4
|
||||
~~~
|
||||
|
||||
* Updated setuptools to 0.6c11
|
||||
|
||||
* Added the --distribute option
|
||||
|
||||
* Fixed packaging problem of support-files
|
||||
|
||||
1.3.4
|
||||
~~~~~
|
||||
|
||||
* Virtualenv now copies the actual embedded Python binary on
|
||||
Mac OS X to fix a hang on Snow Leopard (10.6).
|
||||
|
||||
* Fail more gracefully on Windows when ``win32api`` is not installed.
|
||||
|
||||
* Fix site-packages taking precedent over Jython's ``__classpath__``
|
||||
and also specially handle the new ``__pyclasspath__`` entry in
|
||||
``sys.path``.
|
||||
|
||||
* Now copies Jython's ``registry`` file to the virtualenv if it exists.
|
||||
|
||||
* Better find libraries when compiling extensions on Windows.
|
||||
|
||||
* Create ``Scripts\pythonw.exe`` on Windows.
|
||||
|
||||
* Added support for the Debian/Ubuntu
|
||||
``/usr/lib/pythonX.Y/dist-packages`` directory.
|
||||
|
||||
* Set ``distutils.sysconfig.get_config_vars()['LIBDIR']`` (based on
|
||||
``sys.real_prefix``) which is reported to help building on Windows.
|
||||
|
||||
* Make ``deactivate`` work on ksh
|
||||
|
||||
* Fixes for ``--python``: make it work with ``--relocatable`` and the
|
||||
symlink created to the exact Python version.
|
||||
|
||||
1.3.3
|
||||
~~~~~
|
||||
|
||||
* Use Windows newlines in ``activate.bat``, which has been reported to help
|
||||
when using non-ASCII directory names.
|
||||
|
||||
* Fixed compatibility with Jython 2.5b1.
|
||||
|
||||
* Added a function ``virtualenv.install_python`` for more fine-grained
|
||||
access to what ``virtualenv.create_environment`` does.
|
||||
|
||||
* Fix `a problem <https://bugs.launchpad.net/virtualenv/+bug/241581>`_
|
||||
with Windows and paths that contain spaces.
|
||||
|
||||
* If ``/path/to/env/.pydistutils.cfg`` exists (or
|
||||
``/path/to/env/pydistutils.cfg`` on Windows systems) then ignore
|
||||
``~/.pydistutils.cfg`` and use that other file instead.
|
||||
|
||||
* Fix ` a problem
|
||||
<https://bugs.launchpad.net/virtualenv/+bug/340050>`_ picking up
|
||||
some ``.so`` libraries in ``/usr/local``.
|
||||
|
||||
1.3.2
|
||||
~~~~~
|
||||
|
||||
* Remove the ``[install] prefix = ...`` setting from the virtualenv
|
||||
``distutils.cfg`` -- this has been causing problems for a lot of
|
||||
people, in rather obscure ways.
|
||||
|
||||
* If you use a `boot script <./index.html#boot-script>`_ it will attempt to import ``virtualenv``
|
||||
and find a pre-downloaded Setuptools egg using that.
|
||||
|
||||
* Added platform-specific paths, like ``/usr/lib/pythonX.Y/plat-linux2``
|
||||
|
||||
1.3.1
|
||||
~~~~~
|
||||
|
||||
* Real Python 2.6 compatibility. Backported the Python 2.6 updates to
|
||||
``site.py``, including `user directories
|
||||
<http://docs.python.org/dev/whatsnew/2.6.html#pep-370-per-user-site-packages-directory>`_
|
||||
(this means older versions of Python will support user directories,
|
||||
whether intended or not).
|
||||
|
||||
* Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
|
||||
on some platforms where a system-wide ``distutils.cfg`` was present
|
||||
with a ``prefix`` setting, packages would be installed globally
|
||||
(usually in ``/usr/local/lib/pythonX.Y/site-packages``).
|
||||
|
||||
* Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
|
||||
workaround is added.
|
||||
|
||||
* Fix ``--python`` option.
|
||||
|
||||
* Fixed handling of Jython environments that use a
|
||||
jython-complete.jar.
|
||||
|
||||
1.3
|
||||
~~~
|
||||
|
||||
* Update to Setuptools 0.6c9
|
||||
* Added an option ``virtualenv --relocatable EXISTING_ENV``, which
|
||||
will make an existing environment "relocatable" -- the paths will
|
||||
not be absolute in scripts, ``.egg-info`` and ``.pth`` files. This
|
||||
may assist in building environments that can be moved and copied.
|
||||
You have to run this *after* any new packages installed.
|
||||
* Added ``bin/activate_this.py``, a file you can use like
|
||||
``execfile("path_to/activate_this.py",
|
||||
dict(__file__="path_to/activate_this.py"))`` -- this will activate
|
||||
the environment in place, similar to what `the mod_wsgi example
|
||||
does <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
* For Mac framework builds of Python, the site-packages directory
|
||||
``/Library/Python/X.Y/site-packages`` is added to ``sys.path``, from
|
||||
Andrea Rech.
|
||||
* Some platform-specific modules in Macs are added to the path now
|
||||
(``plat-darwin/``, ``plat-mac/``, ``plat-mac/lib-scriptpackages``),
|
||||
from Andrea Rech.
|
||||
* Fixed a small Bashism in the ``bin/activate`` shell script.
|
||||
* Added ``__future__`` to the list of required modules, for Python
|
||||
2.3. You'll still need to backport your own ``subprocess`` module.
|
||||
* Fixed the ``__classpath__`` entry in Jython's ``sys.path`` taking
|
||||
precedent over virtualenv's libs.
|
||||
|
||||
1.2
|
||||
~~~
|
||||
|
||||
* Added a ``--python`` option to select the Python interpreter.
|
||||
* Add ``warnings`` to the modules copied over, for Python 2.6 support.
|
||||
* Add ``sets`` to the module copied over for Python 2.3 (though Python
|
||||
2.3 still probably doesn't work).
|
||||
|
||||
1.1.1
|
||||
~~~~~
|
||||
|
||||
* Added support for Jython 2.5.
|
||||
|
||||
1.1
|
||||
~~~
|
||||
|
||||
* Added support for Python 2.6.
|
||||
* Fix a problem with missing ``DLLs/zlib.pyd`` on Windows. Create
|
||||
* ``bin/python`` (or ``bin/python.exe``) even when you run virtualenv
|
||||
with an interpreter named, e.g., ``python2.4``
|
||||
* Fix MacPorts Python
|
||||
* Added --unzip-setuptools option
|
||||
* Update to Setuptools 0.6c8
|
||||
* If the current directory is not writable, run ez_setup.py in ``/tmp``
|
||||
* Copy or symlink over the ``include`` directory so that packages will
|
||||
more consistently compile.
|
||||
|
||||
1.0
|
||||
~~~
|
||||
|
||||
* Fix build on systems that use ``/usr/lib64``, distinct from
|
||||
``/usr/lib`` (specifically CentOS x64).
|
||||
* Fixed bug in ``--clear``.
|
||||
* Fixed typos in ``deactivate.bat``.
|
||||
* Preserve ``$PYTHONPATH`` when calling subprocesses.
|
||||
|
||||
0.9.2
|
||||
~~~~~
|
||||
|
||||
* Fix include dir copying on Windows (makes compiling possible).
|
||||
* Include the main ``lib-tk`` in the path.
|
||||
* Patch ``distutils.sysconfig``: ``get_python_inc`` and
|
||||
``get_python_lib`` to point to the global locations.
|
||||
* Install ``distutils.cfg`` before Setuptools, so that system
|
||||
customizations of ``distutils.cfg`` won't effect the installation.
|
||||
* Add ``bin/pythonX.Y`` to the virtualenv (in addition to
|
||||
``bin/python``).
|
||||
* Fixed an issue with Mac Framework Python builds, and absolute paths
|
||||
(from Ronald Oussoren).
|
||||
|
||||
0.9.1
|
||||
~~~~~
|
||||
|
||||
* Improve ability to create a virtualenv from inside a virtualenv.
|
||||
* Fix a little bug in ``bin/activate``.
|
||||
* Actually get ``distutils.cfg`` to work reliably.
|
||||
|
||||
0.9
|
||||
~~~
|
||||
|
||||
* Added ``lib-dynload`` and ``config`` to things that need to be
|
||||
copied over in an environment.
|
||||
* Copy over or symlink the ``include`` directory, so that you can
|
||||
build packages that need the C headers.
|
||||
* Include a ``distutils`` package, so you can locally update
|
||||
``distutils.cfg`` (in ``lib/pythonX.Y/distutils/distutils.cfg``).
|
||||
* Better avoid downloading Setuptools, and hitting PyPI on environment
|
||||
creation.
|
||||
* Fix a problem creating a ``lib64/`` directory.
|
||||
* Should work on MacOSX Framework builds (the default Python
|
||||
installations on Mac). Thanks to Ronald Oussoren.
|
||||
|
||||
0.8.4
|
||||
~~~~~
|
||||
|
||||
* Windows installs would sometimes give errors about ``sys.prefix`` that
|
||||
were inaccurate.
|
||||
* Slightly prettier output.
|
||||
|
||||
0.8.3
|
||||
~~~~~
|
||||
|
||||
* Added support for Windows.
|
||||
|
||||
0.8.2
|
||||
~~~~~
|
||||
|
||||
* Give a better warning if you are on an unsupported platform (Mac
|
||||
Framework Pythons, and Windows).
|
||||
* Give error about running while inside a workingenv.
|
||||
* Give better error message about Python 2.3.
|
||||
|
||||
0.8.1
|
||||
~~~~~
|
||||
|
||||
Fixed packaging of the library.
|
||||
|
||||
0.8
|
||||
~~~
|
||||
|
||||
Initial release. Everything is changed and new!
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import virtualenv
|
||||
virtualenv.main()
|
||||
@@ -1,5 +0,0 @@
|
||||
[egg_info]
|
||||
tag_build =
|
||||
tag_date = 0
|
||||
tag_svn_revision = 0
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import sys, os
|
||||
try:
|
||||
from setuptools import setup
|
||||
kw = {'entry_points':
|
||||
"""[console_scripts]\nvirtualenv = virtualenv:main\n""",
|
||||
'zip_safe': False}
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
if sys.platform == 'win32':
|
||||
print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"')
|
||||
kw = {}
|
||||
else:
|
||||
kw = {'scripts': ['scripts/virtualenv']}
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
## Get long_description from index.txt:
|
||||
f = open(os.path.join(here, 'docs', 'index.txt'))
|
||||
long_description = f.read().strip()
|
||||
long_description = long_description.split('split here', 1)[1]
|
||||
f.close()
|
||||
f = open(os.path.join(here, 'docs', 'news.txt'))
|
||||
long_description += "\n\n" + f.read()
|
||||
f.close()
|
||||
|
||||
setup(name='virtualenv',
|
||||
# If you change the version here, change it in virtualenv.py and
|
||||
# docs/conf.py as well
|
||||
version="1.6.4",
|
||||
description="Virtual Python Environment builder",
|
||||
long_description=long_description,
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.4',
|
||||
'Programming Language :: Python :: 2.5',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.1',
|
||||
'Programming Language :: Python :: 3.2',
|
||||
],
|
||||
keywords='setuptools deployment installation distutils',
|
||||
author='Ian Bicking',
|
||||
author_email='ianb@colorstudy.com',
|
||||
maintainer='Jannis Leidel, Carl Meyer and Brian Rosner',
|
||||
maintainer_email='python-virtualenv@groups.google.com',
|
||||
url='http://www.virtualenv.org',
|
||||
license='MIT',
|
||||
py_modules=['virtualenv'],
|
||||
packages=['virtualenv_support'],
|
||||
package_data={'virtualenv_support': ['*-py%s.egg' % sys.version[:3], '*.tar.gz']},
|
||||
test_suite='nose.collector',
|
||||
tests_require=['nose', 'Mock'],
|
||||
**kw
|
||||
)
|
||||
@@ -1,827 +0,0 @@
|
||||
Metadata-Version: 1.0
|
||||
Name: virtualenv
|
||||
Version: 1.6.4
|
||||
Summary: Virtual Python Environment builder
|
||||
Home-page: http://www.virtualenv.org
|
||||
Author: Jannis Leidel, Carl Meyer and Brian Rosner
|
||||
Author-email: python-virtualenv@groups.google.com
|
||||
License: MIT
|
||||
Description:
|
||||
|
||||
Status and License
|
||||
------------------
|
||||
|
||||
``virtualenv`` is a successor to `workingenv
|
||||
<http://cheeseshop.python.org/pypi/workingenv.py>`_, and an extension
|
||||
of `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_.
|
||||
|
||||
It was written by Ian Bicking, sponsored by the `Open Planning
|
||||
Project <http://openplans.org>`_ and is now maintained by a
|
||||
`group of developers <https://github.com/pypa/virtualenv/raw/master/AUTHORS.txt>`_.
|
||||
It is licensed under an
|
||||
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
|
||||
|
||||
You can install it with ``easy_install virtualenv``, or the `latest
|
||||
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
|
||||
with ``easy_install virtualenv==dev``.
|
||||
|
||||
What It Does
|
||||
------------
|
||||
|
||||
``virtualenv`` is a tool to create isolated Python environments.
|
||||
|
||||
The basic problem being addressed is one of dependencies and versions,
|
||||
and indirectly permissions. Imagine you have an application that
|
||||
needs version 1 of LibFoo, but another application requires version
|
||||
2. How can you use both these applications? If you install
|
||||
everything into ``/usr/lib/python2.7/site-packages`` (or whatever your
|
||||
platform's standard location is), it's easy to end up in a situation
|
||||
where you unintentionally upgrade an application that shouldn't be
|
||||
upgraded.
|
||||
|
||||
Or more generally, what if you want to install an application *and
|
||||
leave it be*? If an application works, any change in its libraries or
|
||||
the versions of those libraries can break the application.
|
||||
|
||||
Also, what if you can't install packages into the global
|
||||
``site-packages`` directory? For instance, on a shared host.
|
||||
|
||||
In all these cases, ``virtualenv`` can help you. It creates an
|
||||
environment that has its own installation directories, that doesn't
|
||||
share libraries with other virtualenv environments (and optionally
|
||||
doesn't access the globally installed libraries either).
|
||||
|
||||
The basic usage is::
|
||||
|
||||
$ python virtualenv.py ENV
|
||||
|
||||
If you install it you can also just do ``virtualenv ENV``.
|
||||
|
||||
This creates ``ENV/lib/pythonX.X/site-packages``, where any libraries you
|
||||
install will go. It also creates ``ENV/bin/python``, which is a Python
|
||||
interpreter that uses this environment. Anytime you use that interpreter
|
||||
(including when a script has ``#!/path/to/ENV/bin/python`` in it) the libraries
|
||||
in that environment will be used.
|
||||
|
||||
It also installs either `Setuptools
|
||||
<http://peak.telecommunity.com/DevCenter/setuptools>`_ or `distribute
|
||||
<http://pypi.python.org/pypi/distribute>`_ into the environment. To use
|
||||
Distribute instead of setuptools, just call virtualenv like this::
|
||||
|
||||
$ python virtualenv.py --distribute ENV
|
||||
|
||||
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
|
||||
|
||||
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
|
||||
installer, so you can use `ENV/bin/pip`` to install additional packages into
|
||||
the environment.
|
||||
|
||||
Windows Notes
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Some paths within the virtualenv are slightly different on Windows: scripts and
|
||||
executables on Windows go in ``ENV\Scripts\`` instead of ``ENV/bin/`` and
|
||||
libraries go in ``ENV\Lib\`` rather than ``ENV/lib/``.
|
||||
|
||||
To create a virtualenv under a path with spaces in it on Windows, you'll need
|
||||
the `win32api <http://sourceforge.net/projects/pywin32/>`_ library installed.
|
||||
|
||||
PyPy Support
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Beginning with virtualenv version 1.5 `PyPy <http://pypy.org>`_ is
|
||||
supported. To use PyPy 1.4 or 1.4.1, you need a version of virtualenv >= 1.5.
|
||||
To use PyPy 1.5, you need a version of virtualenv >= 1.6.1.
|
||||
|
||||
Creating Your Own Bootstrap Scripts
|
||||
-----------------------------------
|
||||
|
||||
While this creates an environment, it doesn't put anything into the
|
||||
environment. Developers may find it useful to distribute a script
|
||||
that sets up a particular environment, for example a script that
|
||||
installs a particular web application.
|
||||
|
||||
To create a script like this, call
|
||||
``virtualenv.create_bootstrap_script(extra_text)``, and write the
|
||||
result to your new bootstrapping script. Here's the documentation
|
||||
from the docstring:
|
||||
|
||||
Creates a bootstrap script, which is like this script but with
|
||||
extend_parser, adjust_options, and after_install hooks.
|
||||
|
||||
This returns a string that (written to disk of course) can be used
|
||||
as a bootstrap script with your own customizations. The script
|
||||
will be the standard virtualenv.py script, with your extra text
|
||||
added (your extra text should be Python code).
|
||||
|
||||
If you include these functions, they will be called:
|
||||
|
||||
``extend_parser(optparse_parser)``:
|
||||
You can add or remove options from the parser here.
|
||||
|
||||
``adjust_options(options, args)``:
|
||||
You can change options here, or change the args (if you accept
|
||||
different kinds of arguments, be sure you modify ``args`` so it is
|
||||
only ``[DEST_DIR]``).
|
||||
|
||||
``after_install(options, home_dir)``:
|
||||
|
||||
After everything is installed, this function is called. This
|
||||
is probably the function you are most likely to use. An
|
||||
example would be::
|
||||
|
||||
def after_install(options, home_dir):
|
||||
if sys.platform == 'win32':
|
||||
bin = 'Scripts'
|
||||
else:
|
||||
bin = 'bin'
|
||||
subprocess.call([join(home_dir, bin, 'easy_install'),
|
||||
'MyPackage'])
|
||||
subprocess.call([join(home_dir, bin, 'my-package-script'),
|
||||
'setup', home_dir])
|
||||
|
||||
This example immediately installs a package, and runs a setup
|
||||
script from that package.
|
||||
|
||||
Bootstrap Example
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Here's a more concrete example of how you could use this::
|
||||
|
||||
import virtualenv, textwrap
|
||||
output = virtualenv.create_bootstrap_script(textwrap.dedent("""
|
||||
import os, subprocess
|
||||
def after_install(options, home_dir):
|
||||
etc = join(home_dir, 'etc')
|
||||
if not os.path.exists(etc):
|
||||
os.makedirs(etc)
|
||||
subprocess.call([join(home_dir, 'bin', 'easy_install'),
|
||||
'BlogApplication'])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'make-config', 'BlogApplication',
|
||||
join(etc, 'blog.ini')])
|
||||
subprocess.call([join(home_dir, 'bin', 'paster'),
|
||||
'setup-app', join(etc, 'blog.ini')])
|
||||
"""))
|
||||
f = open('blog-bootstrap.py', 'w').write(output)
|
||||
|
||||
Another example is available `here
|
||||
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_.
|
||||
|
||||
activate script
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
In a newly created virtualenv there will be a ``bin/activate`` shell
|
||||
script, or a ``Scripts/activate.bat`` batch file on Windows.
|
||||
|
||||
On Posix systems you can do::
|
||||
|
||||
$ source bin/activate
|
||||
|
||||
This will change your ``$PATH`` to point to the virtualenv's ``bin/``
|
||||
directory. (You have to use ``source`` because it changes your shell
|
||||
environment in-place.) This is all it does; it's purely a convenience. If
|
||||
you directly run a script or the python interpreter from the virtualenv's
|
||||
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
|
||||
``/path/to/env/bin/python script.py``) there's no need for activation.
|
||||
|
||||
After activating an environment you can use the function ``deactivate`` to
|
||||
undo the changes to your ``$PATH``.
|
||||
|
||||
The ``activate`` script will also modify your shell prompt to indicate
|
||||
which environment is currently active. You can disable this behavior,
|
||||
which can be useful if you have your own custom prompt that already
|
||||
displays the active environment name. To do so, set the
|
||||
``VIRTUAL_ENV_DISABLE_PROMPT`` environment variable to any non-empty
|
||||
value before running the ``activate`` script.
|
||||
|
||||
On Windows you just do::
|
||||
|
||||
> \path\to\env\Scripts\activate.bat
|
||||
|
||||
And use ``deactivate.bat`` to undo the changes.
|
||||
|
||||
The ``--no-site-packages`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you build with ``virtualenv --no-site-packages ENV`` it will *not*
|
||||
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or
|
||||
wherever your global site-packages directory is). This can be used if
|
||||
you don't have control over site-packages and don't want to depend on
|
||||
the packages there, or you just want more isolation from the global
|
||||
system.
|
||||
|
||||
Using Virtualenv without ``bin/python``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sometimes you can't or don't want to use the Python interpreter
|
||||
created by the virtualenv. For instance, in a `mod_python
|
||||
<http://www.modpython.org/>`_ or `mod_wsgi <http://www.modwsgi.org/>`_
|
||||
environment, there is only one interpreter.
|
||||
|
||||
Luckily, it's easy. You must use the custom Python interpreter to
|
||||
*install* libraries. But to *use* libraries, you just have to be sure
|
||||
the path is correct. A script is available to correct the path. You
|
||||
can setup the environment like::
|
||||
|
||||
activate_this = '/path/to/env/bin/activate_this.py'
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
This will change ``sys.path`` and even change ``sys.prefix``, but also allow
|
||||
you to use an existing interpreter. Items in your environment will show up
|
||||
first on ``sys.path``, before global items. However, global items will
|
||||
always be accessible -- this technique does not support the
|
||||
``--no-site-packages`` flag. Also, this cannot undo the activation of other
|
||||
environments, or modules that have been imported. You shouldn't try to, for
|
||||
instance, activate an environment before a web request; you should activate
|
||||
*one* environment as early as possible, and not do it again in that process.
|
||||
|
||||
Making Environments Relocatable
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Note: this option is somewhat experimental, and there are probably
|
||||
caveats that have not yet been identified. Also this does not
|
||||
currently work on Windows.
|
||||
|
||||
Normally environments are tied to a specific path. That means that
|
||||
you cannot move an environment around or copy it to another computer.
|
||||
You can fix up an environment to make it relocatable with the
|
||||
command::
|
||||
|
||||
$ virtualenv --relocatable ENV
|
||||
|
||||
This will make some of the files created by setuptools or distribute
|
||||
use relative paths, and will change all the scripts to use ``activate_this.py``
|
||||
instead of using the location of the Python interpreter to select the
|
||||
environment.
|
||||
|
||||
**Note:** you must run this after you've installed *any* packages into
|
||||
the environment. If you make an environment relocatable, then
|
||||
install a new package, you must run ``virtualenv --relocatable``
|
||||
again.
|
||||
|
||||
Also, this **does not make your packages cross-platform**. You can
|
||||
move the directory around, but it can only be used on other similar
|
||||
computers. Some known environmental differences that can cause
|
||||
incompatibilities: a different version of Python, when one platform
|
||||
uses UCS2 for its internal unicode representation and another uses
|
||||
UCS4 (a compile-time option), obvious platform changes like Windows
|
||||
vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C
|
||||
libraries on the system, if those C libraries are located somewhere
|
||||
different (either different versions, or a different filesystem
|
||||
layout).
|
||||
|
||||
Currently the ``--no-site-packages`` option will not be honored if you
|
||||
use this on an environment.
|
||||
|
||||
The ``--extra-search-dir`` Option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When it creates a new environment, virtualenv installs either
|
||||
setuptools or distribute, and pip. In normal operation, the latest
|
||||
releases of these packages are fetched from the `Python Package Index
|
||||
<http://pypi.python.org>`_ (PyPI). In some circumstances, this
|
||||
behavior may not be wanted, for example if you are using virtualenv
|
||||
during a deployment and do not want to depend on Internet access and
|
||||
PyPI availability.
|
||||
|
||||
As an alternative, you can provide your own versions of setuptools,
|
||||
distribute and/or pip on the filesystem, and tell virtualenv to use
|
||||
those distributions instead of downloading them from the Internet. To
|
||||
use this feature, pass one or more ``--extra-search-dir`` options to
|
||||
virtualenv like this::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions ENV
|
||||
|
||||
The ``/path/to/distributions`` path should point to a directory that
|
||||
contains setuptools, distribute and/or pip distributions. Setuptools
|
||||
distributions must be ``.egg`` files; distribute and pip distributions
|
||||
should be `.tar.gz` source distributions.
|
||||
|
||||
Virtualenv will still download these packages if no satisfactory local
|
||||
distributions are found.
|
||||
|
||||
If you are really concerned about virtualenv fetching these packages
|
||||
from the Internet and want to ensure that it never will, you can also
|
||||
provide an option ``--never-download`` like so::
|
||||
|
||||
$ virtualenv --extra-search-dir=/path/to/distributions --never-download ENV
|
||||
|
||||
If this option is provided, virtualenv will never try to download
|
||||
setuptools/distribute or pip. Instead, it will exit with status code 1
|
||||
if it fails to find local distributions for any of these required
|
||||
packages.
|
||||
|
||||
Compare & Contrast with Alternatives
|
||||
------------------------------------
|
||||
|
||||
There are several alternatives that create isolated environments:
|
||||
|
||||
* ``workingenv`` (which I do not suggest you use anymore) is the
|
||||
predecessor to this library. It used the main Python interpreter,
|
||||
but relied on setting ``$PYTHONPATH`` to activate the environment.
|
||||
This causes problems when running Python scripts that aren't part of
|
||||
the environment (e.g., a globally installed ``hg`` or ``bzr``). It
|
||||
also conflicted a lot with Setuptools.
|
||||
|
||||
* `virtual-python
|
||||
<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_
|
||||
is also a predecessor to this library. It uses only symlinks, so it
|
||||
couldn't work on Windows. It also symlinks over the *entire*
|
||||
standard library and global ``site-packages``. As a result, it
|
||||
won't see new additions to the global ``site-packages``.
|
||||
|
||||
This script only symlinks a small portion of the standard library
|
||||
into the environment, and so on Windows it is feasible to simply
|
||||
copy these files over. Also, it creates a new/empty
|
||||
``site-packages`` and also adds the global ``site-packages`` to the
|
||||
path, so updates are tracked separately. This script also installs
|
||||
Setuptools automatically, saving a step and avoiding the need for
|
||||
network access.
|
||||
|
||||
* `zc.buildout <http://pypi.python.org/pypi/zc.buildout>`_ doesn't
|
||||
create an isolated Python environment in the same style, but
|
||||
achieves similar results through a declarative config file that sets
|
||||
up scripts with very particular packages. As a declarative system,
|
||||
it is somewhat easier to repeat and manage, but more difficult to
|
||||
experiment with. ``zc.buildout`` includes the ability to setup
|
||||
non-Python systems (e.g., a database server or an Apache instance).
|
||||
|
||||
I *strongly* recommend anyone doing application development or
|
||||
deployment use one of these tools.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Refer to the `contributing to pip`_ documentation - it applies equally to
|
||||
virtualenv.
|
||||
|
||||
Virtualenv's release schedule is tied to pip's -- each time there's a new pip
|
||||
release, there will be a new virtualenv release that bundles the new version of
|
||||
pip.
|
||||
|
||||
.. _contributing to pip: http://www.pip-installer.org/en/latest/how-to-contribute.html
|
||||
|
||||
Running the tests
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Virtualenv's test suite is small and not yet at all comprehensive, but we aim
|
||||
to grow it.
|
||||
|
||||
The easy way to run tests (handles test dependencies automatically)::
|
||||
|
||||
$ python setup.py test
|
||||
|
||||
If you want to run only a selection of the tests, you'll need to run them
|
||||
directly with nose instead. Create a virtualenv, and install required
|
||||
packages::
|
||||
|
||||
$ pip install nose mock
|
||||
|
||||
Run nosetests::
|
||||
|
||||
$ nosetests
|
||||
|
||||
Or select just a single test file to run::
|
||||
|
||||
$ nosetests tests.test_virtualenv
|
||||
|
||||
|
||||
Other Documentation and Links
|
||||
-----------------------------
|
||||
|
||||
* James Gardner has written a tutorial on using `virtualenv with
|
||||
Pylons
|
||||
<http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox>`_.
|
||||
|
||||
* `Blog announcement
|
||||
<http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/>`_.
|
||||
|
||||
* Doug Hellmann wrote a description of his `command-line work flow
|
||||
using virtualenv (virtualenvwrapper)
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_
|
||||
including some handy scripts to make working with multiple
|
||||
environments easier. He also wrote `an example of using virtualenv
|
||||
to try IPython
|
||||
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html>`_.
|
||||
|
||||
* Chris Perkins created a `showmedo video including virtualenv
|
||||
<http://showmedo.com/videos/video?name=2910000&fromSeriesID=291>`_.
|
||||
|
||||
* `Using virtualenv with mod_wsgi
|
||||
<http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
|
||||
* `virtualenv commands
|
||||
<http://thisismedium.com/tech/extending-virtualenv/>`_ for some more
|
||||
workflow-related tools around virtualenv.
|
||||
|
||||
Changes & News
|
||||
--------------
|
||||
|
||||
Next release (1.7) schedule
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Beta release mid-July 2011, final release early August.
|
||||
|
||||
1.6.4 (2011-07-21)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python 2.4, too.
|
||||
|
||||
1.6.3 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Restored ability to run on Python < 2.7.
|
||||
|
||||
1.6.2 (2011-07-16)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Updated embedded distribute release to 0.6.19.
|
||||
|
||||
* Updated embedded pip release to 1.0.2.
|
||||
|
||||
* Fixed #141 - Be smarter about finding pkg_resources when using the
|
||||
non-default Python intepreter (by using the ``-p`` option).
|
||||
|
||||
* Fixed #112 - Fixed path in docs.
|
||||
|
||||
* Fixed #109 - Corrected doctests of a Logger method.
|
||||
|
||||
* Fixed #118 - Fixed creating virtualenvs on platforms that use the
|
||||
"posix_local" install scheme, such as Ubuntu with Python 2.7.
|
||||
|
||||
* Add missing library to Python 3 virtualenvs (``_dummy_thread``).
|
||||
|
||||
|
||||
1.6.1 (2011-04-30)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Start to use git-flow.
|
||||
|
||||
* Added support for PyPy 1.5
|
||||
|
||||
* Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
|
||||
|
||||
* Added progress meter for pip installation as well as setuptools. Thanks Ethan
|
||||
Jucovy.
|
||||
|
||||
* Added --never-download and --search-dir options. Thanks Ethan Jucovy.
|
||||
|
||||
1.6
|
||||
~~~
|
||||
|
||||
* Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
|
||||
|
||||
* Fixed creation of virtualenvs on Mac OS X when standard library modules
|
||||
(readline) are installed outside the standard library.
|
||||
|
||||
* Updated bundled pip to 1.0.
|
||||
|
||||
1.5.2
|
||||
~~~~~
|
||||
|
||||
* Moved main repository to Github: https://github.com/pypa/virtualenv
|
||||
|
||||
* Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer and Brian Rosner
|
||||
|
||||
* Fixed a few more pypy related bugs.
|
||||
|
||||
* Updated bundled pip to 0.8.2.
|
||||
|
||||
* Handed project over to new team of maintainers.
|
||||
|
||||
* Moved virtualenv to Github at https://github.com/pypa/virtualenv
|
||||
|
||||
1.5.1
|
||||
~~~~~
|
||||
|
||||
* Added ``_weakrefset`` requirement for Python 2.7.1.
|
||||
|
||||
* Fixed Windows regression in 1.5
|
||||
|
||||
1.5
|
||||
~~~
|
||||
|
||||
* Include pip 0.8.1.
|
||||
|
||||
* Add support for PyPy.
|
||||
|
||||
* Uses a proper temporary dir when installing environment requirements.
|
||||
|
||||
* Add ``--prompt`` option to be able to override the default prompt prefix.
|
||||
|
||||
* Fix an issue with ``--relocatable`` on Windows.
|
||||
|
||||
* Fix issue with installing the wrong version of distribute.
|
||||
|
||||
* Add fish and csh activate scripts.
|
||||
|
||||
1.4.9
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7.2
|
||||
|
||||
1.4.8
|
||||
~~~~~
|
||||
|
||||
* Fix for Mac OS X Framework builds that use
|
||||
``--universal-archs=intel``
|
||||
|
||||
* Fix ``activate_this.py`` on Windows.
|
||||
|
||||
* Allow ``$PYTHONHOME`` to be set, so long as you use ``source
|
||||
bin/activate`` it will get unset; if you leave it set and do not
|
||||
activate the environment it will still break the environment.
|
||||
|
||||
* Include pip 0.7.1
|
||||
|
||||
1.4.7
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.7
|
||||
|
||||
1.4.6
|
||||
~~~~~
|
||||
|
||||
* Allow ``activate.sh`` to skip updating the prompt (by setting
|
||||
``$VIRTUAL_ENV_DISABLE_PROMPT``).
|
||||
|
||||
1.4.5
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.3
|
||||
|
||||
* Fix ``activate.bat`` and ``deactivate.bat`` under Windows when
|
||||
``PATH`` contained a parenthesis
|
||||
|
||||
1.4.4
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.2 and Distribute 0.6.10
|
||||
|
||||
* Create the ``virtualenv`` script even when Setuptools isn't
|
||||
installed
|
||||
|
||||
* Fix problem with ``virtualenv --relocate`` when ``bin/`` has
|
||||
subdirectories (e.g., ``bin/.svn/``); from Alan Franzoni.
|
||||
|
||||
* If you set ``$VIRTUALENV_USE_DISTRIBUTE`` then virtualenv will use
|
||||
Distribute by default (so you don't have to remember to use
|
||||
``--distribute``).
|
||||
|
||||
1.4.3
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6.1
|
||||
|
||||
1.4.2
|
||||
~~~~~
|
||||
|
||||
* Fix pip installation on Windows
|
||||
|
||||
* Fix use of stand-alone ``virtualenv.py`` (and boot scripts)
|
||||
|
||||
* Exclude ~/.local (user site-packages) from environments when using
|
||||
``--no-site-packages``
|
||||
|
||||
1.4.1
|
||||
~~~~~
|
||||
|
||||
* Include pip 0.6
|
||||
|
||||
1.4
|
||||
~~~
|
||||
|
||||
* Updated setuptools to 0.6c11
|
||||
|
||||
* Added the --distribute option
|
||||
|
||||
* Fixed packaging problem of support-files
|
||||
|
||||
1.3.4
|
||||
~~~~~
|
||||
|
||||
* Virtualenv now copies the actual embedded Python binary on
|
||||
Mac OS X to fix a hang on Snow Leopard (10.6).
|
||||
|
||||
* Fail more gracefully on Windows when ``win32api`` is not installed.
|
||||
|
||||
* Fix site-packages taking precedent over Jython's ``__classpath__``
|
||||
and also specially handle the new ``__pyclasspath__`` entry in
|
||||
``sys.path``.
|
||||
|
||||
* Now copies Jython's ``registry`` file to the virtualenv if it exists.
|
||||
|
||||
* Better find libraries when compiling extensions on Windows.
|
||||
|
||||
* Create ``Scripts\pythonw.exe`` on Windows.
|
||||
|
||||
* Added support for the Debian/Ubuntu
|
||||
``/usr/lib/pythonX.Y/dist-packages`` directory.
|
||||
|
||||
* Set ``distutils.sysconfig.get_config_vars()['LIBDIR']`` (based on
|
||||
``sys.real_prefix``) which is reported to help building on Windows.
|
||||
|
||||
* Make ``deactivate`` work on ksh
|
||||
|
||||
* Fixes for ``--python``: make it work with ``--relocatable`` and the
|
||||
symlink created to the exact Python version.
|
||||
|
||||
1.3.3
|
||||
~~~~~
|
||||
|
||||
* Use Windows newlines in ``activate.bat``, which has been reported to help
|
||||
when using non-ASCII directory names.
|
||||
|
||||
* Fixed compatibility with Jython 2.5b1.
|
||||
|
||||
* Added a function ``virtualenv.install_python`` for more fine-grained
|
||||
access to what ``virtualenv.create_environment`` does.
|
||||
|
||||
* Fix `a problem <https://bugs.launchpad.net/virtualenv/+bug/241581>`_
|
||||
with Windows and paths that contain spaces.
|
||||
|
||||
* If ``/path/to/env/.pydistutils.cfg`` exists (or
|
||||
``/path/to/env/pydistutils.cfg`` on Windows systems) then ignore
|
||||
``~/.pydistutils.cfg`` and use that other file instead.
|
||||
|
||||
* Fix ` a problem
|
||||
<https://bugs.launchpad.net/virtualenv/+bug/340050>`_ picking up
|
||||
some ``.so`` libraries in ``/usr/local``.
|
||||
|
||||
1.3.2
|
||||
~~~~~
|
||||
|
||||
* Remove the ``[install] prefix = ...`` setting from the virtualenv
|
||||
``distutils.cfg`` -- this has been causing problems for a lot of
|
||||
people, in rather obscure ways.
|
||||
|
||||
* If you use a `boot script <./index.html#boot-script>`_ it will attempt to import ``virtualenv``
|
||||
and find a pre-downloaded Setuptools egg using that.
|
||||
|
||||
* Added platform-specific paths, like ``/usr/lib/pythonX.Y/plat-linux2``
|
||||
|
||||
1.3.1
|
||||
~~~~~
|
||||
|
||||
* Real Python 2.6 compatibility. Backported the Python 2.6 updates to
|
||||
``site.py``, including `user directories
|
||||
<http://docs.python.org/dev/whatsnew/2.6.html#pep-370-per-user-site-packages-directory>`_
|
||||
(this means older versions of Python will support user directories,
|
||||
whether intended or not).
|
||||
|
||||
* Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
|
||||
on some platforms where a system-wide ``distutils.cfg`` was present
|
||||
with a ``prefix`` setting, packages would be installed globally
|
||||
(usually in ``/usr/local/lib/pythonX.Y/site-packages``).
|
||||
|
||||
* Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
|
||||
workaround is added.
|
||||
|
||||
* Fix ``--python`` option.
|
||||
|
||||
* Fixed handling of Jython environments that use a
|
||||
jython-complete.jar.
|
||||
|
||||
1.3
|
||||
~~~
|
||||
|
||||
* Update to Setuptools 0.6c9
|
||||
* Added an option ``virtualenv --relocatable EXISTING_ENV``, which
|
||||
will make an existing environment "relocatable" -- the paths will
|
||||
not be absolute in scripts, ``.egg-info`` and ``.pth`` files. This
|
||||
may assist in building environments that can be moved and copied.
|
||||
You have to run this *after* any new packages installed.
|
||||
* Added ``bin/activate_this.py``, a file you can use like
|
||||
``execfile("path_to/activate_this.py",
|
||||
dict(__file__="path_to/activate_this.py"))`` -- this will activate
|
||||
the environment in place, similar to what `the mod_wsgi example
|
||||
does <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
|
||||
* For Mac framework builds of Python, the site-packages directory
|
||||
``/Library/Python/X.Y/site-packages`` is added to ``sys.path``, from
|
||||
Andrea Rech.
|
||||
* Some platform-specific modules in Macs are added to the path now
|
||||
(``plat-darwin/``, ``plat-mac/``, ``plat-mac/lib-scriptpackages``),
|
||||
from Andrea Rech.
|
||||
* Fixed a small Bashism in the ``bin/activate`` shell script.
|
||||
* Added ``__future__`` to the list of required modules, for Python
|
||||
2.3. You'll still need to backport your own ``subprocess`` module.
|
||||
* Fixed the ``__classpath__`` entry in Jython's ``sys.path`` taking
|
||||
precedent over virtualenv's libs.
|
||||
|
||||
1.2
|
||||
~~~
|
||||
|
||||
* Added a ``--python`` option to select the Python interpreter.
|
||||
* Add ``warnings`` to the modules copied over, for Python 2.6 support.
|
||||
* Add ``sets`` to the module copied over for Python 2.3 (though Python
|
||||
2.3 still probably doesn't work).
|
||||
|
||||
1.1.1
|
||||
~~~~~
|
||||
|
||||
* Added support for Jython 2.5.
|
||||
|
||||
1.1
|
||||
~~~
|
||||
|
||||
* Added support for Python 2.6.
|
||||
* Fix a problem with missing ``DLLs/zlib.pyd`` on Windows. Create
|
||||
* ``bin/python`` (or ``bin/python.exe``) even when you run virtualenv
|
||||
with an interpreter named, e.g., ``python2.4``
|
||||
* Fix MacPorts Python
|
||||
* Added --unzip-setuptools option
|
||||
* Update to Setuptools 0.6c8
|
||||
* If the current directory is not writable, run ez_setup.py in ``/tmp``
|
||||
* Copy or symlink over the ``include`` directory so that packages will
|
||||
more consistently compile.
|
||||
|
||||
1.0
|
||||
~~~
|
||||
|
||||
* Fix build on systems that use ``/usr/lib64``, distinct from
|
||||
``/usr/lib`` (specifically CentOS x64).
|
||||
* Fixed bug in ``--clear``.
|
||||
* Fixed typos in ``deactivate.bat``.
|
||||
* Preserve ``$PYTHONPATH`` when calling subprocesses.
|
||||
|
||||
0.9.2
|
||||
~~~~~
|
||||
|
||||
* Fix include dir copying on Windows (makes compiling possible).
|
||||
* Include the main ``lib-tk`` in the path.
|
||||
* Patch ``distutils.sysconfig``: ``get_python_inc`` and
|
||||
``get_python_lib`` to point to the global locations.
|
||||
* Install ``distutils.cfg`` before Setuptools, so that system
|
||||
customizations of ``distutils.cfg`` won't effect the installation.
|
||||
* Add ``bin/pythonX.Y`` to the virtualenv (in addition to
|
||||
``bin/python``).
|
||||
* Fixed an issue with Mac Framework Python builds, and absolute paths
|
||||
(from Ronald Oussoren).
|
||||
|
||||
0.9.1
|
||||
~~~~~
|
||||
|
||||
* Improve ability to create a virtualenv from inside a virtualenv.
|
||||
* Fix a little bug in ``bin/activate``.
|
||||
* Actually get ``distutils.cfg`` to work reliably.
|
||||
|
||||
0.9
|
||||
~~~
|
||||
|
||||
* Added ``lib-dynload`` and ``config`` to things that need to be
|
||||
copied over in an environment.
|
||||
* Copy over or symlink the ``include`` directory, so that you can
|
||||
build packages that need the C headers.
|
||||
* Include a ``distutils`` package, so you can locally update
|
||||
``distutils.cfg`` (in ``lib/pythonX.Y/distutils/distutils.cfg``).
|
||||
* Better avoid downloading Setuptools, and hitting PyPI on environment
|
||||
creation.
|
||||
* Fix a problem creating a ``lib64/`` directory.
|
||||
* Should work on MacOSX Framework builds (the default Python
|
||||
installations on Mac). Thanks to Ronald Oussoren.
|
||||
|
||||
0.8.4
|
||||
~~~~~
|
||||
|
||||
* Windows installs would sometimes give errors about ``sys.prefix`` that
|
||||
were inaccurate.
|
||||
* Slightly prettier output.
|
||||
|
||||
0.8.3
|
||||
~~~~~
|
||||
|
||||
* Added support for Windows.
|
||||
|
||||
0.8.2
|
||||
~~~~~
|
||||
|
||||
* Give a better warning if you are on an unsupported platform (Mac
|
||||
Framework Pythons, and Windows).
|
||||
* Give error about running while inside a workingenv.
|
||||
* Give better error message about Python 2.3.
|
||||
|
||||
0.8.1
|
||||
~~~~~
|
||||
|
||||
Fixed packaging of the library.
|
||||
|
||||
0.8
|
||||
~~~
|
||||
|
||||
Initial release. Everything is changed and new!
|
||||
|
||||
Keywords: setuptools deployment installation distutils
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.4
|
||||
Classifier: Programming Language :: Python :: 2.5
|
||||
Classifier: Programming Language :: Python :: 2.6
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.1
|
||||
Classifier: Programming Language :: Python :: 3.2
|
||||
@@ -1,21 +0,0 @@
|
||||
AUTHORS.txt
|
||||
LICENSE.txt
|
||||
MANIFEST.in
|
||||
setup.py
|
||||
virtualenv.py
|
||||
docs/index.txt
|
||||
docs/news.txt
|
||||
scripts/virtualenv
|
||||
virtualenv.egg-info/PKG-INFO
|
||||
virtualenv.egg-info/SOURCES.txt
|
||||
virtualenv.egg-info/dependency_links.txt
|
||||
virtualenv.egg-info/entry_points.txt
|
||||
virtualenv.egg-info/not-zip-safe
|
||||
virtualenv.egg-info/top_level.txt
|
||||
virtualenv_support/__init__.py
|
||||
virtualenv_support/distribute-0.6.19.tar.gz
|
||||
virtualenv_support/pip-1.0.2.tar.gz
|
||||
virtualenv_support/setuptools-0.6c11-py2.4.egg
|
||||
virtualenv_support/setuptools-0.6c11-py2.5.egg
|
||||
virtualenv_support/setuptools-0.6c11-py2.6.egg
|
||||
virtualenv_support/setuptools-0.6c11-py2.7.egg
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[console_scripts]
|
||||
virtualenv = virtualenv:main
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
virtualenv_support
|
||||
virtualenv
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,210 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
envoy.core
|
||||
~~~~~~~~~~
|
||||
|
||||
This module provides envoy awesomeness.
|
||||
|
||||
Copyright 2012, Kenneth Reitz.
|
||||
MIT Licensed.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
|
||||
__version__ = '0.0.2'
|
||||
__license__ = 'MIT'
|
||||
__author__ = 'Kenneth Reitz'
|
||||
|
||||
|
||||
class Command(object):
|
||||
def __init__(self, cmd):
|
||||
self.cmd = cmd
|
||||
self.process = None
|
||||
self.out = None
|
||||
self.err = None
|
||||
self.returncode = None
|
||||
self.data = None
|
||||
|
||||
def run(self, data, timeout, env):
|
||||
self.data = data
|
||||
environ = dict(os.environ).update(env or {})
|
||||
|
||||
def target():
|
||||
|
||||
self.process = subprocess.Popen(self.cmd,
|
||||
universal_newlines=True,
|
||||
shell=False,
|
||||
env=environ,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
bufsize=0,
|
||||
)
|
||||
|
||||
self.out, self.err = self.process.communicate(self.data)
|
||||
|
||||
thread = threading.Thread(target=target)
|
||||
thread.start()
|
||||
|
||||
thread.join(timeout)
|
||||
if thread.is_alive():
|
||||
self.process.terminate()
|
||||
thread.join()
|
||||
self.returncode = self.process.returncode
|
||||
return self.out, self.err
|
||||
|
||||
|
||||
class ConnectedCommand(object):
|
||||
def __init__(self,
|
||||
process=None,
|
||||
std_in=None,
|
||||
std_out=None,
|
||||
std_err=None):
|
||||
|
||||
self._process = process
|
||||
self.std_in = std_in
|
||||
self.std_out = std_out
|
||||
self.std_err = std_out
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
self.kill()
|
||||
|
||||
@property
|
||||
def status_code(self):
|
||||
"""The status code of the process.
|
||||
If the code is None, assume that it's still running.
|
||||
"""
|
||||
if self._status_code is not None:
|
||||
return self._status_code
|
||||
|
||||
# investigate
|
||||
return None
|
||||
|
||||
@property
|
||||
def pid(self):
|
||||
"""The process' PID."""
|
||||
return self._process.pid
|
||||
|
||||
def kill(self):
|
||||
"""Kills the process."""
|
||||
return self._process.kill()
|
||||
|
||||
def expect(self, bytes, stream=None):
|
||||
"""Block until given bytes appear in the stream."""
|
||||
if stream is None:
|
||||
stream = self.std_out
|
||||
pass
|
||||
|
||||
def send(self, end='\n'):
|
||||
"""Sends a line to std_in."""
|
||||
#TODO: Y U LINE BUFFER
|
||||
pass
|
||||
|
||||
def block(self):
|
||||
"""Blocks until command finishes. Returns Response instance."""
|
||||
self._status_code = self._process.wait()
|
||||
|
||||
|
||||
|
||||
class Response(object):
|
||||
"""A command's response"""
|
||||
|
||||
def __init__(self, process=None):
|
||||
super(Response, self).__init__()
|
||||
|
||||
self._process = process
|
||||
self.command = None
|
||||
self.std_err = None
|
||||
self.std_out = None
|
||||
self.status_code = None
|
||||
self.history = []
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
if len(self.command):
|
||||
return '<Response [{0}]>'.format(self.command[0])
|
||||
else:
|
||||
return '<Response>'
|
||||
|
||||
|
||||
def expand_args(command):
|
||||
"""Parses command strings and returns a Popen-ready list."""
|
||||
|
||||
# Prepare arguments.
|
||||
if isinstance(command, basestring):
|
||||
splitter = shlex.shlex(command, posix=True)
|
||||
splitter.whitespace = '|'
|
||||
splitter.whitespace_split = True
|
||||
command = []
|
||||
|
||||
while True:
|
||||
token = splitter.get_token()
|
||||
if token:
|
||||
command.append(token)
|
||||
else:
|
||||
break
|
||||
|
||||
command = map(shlex.split, command)
|
||||
|
||||
return command
|
||||
|
||||
|
||||
def run(command, data=None, timeout=None, env=None):
|
||||
"""Executes a given commmand and returns Response.
|
||||
|
||||
Blocks until process is complete, or timeout is reached.
|
||||
"""
|
||||
|
||||
command = expand_args(command)
|
||||
|
||||
history = []
|
||||
for c in command:
|
||||
|
||||
if history:
|
||||
# due to broken pipe problems pass only first 10MB
|
||||
data = history[-1].std_out[0:10*1024]
|
||||
|
||||
cmd = Command(c)
|
||||
out, err = cmd.run(data, timeout, env)
|
||||
|
||||
r = Response(process=cmd)
|
||||
|
||||
r.command = c
|
||||
r.std_out = out
|
||||
r.std_err = err
|
||||
r.status_code = cmd.returncode
|
||||
|
||||
history.append(r)
|
||||
|
||||
r = history.pop()
|
||||
r.history = history
|
||||
|
||||
return r
|
||||
|
||||
|
||||
def connect(command, data=None, env=None):
|
||||
"""Spawns a new process from the given command."""
|
||||
|
||||
# TODO: support piped commands
|
||||
command_str = expand_args(command).pop()
|
||||
environ = dict(os.environ).update(env or {})
|
||||
|
||||
process = subprocess.Popen(command_str,
|
||||
universal_newlines=True,
|
||||
shell=False,
|
||||
env=environ,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
bufsize=0,
|
||||
)
|
||||
|
||||
return ConnectedCommand(process=process)
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import envoy
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
|
||||
|
||||
|
||||
if sys.argv[-1] == "publish":
|
||||
os.system("python setup.py sdist upload")
|
||||
sys.exit()
|
||||
|
||||
required = []
|
||||
|
||||
setup(
|
||||
name='envoy',
|
||||
version=envoy.__version__,
|
||||
description='Simple API for running external processes.',
|
||||
author='Kenneth Reitz',
|
||||
author_email='me@kennethreitz.com',
|
||||
url='https://github.com/kennethreitz/envoy',
|
||||
py_modules= ['envoy'],
|
||||
install_requires=required,
|
||||
license='MIT',
|
||||
classifiers=(
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
'Natural Language :: English',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.5',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
# 'Programming Language :: Python :: 3.0',
|
||||
# 'Programming Language :: Python :: 3.1',
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
from django.core.management import execute_manager
|
||||
import imp
|
||||
try:
|
||||
imp.find_module('settings') # Assumed to be in the same directory.
|
||||
except ImportError:
|
||||
import sys
|
||||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
|
||||
sys.exit(1)
|
||||
|
||||
import settings
|
||||
|
||||
if __name__ == "__main__":
|
||||
execute_manager(settings)
|
||||
@@ -0,0 +1,145 @@
|
||||
# Django settings for haystack project.
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@example.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': '', # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# On Unix systems, a value of None will cause Django to use the same
|
||||
# timezone as the operating system.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'America/Chicago'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale
|
||||
USE_L10N = True
|
||||
|
||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||
# Example: "/home/media/media.lawrence.com/media/"
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
|
||||
# Absolute path to the directory static files should be collected to.
|
||||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/home/media/media.lawrence.com/static/"
|
||||
STATIC_ROOT = ''
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://media.lawrence.com/static/"
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||
# Make sure to use a trailing slash.
|
||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '@$87s&royz$nvav^3*$4u6^htybq*o=ge504rqp7r2)@ec*g(3'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'haystack.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
from django.conf.urls.defaults import patterns, include, url
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
# from django.contrib import admin
|
||||
# admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Examples:
|
||||
# url(r'^$', 'haystack.views.home', name='home'),
|
||||
# url(r'^haystack/', include('haystack.foo.urls')),
|
||||
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
|
||||
# Uncomment the next line to enable the admin:
|
||||
# url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
django==1.3
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,154 @@
|
||||
# Django settings for haystack project.
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@example.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': '', # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# On Unix systems, a value of None will cause Django to use the same
|
||||
# timezone as the operating system.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'America/Chicago'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale.
|
||||
USE_L10N = True
|
||||
|
||||
# If you set this to False, Django will not use timezone-aware datetimes.
|
||||
USE_TZ = True
|
||||
|
||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||
# Example: "/home/media/media.lawrence.com/media/"
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
|
||||
# Absolute path to the directory static files should be collected to.
|
||||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/home/media/media.lawrence.com/static/"
|
||||
STATIC_ROOT = ''
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://media.lawrence.com/static/"
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '633$+yuh67kvt_v8gpi9zmkvqb*m5nts6&a=q^dwhi+e#^j_ki'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
# Uncomment the next line for simple clickjacking protection:
|
||||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'haystack.urls'
|
||||
|
||||
# Python dotted path to the WSGI application used by Django's runserver.
|
||||
WSGI_APPLICATION = 'haystack.wsgi.application'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user