├── .gitignore ├── .travis.yml ├── Changelog.md ├── LICENSE ├── Makefile ├── Procfile ├── README.md ├── Readme.md ├── bin ├── compile ├── detect ├── nginx ├── nginx-cedar-14 ├── release ├── start-nginx ├── steps │ ├── collectstatic │ ├── hooks │ │ ├── post_compile │ │ └── pre_compile │ └── pylibmc ├── test └── utils ├── builds ├── README.md ├── libraries │ └── sqlite └── runtimes │ ├── python-2.7.6 │ └── python-3.4.0 ├── config ├── mime.types └── nginx.conf.erb ├── heroku.yml ├── parse_yml.sh ├── requirements.txt ├── scripts └── build_nginx.sh ├── test ├── distutils │ ├── envoy.py │ └── setup.py ├── django-1.3-skeleton │ ├── haystack │ │ ├── __init__.py │ │ ├── manage.py │ │ ├── settings.py │ │ └── urls.py │ └── requirements.txt ├── django-1.4-skeleton │ ├── haystack │ │ ├── .DS_Store │ │ ├── __init__.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── manage.py │ └── requirements.txt ├── django-1.5-skeleton │ ├── haystack │ │ ├── __init__.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── manage.py │ └── requirements.txt ├── empty-requirements │ └── requirements.txt ├── no-requirements │ └── setup.py ├── not-django │ ├── haystack │ │ └── settings.py │ ├── manage.py │ └── requirements.txt ├── not-python │ └── Gemfile ├── pylibmc │ └── requirements.txt ├── simple-requirements │ └── requirements.txt └── simple-runtime │ ├── requirements.txt │ └── runtime.txt └── vendor ├── bpwatch ├── bpwatch └── bpwatch.zip ├── pip-1.5.4 ├── AUTHORS.txt ├── CHANGES.txt ├── LICENSE.txt ├── MANIFEST.in ├── PKG-INFO ├── PROJECT.txt ├── README.rst ├── docs │ ├── configuration.rst │ ├── cookbook.rst │ ├── development.rst │ ├── distribute_setuptools.rst │ ├── index.rst │ ├── installing.rst │ ├── logic.rst │ ├── news.rst │ ├── quickstart.rst │ ├── reference │ │ ├── index.rst │ │ ├── pip.rst │ │ ├── pip_freeze.rst │ │ ├── pip_install.rst │ │ ├── pip_list.rst │ │ ├── pip_search.rst │ │ ├── pip_show.rst │ │ ├── pip_uninstall.rst │ │ └── pip_wheel.rst │ ├── usage.rst │ └── user_guide.rst ├── pip.egg-info │ ├── PKG-INFO │ ├── SOURCES.txt │ ├── dependency_links.txt │ ├── entry_points.txt │ ├── not-zip-safe │ ├── requires.txt │ └── top_level.txt ├── pip │ ├── __init__.py │ ├── __main__.py │ ├── _vendor │ │ ├── __init__.py │ │ ├── _markerlib │ │ │ ├── __init__.py │ │ │ └── markers.py │ │ ├── colorama │ │ │ ├── __init__.py │ │ │ ├── ansi.py │ │ │ ├── ansitowin32.py │ │ │ ├── initialise.py │ │ │ ├── win32.py │ │ │ └── winterm.py │ │ ├── distlib │ │ │ ├── __init__.py │ │ │ ├── _backport │ │ │ │ ├── __init__.py │ │ │ │ ├── misc.py │ │ │ │ ├── shutil.py │ │ │ │ ├── sysconfig.cfg │ │ │ │ ├── sysconfig.py │ │ │ │ └── tarfile.py │ │ │ ├── compat.py │ │ │ ├── database.py │ │ │ ├── index.py │ │ │ ├── locators.py │ │ │ ├── manifest.py │ │ │ ├── markers.py │ │ │ ├── metadata.py │ │ │ ├── resources.py │ │ │ ├── scripts.py │ │ │ ├── t32.exe │ │ │ ├── t64.exe │ │ │ ├── util.py │ │ │ ├── version.py │ │ │ ├── w32.exe │ │ │ ├── w64.exe │ │ │ └── wheel.py │ │ ├── html5lib │ │ │ ├── __init__.py │ │ │ ├── constants.py │ │ │ ├── filters │ │ │ │ ├── __init__.py │ │ │ │ ├── _base.py │ │ │ │ ├── alphabeticalattributes.py │ │ │ │ ├── inject_meta_charset.py │ │ │ │ ├── lint.py │ │ │ │ ├── optionaltags.py │ │ │ │ ├── sanitizer.py │ │ │ │ └── whitespace.py │ │ │ ├── html5parser.py │ │ │ ├── ihatexml.py │ │ │ ├── inputstream.py │ │ │ ├── sanitizer.py │ │ │ ├── serializer │ │ │ │ ├── __init__.py │ │ │ │ └── htmlserializer.py │ │ │ ├── tokenizer.py │ │ │ ├── treebuilders │ │ │ │ ├── __init__.py │ │ │ │ ├── _base.py │ │ │ │ ├── dom.py │ │ │ │ ├── etree.py │ │ │ │ └── etree_lxml.py │ │ │ ├── treewalkers │ │ │ │ ├── __init__.py │ │ │ │ ├── _base.py │ │ │ │ ├── dom.py │ │ │ │ ├── etree.py │ │ │ │ ├── genshistream.py │ │ │ │ ├── lxmletree.py │ │ │ │ └── pulldom.py │ │ │ ├── trie │ │ │ │ ├── __init__.py │ │ │ │ ├── _base.py │ │ │ │ ├── datrie.py │ │ │ │ └── py.py │ │ │ └── utils.py │ │ ├── pkg_resources.py │ │ ├── re-vendor.py │ │ ├── requests │ │ │ ├── __init__.py │ │ │ ├── adapters.py │ │ │ ├── api.py │ │ │ ├── auth.py │ │ │ ├── cacert.pem │ │ │ ├── certs.py │ │ │ ├── compat.py │ │ │ ├── cookies.py │ │ │ ├── exceptions.py │ │ │ ├── hooks.py │ │ │ ├── models.py │ │ │ ├── packages │ │ │ │ ├── __init__.py │ │ │ │ ├── charade │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── __main__.py │ │ │ │ │ ├── big5freq.py │ │ │ │ │ ├── big5prober.py │ │ │ │ │ ├── chardistribution.py │ │ │ │ │ ├── charsetgroupprober.py │ │ │ │ │ ├── charsetprober.py │ │ │ │ │ ├── codingstatemachine.py │ │ │ │ │ ├── compat.py │ │ │ │ │ ├── constants.py │ │ │ │ │ ├── cp949prober.py │ │ │ │ │ ├── escprober.py │ │ │ │ │ ├── escsm.py │ │ │ │ │ ├── eucjpprober.py │ │ │ │ │ ├── euckrfreq.py │ │ │ │ │ ├── euckrprober.py │ │ │ │ │ ├── euctwfreq.py │ │ │ │ │ ├── euctwprober.py │ │ │ │ │ ├── gb2312freq.py │ │ │ │ │ ├── gb2312prober.py │ │ │ │ │ ├── hebrewprober.py │ │ │ │ │ ├── jisfreq.py │ │ │ │ │ ├── jpcntx.py │ │ │ │ │ ├── langbulgarianmodel.py │ │ │ │ │ ├── langcyrillicmodel.py │ │ │ │ │ ├── langgreekmodel.py │ │ │ │ │ ├── langhebrewmodel.py │ │ │ │ │ ├── langhungarianmodel.py │ │ │ │ │ ├── langthaimodel.py │ │ │ │ │ ├── latin1prober.py │ │ │ │ │ ├── mbcharsetprober.py │ │ │ │ │ ├── mbcsgroupprober.py │ │ │ │ │ ├── mbcssm.py │ │ │ │ │ ├── sbcharsetprober.py │ │ │ │ │ ├── sbcsgroupprober.py │ │ │ │ │ ├── sjisprober.py │ │ │ │ │ ├── universaldetector.py │ │ │ │ │ └── utf8prober.py │ │ │ │ ├── chardet │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── big5freq.py │ │ │ │ │ ├── big5prober.py │ │ │ │ │ ├── chardetect.py │ │ │ │ │ ├── chardistribution.py │ │ │ │ │ ├── charsetgroupprober.py │ │ │ │ │ ├── charsetprober.py │ │ │ │ │ ├── codingstatemachine.py │ │ │ │ │ ├── compat.py │ │ │ │ │ ├── constants.py │ │ │ │ │ ├── cp949prober.py │ │ │ │ │ ├── escprober.py │ │ │ │ │ ├── escsm.py │ │ │ │ │ ├── eucjpprober.py │ │ │ │ │ ├── euckrfreq.py │ │ │ │ │ ├── euckrprober.py │ │ │ │ │ ├── euctwfreq.py │ │ │ │ │ ├── euctwprober.py │ │ │ │ │ ├── gb2312freq.py │ │ │ │ │ ├── gb2312prober.py │ │ │ │ │ ├── hebrewprober.py │ │ │ │ │ ├── jisfreq.py │ │ │ │ │ ├── jpcntx.py │ │ │ │ │ ├── langbulgarianmodel.py │ │ │ │ │ ├── langcyrillicmodel.py │ │ │ │ │ ├── langgreekmodel.py │ │ │ │ │ ├── langhebrewmodel.py │ │ │ │ │ ├── langhungarianmodel.py │ │ │ │ │ ├── langthaimodel.py │ │ │ │ │ ├── latin1prober.py │ │ │ │ │ ├── mbcharsetprober.py │ │ │ │ │ ├── mbcsgroupprober.py │ │ │ │ │ ├── mbcssm.py │ │ │ │ │ ├── sbcharsetprober.py │ │ │ │ │ ├── sbcsgroupprober.py │ │ │ │ │ ├── sjisprober.py │ │ │ │ │ ├── universaldetector.py │ │ │ │ │ └── utf8prober.py │ │ │ │ └── urllib3 │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── _collections.py │ │ │ │ │ ├── connection.py │ │ │ │ │ ├── connectionpool.py │ │ │ │ │ ├── contrib │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ntlmpool.py │ │ │ │ │ └── pyopenssl.py │ │ │ │ │ ├── exceptions.py │ │ │ │ │ ├── fields.py │ │ │ │ │ ├── filepost.py │ │ │ │ │ ├── packages │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ordered_dict.py │ │ │ │ │ ├── six.py │ │ │ │ │ └── ssl_match_hostname │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── _implementation.py │ │ │ │ │ ├── poolmanager.py │ │ │ │ │ ├── request.py │ │ │ │ │ ├── response.py │ │ │ │ │ └── util.py │ │ │ ├── sessions.py │ │ │ ├── status_codes.py │ │ │ ├── structures.py │ │ │ └── utils.py │ │ └── six.py │ ├── backwardcompat │ │ └── __init__.py │ ├── basecommand.py │ ├── baseparser.py │ ├── cmdoptions.py │ ├── commands │ │ ├── __init__.py │ │ ├── bundle.py │ │ ├── completion.py │ │ ├── freeze.py │ │ ├── help.py │ │ ├── install.py │ │ ├── list.py │ │ ├── search.py │ │ ├── show.py │ │ ├── uninstall.py │ │ ├── unzip.py │ │ ├── wheel.py │ │ └── zip.py │ ├── download.py │ ├── exceptions.py │ ├── index.py │ ├── locations.py │ ├── log.py │ ├── pep425tags.py │ ├── req.py │ ├── runner.py │ ├── status_codes.py │ ├── util.py │ ├── vcs │ │ ├── __init__.py │ │ ├── bazaar.py │ │ ├── git.py │ │ ├── mercurial.py │ │ └── subversion.py │ └── wheel.py ├── setup.cfg └── setup.py ├── setuptools-2.1 ├── CHANGES (links).txt ├── CHANGES.txt ├── CONTRIBUTORS.txt ├── DEVGUIDE.txt ├── MANIFEST.in ├── PKG-INFO ├── README.txt ├── _markerlib │ ├── __init__.py │ └── markers.py ├── docs │ ├── Makefile │ ├── _templates │ │ └── indexsidebar.html │ ├── _theme │ │ └── nature │ │ │ ├── static │ │ │ ├── nature.css_t │ │ │ └── pygments.css │ │ │ └── theme.conf │ ├── conf.py │ ├── development.txt │ ├── easy_install.txt │ ├── formats.txt │ ├── index.txt │ ├── merge-faq.txt │ ├── merge.txt │ ├── pkg_resources.txt │ ├── python3.txt │ ├── releases.txt │ ├── roadmap.txt │ ├── setuptools.txt │ └── using.txt ├── easy_install.py ├── ez_setup.py ├── launcher.c ├── pkg_resources.py ├── release.py ├── setup.cfg ├── setup.py ├── setuptools.egg-info │ ├── PKG-INFO │ ├── SOURCES.txt │ ├── dependency_links.txt │ ├── entry_points.txt │ ├── entry_points.txt.orig │ ├── requires.txt │ ├── requires.txt.orig │ ├── top_level.txt │ └── zip-safe ├── setuptools │ ├── __init__.py │ ├── archive_util.py │ ├── cli-32.exe │ ├── cli-64.exe │ ├── cli-arm-32.exe │ ├── cli.exe │ ├── command │ │ ├── __init__.py │ │ ├── alias.py │ │ ├── bdist_egg.py │ │ ├── bdist_rpm.py │ │ ├── bdist_wininst.py │ │ ├── build_ext.py │ │ ├── build_py.py │ │ ├── develop.py │ │ ├── easy_install.py │ │ ├── egg_info.py │ │ ├── install.py │ │ ├── install_egg_info.py │ │ ├── install_lib.py │ │ ├── install_scripts.py │ │ ├── launcher manifest.xml │ │ ├── register.py │ │ ├── rotate.py │ │ ├── saveopts.py │ │ ├── sdist.py │ │ ├── setopt.py │ │ ├── test.py │ │ └── upload_docs.py │ ├── compat.py │ ├── depends.py │ ├── dist.py │ ├── extension.py │ ├── gui-32.exe │ ├── gui-64.exe │ ├── gui-arm-32.exe │ ├── gui.exe │ ├── lib2to3_ex.py │ ├── package_index.py │ ├── py26compat.py │ ├── py27compat.py │ ├── py31compat.py │ ├── sandbox.py │ ├── script template (dev).py │ ├── script template.py │ ├── site-patch.py │ ├── ssl_support.py │ ├── svn_utils.py │ ├── tests │ │ ├── __init__.py │ │ ├── doctest.py │ │ ├── entries-v10 │ │ ├── environment.py │ │ ├── indexes │ │ │ └── test_links_priority │ │ │ │ ├── external.html │ │ │ │ └── simple │ │ │ │ └── foobar │ │ │ │ └── index.html │ │ ├── py26compat.py │ │ ├── script-with-bom.py │ │ ├── server.py │ │ ├── svn_data │ │ │ ├── dummy.zip │ │ │ ├── dummy13.zip │ │ │ ├── dummy14.zip │ │ │ ├── dummy15.zip │ │ │ ├── dummy16.zip │ │ │ ├── dummy17.zip │ │ │ ├── dummy18.zip │ │ │ ├── svn13_example.zip │ │ │ ├── svn13_ext_list.txt │ │ │ ├── svn13_ext_list.xml │ │ │ ├── svn13_info.xml │ │ │ ├── svn14_example.zip │ │ │ ├── svn14_ext_list.txt │ │ │ ├── svn14_ext_list.xml │ │ │ ├── svn14_info.xml │ │ │ ├── svn15_example.zip │ │ │ ├── svn15_ext_list.txt │ │ │ ├── svn15_ext_list.xml │ │ │ ├── svn15_info.xml │ │ │ ├── svn16_example.zip │ │ │ ├── svn16_ext_list.txt │ │ │ ├── svn16_ext_list.xml │ │ │ ├── svn16_info.xml │ │ │ ├── svn17_example.zip │ │ │ ├── svn17_ext_list.txt │ │ │ ├── svn17_ext_list.xml │ │ │ ├── svn17_info.xml │ │ │ ├── svn18_example.zip │ │ │ ├── svn18_ext_list.txt │ │ │ ├── svn18_ext_list.xml │ │ │ └── svn18_info.xml │ │ ├── test_bdist_egg.py │ │ ├── test_build_ext.py │ │ ├── test_develop.py │ │ ├── test_dist_info.py │ │ ├── test_easy_install.py │ │ ├── test_egg_info.py │ │ ├── test_markerlib.py │ │ ├── test_packageindex.py │ │ ├── test_resources.py │ │ ├── test_sandbox.py │ │ ├── test_sdist.py │ │ ├── test_svn.py │ │ ├── test_test.py │ │ ├── test_upload_docs.py │ │ └── win_script_wrapper.txt │ └── version.py └── tests │ ├── api_tests.txt │ ├── manual_test.py │ ├── shlib_test │ ├── hello.c │ ├── hello.pyx │ ├── hellolib.c │ ├── setup.py │ └── test_hello.py │ ├── test_ez_setup.py │ └── test_pkg_resources.py ├── shunit2 └── test-utils /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | site 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - 2.7 4 | script: make tests 5 | notifications: 6 | email: false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License: 2 | 3 | Copyright (C) 2013 Heroku, Inc. 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # These targets are not files 2 | .PHONY: tests 3 | 4 | tests: 5 | ./bin/test 6 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: scripts/build_nginx.sh 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A better heroku python buildpack 2 | -------------------------------- 3 | 4 | Heroku has a [Python buildpack](https://github.com/heroku/heroku-buildpack-python) but it is a suboptimal in some ways. 5 | 6 | 1. [Gunicorn directly behind heroku router is succeptible to a ddos attack.](http://blog.etianen.com/blog/2014/01/19/gunicorn-heroku-django/) 7 | 2. The recommended static file server is [static](https://pypi.python.org/pypi/static). Which is a bit of cop out. Something like nginx is much better suited for this. 8 | 3. In search for Heroku's no configuration deploys, it doesn't allow setting things like the location of manage.py explicitly. To find the manage.py the buildpack is doing "MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)". This goes against "explicit is better tha implicit" and will mean that different manage.py will be found in different heroku deploys. 9 | 10 | What this does 11 | ---------------- 12 | 13 | To workaround this 14 | 15 | 1. The buildpack installs nginx, and gunicorn is used behind nginx. 16 | 2. Static files are served via nginx 17 | 3. It takes a heroku.yml file which allows overriding the location of `manage.py` and `requirements.txt` 18 | 19 | Some other benefits you get with this 20 | 21 | 1. Since you have nginx, you can take take advantage of nginx tooling. In particular, the bundled nginx comes with pagespeed enabled, which can make a signifcant impact to your forntend performance. 22 | 2. You can use nginx to do rewrites. (For example to force ssl only). 23 | 3. You can host things like sphinx docs in a folder, and serve it directly from nginx. 24 | 25 | Inspirations 26 | ------------- 27 | 28 | 1. [Heroku buildpack multi](https://github.com/ddollar/heroku-buildpack-multi) 29 | 2. [Nginx buildpack](https://github.com/ryandotsmith/nginx-buildpack) 30 | 31 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | A better heroku python buildpack 2 | -------------------------------- 3 | 4 | Heroku has a [Python buildpack](https://github.com/heroku/heroku-buildpack-python) but it is a suboptimal in some ways. 5 | 6 | 1. [Gunicorn directly behind heroku router is succeptible to a ddos attack.](http://blog.etianen.com/blog/2014/01/19/gunicorn-heroku-django/) 7 | 2. The recommended static file server is [static](https://pypi.python.org/pypi/static). Which is a bit of cop out. Something like nginx is much better suited for this. 8 | 3. In search for Heroku's no configuration deploys, it doesn't allow setting things like the location of manage.py explicitly. To find the manage.py the buildpack is doing "MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)". This goes against "explicit is better tha implicit" and will mean that different manage.py will be found in different heroku deploys. 9 | 10 | What this does 11 | ---------------- 12 | 13 | To workaround this 14 | 15 | 1. The buildpack installs nginx, and gunicorn is used behind nginx. 16 | 2. Static files are served via nginx 17 | 3. It takes a heroku.yml file which allows overriding the location of `manage.py` and `requirements.txt` 18 | 19 | Some other benefits you get with this 20 | 21 | 1. Since you have nginx, you can take take advantage of nginx tooling. In particular, the bundled nginx comes with pagespeed enabled, which can make a signifcant impact to your forntend performance. 22 | 2. You can use nginx to do rewrites. (For example to force ssl only). 23 | 3. You can host things like sphinx docs in a folder, and serve it directly from nginx. 24 | 25 | Inspirations 26 | ------------- 27 | 28 | 1. [Heroku buildpack multi](https://github.com/ddollar/heroku-buildpack-multi) 29 | 2. [Nginx buildpack](https://github.com/ryandotsmith/nginx-buildpack) 30 | 31 | -------------------------------------------------------------------------------- /bin/detect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # detector. 6 | # 7 | # A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | 10 | # ## Usage 11 | # Compiling an app into a slug is simple: 12 | # 13 | # $ bin/detect 14 | 15 | # Read heroku.yml 16 | BIN_DIR=$(cd $(dirname $0); pwd) # absolute path 17 | ROOT_DIR=$(dirname $BIN_DIR) 18 | BUILD_DIR=$1 19 | 20 | source $ROOT_DIR/parse_yml.sh 21 | 22 | eval $(parse_yaml $BUILD_DIR/heroku.yml) 23 | 24 | if [[ -z ${REQUIREMENTS_PATH} ]]; 25 | then REQUIREMENTS_PATH='requirements.txt'; 26 | fi 27 | 28 | # Exit early if app is clearly not Python. 29 | if [ ! -f $BUILD_DIR/$REQUIREMENTS_PATH ] && [ ! -f $BUILD_DIR/setup.py ]; then 30 | exit 1 31 | fi 32 | 33 | echo 'Python nginx-buildpack' 34 | 35 | exit 0 36 | -------------------------------------------------------------------------------- /bin/nginx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/bin/nginx -------------------------------------------------------------------------------- /bin/nginx-cedar-14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/bin/nginx-cedar-14 -------------------------------------------------------------------------------- /bin/release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # bin/release 3 | 4 | BIN_DIR=$(cd $(dirname $0); pwd) # absolute path 5 | BUILD_DIR=$1 6 | 7 | MANAGE_FILE=$(cd $BUILD_DIR && find . -maxdepth 3 -type f -name 'manage.py' | head -1) 8 | MANAGE_FILE=${MANAGE_FILE:2} 9 | 10 | cat < /app/config/nginx.conf 9 | 10 | n=1 11 | while getopts :f option ${@:1:2} 12 | do 13 | case "${option}" 14 | in 15 | f) FORCE=$OPTIND; n=$((n+1));; 16 | esac 17 | done 18 | 19 | #Start log redirection. 20 | ( 21 | #Initialize log directory. 22 | mkdir -p /app/logs/nginx 23 | touch /app/logs/nginx/access.log /app/logs/nginx/error.log 24 | #Redirect NGINX logs to stdout. 25 | echo 'buildpack=nginx at=logs-initialized' 26 | tail -qF -n 0 logs/nginx/*.log 27 | echo 'logs' >$psmgr 28 | ) & 29 | 30 | #Start App Server 31 | ( 32 | #Take the command passed to this bin and start it. 33 | #E.g. bin/start-nginx bundle exec unicorn -c config/unicorn.rb 34 | COMMAND=${@:$n} 35 | echo "buildpack=nginx at=start-app cmd=$COMMAND" 36 | $COMMAND 37 | echo 'app' >$psmgr 38 | ) & 39 | 40 | if [[ -z "$FORCE" ]] 41 | then 42 | FILE="/tmp/app-initialized" 43 | 44 | #We block on app-initialized so that when NGINX binds to $PORT 45 | #are app is ready for traffic. 46 | while [[ ! -f "$FILE" ]] 47 | do 48 | echo 'buildpack=nginx at=app-initialization' 49 | sleep 1 50 | done 51 | echo 'buildpack=nginx at=app-initialized' 52 | fi 53 | 54 | 55 | #Start NGINX 56 | ( 57 | #We expect nginx to run in foreground. 58 | #We also expect a socket to be at /tmp/nginx.socket. 59 | echo 'buildpack=nginx at=nginx-start' 60 | bin/nginx -p . -c /app/config/nginx.conf 61 | echo 'nginx' >$psmgr 62 | ) & 63 | 64 | #This read will block the process waiting on a msg to be put into the fifo. 65 | #If any of the processes defined above should exit, 66 | #a msg will be put into the fifo causing the read operation 67 | #to un-block. The process putting the msg into the fifo 68 | #will use it's process name as a msg so that we can print the offending 69 | #process to stdout. 70 | read exit_process <$psmgr 71 | echo "buildpack=nginx at=exit process=$exit_process" 72 | exit 1 73 | -------------------------------------------------------------------------------- /bin/steps/collectstatic: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source $BIN_DIR/utils 4 | 5 | # access yaml content 6 | MANAGE_FILE=$MANAGE_FILE_PATH 7 | MANAGE_FILE=${MANAGE_FILE:-fakepath} 8 | 9 | echo "-----> Given path to manage.py $MANAGE_FILE" 10 | 11 | [ -f .heroku/collectstatic_disabled ] && DISABLE_COLLECTSTATIC=1 12 | 13 | if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ]; then 14 | set +e 15 | 16 | echo "-----> Preparing static assets" 17 | # Check if collectstatic is configured properly. 18 | python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true 19 | 20 | # Compile assets if collectstatic appears to be kosher. 21 | if [ "$RUN_COLLECTSTATIC" ]; then 22 | 23 | echo " Running collectstatic..." 24 | python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent 25 | 26 | [ $? -ne 0 ] && { 27 | echo " ! Error running 'manage.py collectstatic'. More info:" 28 | echo " http://devcenter.heroku.com/articles/django-assets" 29 | } 30 | else 31 | echo " Collectstatic configuration error. To debug, run:" 32 | echo " $ heroku run python $MANAGE_FILE collectstatic --noinput" 33 | fi 34 | 35 | echo 36 | 37 | 38 | fi 39 | 40 | -------------------------------------------------------------------------------- /bin/steps/hooks/post_compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f bin/post_compile ]; then 4 | echo "-----> Running post-compile hook" 5 | chmod +x bin/post_compile 6 | sub-env bin/post_compile 7 | fi -------------------------------------------------------------------------------- /bin/steps/hooks/pre_compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f bin/pre_compile ]; then 4 | echo "-----> Running pre-compile hook" 5 | chmod +x bin/pre_compile 6 | sub-env bin/pre_compile 7 | fi -------------------------------------------------------------------------------- /bin/steps/pylibmc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as the Pylibmc build step of the 4 | # [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python) 5 | # compiler. 6 | # 7 | # A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an 8 | # adapter between a Python application and Heroku's runtime. 9 | # 10 | # This script is invoked by [`bin/compile`](/). 11 | 12 | # The location of the pre-compiled libmemcached binary. 13 | VENDORED_MEMCACHED="http://cl.ly/0a191R3K160t1w1P0N25/vendor-libmemcached.tar.gz" 14 | 15 | # Syntax sugar. 16 | source $BIN_DIR/utils 17 | 18 | # If pylibmc exists within requirements, use vendored libmemcached. 19 | if (grep -Eiq "^\s*pylibmc" requirements.txt) then 20 | echo "-----> Noticed pylibmc. Bootstrapping libmemcached." 21 | cd .heroku 22 | 23 | if [ -d "vendor/lib/sasl2" ]; then 24 | export LIBMEMCACHED=$(pwd)/vendor 25 | else 26 | # Download and extract libmemcached into target vendor directory. 27 | curl -s -L -o tmp-libmemcached.tar.gz $VENDORED_MEMCACHED 28 | tar -zxvf tmp-libmemcached.tar.gz > /dev/null 29 | rm tmp-libmemcached.tar.gz 30 | export LIBMEMCACHED=$(pwd)/vendor 31 | fi 32 | 33 | export LIBMEMCACHED=$(pwd)/vendor 34 | cd .. 35 | fi 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /bin/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Create a Heroku app with the following buildpack: 5 | # https://github.com/ddollar/buildpack-test 6 | # 7 | # Push this Python buildpack to that Heroku app to 8 | # run the tests. 9 | # 10 | 11 | testDetectWithReqs() { 12 | detect "simple-requirements" 13 | assertCapturedEquals "Python" 14 | assertCapturedSuccess 15 | } 16 | 17 | testDetectWithEmptyReqs() { 18 | detect "empty-requirements" 19 | assertCapturedEquals "Python" 20 | assertCapturedSuccess 21 | } 22 | 23 | testDetectDjango15() { 24 | detect "django-1.5-skeleton" 25 | assertCapturedEquals "Python" 26 | assertCapturedSuccess 27 | } 28 | 29 | testDetectDjango14() { 30 | detect "django-1.4-skeleton" 31 | assertCapturedEquals "Python" 32 | assertCapturedSuccess 33 | } 34 | 35 | testDetectDjango13() { 36 | detect "django-1.3-skeleton" 37 | assertCapturedEquals "Python" 38 | assertCapturedSuccess 39 | } 40 | 41 | testDetectNotDjangoWithSettings() { 42 | detect "not-django" 43 | assertCapturedEquals "Python" 44 | assertCapturedSuccess 45 | } 46 | 47 | testDetectWithSetupPy() { 48 | detect "distutils" 49 | assertCapturedEquals "Python" 50 | assertCapturedSuccess 51 | } 52 | 53 | testDetectWithSetupRequires() { 54 | detect "no-requirements" 55 | assertCapturedEquals "Python" 56 | assertCapturedSuccess 57 | } 58 | 59 | testDetectNotPython() { 60 | detect "not-python" 61 | assertNotCaptured "Python" 62 | assertEquals "1" "${RETURN}" 63 | } 64 | 65 | 66 | ## utils ######################################## 67 | 68 | pushd $(dirname 0) >/dev/null 69 | BASE=$(pwd) 70 | popd >/dev/null 71 | 72 | source ${BASE}/vendor/test-utils 73 | 74 | detect() { 75 | capture ${BASE}/bin/detect ${BASE}/test/$1 76 | } 77 | 78 | compile() { 79 | capture ${BASE}/bin/compile ${BASE}/test/$1 80 | } 81 | 82 | source ${BASE}/vendor/shunit2 83 | 84 | -------------------------------------------------------------------------------- /bin/utils: -------------------------------------------------------------------------------- 1 | shopt -s extglob 2 | 3 | if [ $(uname) == Darwin ]; then 4 | sed() { command sed -l "$@"; } 5 | else 6 | sed() { command sed -u "$@"; } 7 | fi 8 | 9 | # Syntax sugar. 10 | indent() { 11 | sed "s/^/ /" 12 | } 13 | 14 | # Clean up pip output 15 | cleanup() { 16 | 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' 17 | } 18 | 19 | # Buildpack Steps. 20 | puts-step() { 21 | echo "-----> $@" 22 | } 23 | 24 | # Buildpack Warnings. 25 | puts-warn() { 26 | echo " ! $@" 27 | } 28 | 29 | # Usage: $ set-env key value 30 | set-env() { 31 | echo "export $1=$2" >> $PROFILE_PATH 32 | } 33 | 34 | # Usage: $ set-default-env key value 35 | set-default-env() { 36 | echo "export $1=\${$1:-$2}" >> $PROFILE_PATH 37 | } 38 | 39 | # Usage: $ set-default-env key value 40 | un-set-env() { 41 | echo "unset $1" >> $PROFILE_PATH 42 | } 43 | 44 | # Does some serious copying. 45 | deep-cp() { 46 | declare source="$1" target="$2" 47 | 48 | mkdir -p "$target" 49 | 50 | # cp doesn't like being called without source params, 51 | # so make sure they expand to something first. 52 | # subshell to avoid surprising caller with shopts. 53 | ( 54 | shopt -s nullglob dotglob 55 | set -- "$source"/!(tmp|.|..) 56 | [[ $# == 0 ]] || cp -a "$@" "$target" 57 | ) 58 | } 59 | 60 | # Does some serious moving. 61 | deep-mv() { 62 | deep-cp "$1" "$2" 63 | deep-rm "$1" 64 | } 65 | 66 | # Does some serious deleting. 67 | deep-rm() { 68 | # subshell to avoid surprising caller with shopts. 69 | ( 70 | shopt -s dotglob 71 | rm -rf "$1"/!(tmp|.|..) 72 | ) 73 | } 74 | 75 | 76 | sub-env() { 77 | 78 | WHITELIST=${2:-''} 79 | BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'} 80 | 81 | ( 82 | if [ -d "$ENV_DIR" ]; then 83 | for e in $(ls $ENV_DIR); do 84 | echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" && 85 | export "$e=$(cat $ENV_DIR/$e)" 86 | : 87 | done 88 | fi 89 | 90 | $1 91 | 92 | ) 93 | } 94 | -------------------------------------------------------------------------------- /builds/README.md: -------------------------------------------------------------------------------- 1 | # Python Buildpack Binaries 2 | 3 | 4 | To get started with it, create an app on Heroku inside a clone of this repository, and set your S3 config vars: 5 | 6 | $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-python#not-heroku 7 | $ heroku config:set WORKSPACE_DIR=builds 8 | $ heroku config:set AWS_ACCESS_KEY_ID= 9 | $ heroku config:set AWS_SECRET_ACCESS_KEY= 10 | $ heroku config:set S3_BUCKET= 11 | 12 | 13 | Then, shell into an instance and run a build by giving the name of the formula inside `builds`: 14 | 15 | $ heroku run bash 16 | Running `bash` attached to terminal... up, run.6880 17 | ~ $ bob build runtimes/python-2.7.6 18 | 19 | Fetching dependencies... found 2: 20 | - libraries/sqlite 21 | 22 | Building formula runtimes/python-2.7.6: 23 | === Building Python 2.7.6 24 | Fetching Python v2.7.6 source... 25 | Compiling... 26 | 27 | If this works, run `bob deploy` instead of `bob build` to have the result uploaded to S3 for you. 28 | 29 | To speed things up drastically, it'll usually be a good idea to `heroku run bash --size PX` instead. 30 | 31 | Enjoy :) -------------------------------------------------------------------------------- /builds/libraries/sqlite: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Build Path: /app/.heroku/python/ 3 | 4 | OUT_PREFIX=$1 5 | 6 | echo "Building SQLite..." 7 | 8 | 9 | SOURCE_TARBALL='http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz' 10 | 11 | curl $SOURCE_TARBALL | tar xz 12 | # jx 13 | mv sqlite-autoconf-3070900 sqlite 14 | 15 | cd sqlite 16 | ./configure --prefix=$OUT_PREFIX 17 | make 18 | make install 19 | 20 | # Cleanup 21 | cd .. 22 | rm -fr sqlite 23 | -------------------------------------------------------------------------------- /builds/runtimes/python-2.7.6: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Build Path: /app/.heroku/python/ 3 | # Build Deps: libraries/sqlite 4 | 5 | OUT_PREFIX=$1 6 | 7 | echo "Building Python..." 8 | SOURCE_TARBALL='http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz' 9 | curl -L $SOURCE_TARBALL | tar xz 10 | mv Python-2.7.6 src 11 | cd src 12 | 13 | ./configure --prefix=$OUT_PREFIX 14 | make 15 | make install 16 | -------------------------------------------------------------------------------- /builds/runtimes/python-3.4.0: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Build Path: /app/.heroku/python/ 3 | # Build Deps: libraries/sqlite 4 | 5 | OUT_PREFIX=$1 6 | 7 | echo "Building Python..." 8 | SOURCE_TARBALL='http://python.org/ftp/python/3.4.0/Python-3.4.0.tgz' 9 | curl -L $SOURCE_TARBALL | tar xz 10 | mv Python-3.4.0 src 11 | cd src 12 | 13 | ./configure --prefix=$OUT_PREFIX --with-ensurepip=no 14 | make 15 | make install 16 | 17 | ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python 18 | -------------------------------------------------------------------------------- /config/nginx.conf.erb: -------------------------------------------------------------------------------- 1 | daemon off; 2 | #Heroku dynos have at least 4 cores. 3 | worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; 4 | 5 | events { 6 | use epoll; 7 | accept_mutex on; 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | gzip on; 13 | gzip_comp_level 2; 14 | gzip_min_length 512; 15 | 16 | server_tokens off; 17 | 18 | log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id'; 19 | access_log logs/nginx/access.log l2met; 20 | error_log logs/nginx/error.log; 21 | 22 | include mime.types; 23 | default_type application/octet-stream; 24 | sendfile on; 25 | 26 | #Must read the body in 5 seconds. 27 | client_body_timeout 5; 28 | 29 | upstream app_server { 30 | server unix:/tmp/nginx.socket fail_timeout=0; 31 | } 32 | 33 | server { 34 | listen <%= ENV["PORT"] %>; 35 | server_name _; 36 | keepalive_timeout 5; 37 | 38 | location /books/ { 39 | root /app/public/; 40 | index index.html; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | # Provide the path to your manage.py file 2 | MANAGE_FILE_PATH: ./agiliqcom/manage.py 3 | 4 | # Provide the path to your requirements file, if not provided 5 | #then heroku will try to find it in the root directory. 6 | REQUIREMENTS_PATH: 7 | 8 | # Configuration for Sphinx, optional 9 | SPHINX_PATH: 10 | NO_OF_DOCS:5 11 | 1: 12 | COPY_FROM: ddp 13 | COPY_TO: ../static_html/books/djangodesignpatterns/ 14 | 2: 15 | COPY_FROM: django-gotchas 16 | COPY_TO: ../static_html/books/django-gotchas/ 17 | 3: 18 | COPY_FROM: djenofdjango 19 | COPY_TO: ../static_html/books/djenofdjango/ 20 | 4: 21 | COPY_FROM: merchant/docs 22 | COPY_TO: ../../static_html/docs/merchant/ 23 | BUILD_PATH: _build/html/ 24 | 5: 25 | COPY_FROM: graphos/docs 26 | COPY_TO: ../../static_html/docs/django-graphos/ -------------------------------------------------------------------------------- /parse_yml.sh: -------------------------------------------------------------------------------- 1 | parse_yaml() { 2 | local prefix=$2 3 | local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') 4 | sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ 5 | -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | 6 | awk -F$fs '{ 7 | indent = length($1)/2; 8 | vname[indent] = $2; 9 | for (i in vname) {if (i > indent) {delete vname[i]}} 10 | if (length($3) > 0) { 11 | vn=""; for (i=0; i` 7 | 8 | 9 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/cookbook.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ============ 4 | Cookbook 5 | ============ 6 | 7 | This content is now covered in the :doc:`User Guide ` 8 | 9 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/index.rst: -------------------------------------------------------------------------------- 1 | pip 2 | === 3 | 4 | `User list `_ | 5 | `Dev list `_ | 6 | `Github `_ | 7 | `PyPI `_ | 8 | User IRC: #pip | 9 | Dev IRC: #pypa 10 | 11 | The `PyPA recommended 12 | `_ 13 | tool for installing and managing Python packages. 14 | 15 | .. toctree:: 16 | :maxdepth: 2 17 | 18 | quickstart 19 | installing 20 | user_guide 21 | reference/index 22 | development 23 | news 24 | 25 | 26 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/installing.rst: -------------------------------------------------------------------------------- 1 | .. _`Installation`: 2 | 3 | Installation 4 | ============ 5 | 6 | Python & OS Support 7 | ------------------- 8 | 9 | pip works with CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy. 10 | 11 | pip works on Unix/Linux, OS X, and Windows. 12 | 13 | .. note:: 14 | 15 | Python 2.5 was supported through v1.3.1, and Python 2.4 was supported through v1.1. 16 | 17 | 18 | .. _`get-pip`: 19 | 20 | Install or Upgrade pip 21 | ---------------------- 22 | 23 | To install or upgrade pip, securely download `get-pip.py 24 | `_. [1]_ 25 | 26 | Then run the following (which may require administrator access):: 27 | 28 | $ python get-pip.py 29 | 30 | If `setuptools`_ (or `distribute`_) is not already installed, ``get-pip.py`` will 31 | install `setuptools`_ for you. [2]_ 32 | 33 | To upgrade an existing `setuptools`_ (or `distribute`_), run ``pip install -U setuptools`` [3]_ 34 | 35 | 36 | Using Package Managers 37 | ---------------------- 38 | 39 | On Linux, pip will generally be available for the system install of python using 40 | the system package manager, although often the latest version will be 41 | unavailable. 42 | 43 | On Debian and Ubuntu:: 44 | 45 | $ sudo apt-get install python-pip 46 | 47 | On Fedora:: 48 | 49 | $ sudo yum install python-pip 50 | 51 | 52 | .. [1] "Secure" in this context means using a modern browser or a 53 | tool like `curl` that verifies SSL certificates when downloading from 54 | https URLs. 55 | 56 | .. [2] Beginning with pip v1.5.1, ``get-pip.py`` stopped requiring setuptools to 57 | be installed first. 58 | 59 | .. [3] Although using ``pip install --upgrade setuptools`` to upgrade from 60 | distribute to setuptools works in isolation, it's possible to get 61 | "ImportError: No module named setuptools" when using pip<1.4 to upgrade a 62 | package that depends on setuptools or distribute. See :doc:`here for 63 | details `. 64 | 65 | .. _setuptools: https://pypi.python.org/pypi/setuptools 66 | .. _distribute: https://pypi.python.org/pypi/distribute 67 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/logic.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ================ 4 | Internal Details 5 | ================ 6 | 7 | This content is now covered in the :doc:`Reference Guide ` 8 | 9 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/news.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Release Notes 3 | ============= 4 | 5 | .. include:: ../CHANGES.txt 6 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/quickstart.rst: -------------------------------------------------------------------------------- 1 | Quickstart 2 | ========== 3 | 4 | First, :doc:`Install pip `. 5 | 6 | Install a package from `PyPI`_: 7 | 8 | :: 9 | 10 | $ pip install SomePackage 11 | [...] 12 | Successfully installed SomePackage 13 | 14 | Show what files were installed: 15 | 16 | :: 17 | 18 | $ pip show --files SomePackage 19 | Name: SomePackage 20 | Version: 1.0 21 | Location: /my/env/lib/pythonx.x/site-packages 22 | Files: 23 | ../somepackage/__init__.py 24 | [...] 25 | 26 | List what packages are outdated: 27 | 28 | :: 29 | 30 | $ pip list --outdated 31 | SomePackage (Current: 1.0 Latest: 2.0) 32 | 33 | Upgrade a package: 34 | 35 | :: 36 | 37 | $ pip install --upgrade SomePackage 38 | [...] 39 | Found existing installation: SomePackage 1.0 40 | Uninstalling SomePackage: 41 | Successfully uninstalled SomePackage 42 | Running setup.py install for SomePackage 43 | Successfully installed SomePackage 44 | 45 | Uninstall a package: 46 | 47 | :: 48 | 49 | $ pip uninstall SomePackage 50 | Uninstalling SomePackage: 51 | /my/env/lib/pythonx.x/site-packages/somepackage 52 | Proceed (y/n)? y 53 | Successfully uninstalled SomePackage 54 | 55 | 56 | .. _PyPI: http://pypi.python.org/pypi/ 57 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/index.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | Reference Guide 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | pip 9 | pip_install 10 | pip_uninstall 11 | pip_freeze 12 | pip_list 13 | pip_show 14 | pip_search 15 | pip_wheel 16 | 17 | 18 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip.rst: -------------------------------------------------------------------------------- 1 | 2 | pip 3 | --- 4 | 5 | .. contents:: 6 | 7 | Usage 8 | ***** 9 | 10 | :: 11 | 12 | pip [options] 13 | 14 | 15 | Description 16 | *********** 17 | 18 | 19 | .. _`Logging`: 20 | 21 | Logging 22 | ======= 23 | 24 | Console logging 25 | ~~~~~~~~~~~~~~~ 26 | 27 | pip offers :ref:`-v, --verbose <--verbose>` and :ref:`-q, --quiet <--quiet>` 28 | to control the console log level. Each option can be used multiple times and 29 | used together. One ``-v`` increases the verbosity by one, whereas one ``-q`` decreases it by 30 | one. 31 | 32 | The series of log levels, in order, are as follows:: 33 | 34 | VERBOSE_DEBUG, DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL 35 | 36 | ``NOTIFY`` is the default level. 37 | 38 | A few examples on how the parameters work to affect the level: 39 | 40 | * specifying nothing results in ``NOTIFY`` 41 | * ``-v`` results in ``INFO`` 42 | * ``-vv`` results in ``DEBUG`` 43 | * ``-q`` results in ``WARN`` 44 | * ``-vq`` results in ``NOTIFY`` 45 | 46 | The most practical use case for users is either ``-v`` or ``-vv`` to see 47 | additional logging to help troubleshoot an issue. 48 | 49 | 50 | .. _`FileLogging`: 51 | 52 | File logging 53 | ~~~~~~~~~~~~ 54 | 55 | pip offers the :ref:`--log <--log>` option for specifying a file where a maximum 56 | verbosity log will be kept. This option is empty by default. This log appends 57 | to previous logging. 58 | 59 | Additionally, when commands fail (i.e. return a non-zero exit code), pip writes 60 | a "failure log" for the failed command. This log overwrites previous 61 | logging. The default location is as follows: 62 | 63 | * On Unix and Mac OS X: :file:`$HOME/.pip/pip.log` 64 | * On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.log` 65 | 66 | The option for the failure log, is :ref:`--log-file <--log-file>`. 67 | 68 | Both logs add a line per execution to specify the date and what pip executable wrote the log. 69 | 70 | Like all pip options, ``--log`` and ``log-file``, can also be set as an environment 71 | variable, or placed into the pip config file. See the :ref:`Configuration` 72 | section. 73 | 74 | .. _`General Options`: 75 | 76 | General Options 77 | *************** 78 | 79 | .. pip-general-options:: 80 | 81 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_freeze.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _`pip freeze`: 3 | 4 | pip freeze 5 | ----------- 6 | 7 | .. contents:: 8 | 9 | Usage 10 | ***** 11 | 12 | .. pip-command-usage:: freeze 13 | 14 | 15 | Description 16 | *********** 17 | 18 | .. pip-command-description:: freeze 19 | 20 | 21 | Options 22 | ******* 23 | 24 | .. pip-command-options:: freeze 25 | 26 | 27 | Examples 28 | ******** 29 | 30 | 1) Generate output suitable for a requirements file. 31 | 32 | :: 33 | 34 | $ pip freeze 35 | Jinja2==2.6 36 | Pygments==1.5 37 | Sphinx==1.1.3 38 | docutils==0.9.1 39 | 40 | 41 | 2) Generate a requirements file and then install from it in another environment. 42 | 43 | :: 44 | 45 | $ env1/bin/pip freeze > requirements.txt 46 | $ env2/bin/pip install -r requirements.txt 47 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_list.rst: -------------------------------------------------------------------------------- 1 | .. _`pip list`: 2 | 3 | pip list 4 | --------- 5 | 6 | .. contents:: 7 | 8 | Usage 9 | ***** 10 | 11 | .. pip-command-usage:: list 12 | 13 | Description 14 | *********** 15 | 16 | .. pip-command-description:: list 17 | 18 | Options 19 | ******* 20 | 21 | .. pip-command-options:: list 22 | 23 | .. pip-index-options:: 24 | 25 | 26 | Examples 27 | ******** 28 | 29 | 1) List installed packages. 30 | 31 | :: 32 | 33 | $ pip list 34 | Pygments (1.5) 35 | docutils (0.9.1) 36 | Sphinx (1.1.2) 37 | Jinja2 (2.6) 38 | 39 | 2) List outdated packages (excluding editables), and the latest version available 40 | 41 | :: 42 | 43 | $ pip list --outdated 44 | docutils (Current: 0.9.1 Latest: 0.10) 45 | Sphinx (Current: 1.1.2 Latest: 1.1.3) 46 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_search.rst: -------------------------------------------------------------------------------- 1 | .. _`pip search`: 2 | 3 | pip search 4 | ---------- 5 | 6 | .. contents:: 7 | 8 | Usage 9 | ***** 10 | 11 | .. pip-command-usage:: search 12 | 13 | 14 | Description 15 | *********** 16 | 17 | .. pip-command-description:: search 18 | 19 | Options 20 | ******* 21 | 22 | .. pip-command-options:: search 23 | 24 | 25 | Examples 26 | ******** 27 | 28 | 1. Search for "peppercorn" 29 | 30 | :: 31 | 32 | $ pip search peppercorn 33 | pepperedform - Helpers for using peppercorn with formprocess. 34 | peppercorn - A library for converting a token stream into [...] 35 | 36 | .. _`pip wheel`: 37 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_show.rst: -------------------------------------------------------------------------------- 1 | .. _`pip show`: 2 | 3 | pip show 4 | -------- 5 | 6 | .. contents:: 7 | 8 | Usage 9 | ***** 10 | 11 | .. pip-command-usage:: show 12 | 13 | Description 14 | *********** 15 | 16 | .. pip-command-description:: show 17 | 18 | 19 | Options 20 | ******* 21 | 22 | .. pip-command-options:: show 23 | 24 | 25 | Examples 26 | ******** 27 | 28 | 1. Show information about a package: 29 | 30 | :: 31 | 32 | $ pip show sphinx 33 | --- 34 | Name: Sphinx 35 | Version: 1.1.3 36 | Location: /my/env/lib/pythonx.x/site-packages 37 | Requires: Pygments, Jinja2, docutils 38 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_uninstall.rst: -------------------------------------------------------------------------------- 1 | .. _`pip uninstall`: 2 | 3 | pip uninstall 4 | ------------- 5 | 6 | .. contents:: 7 | 8 | Usage 9 | ***** 10 | 11 | .. pip-command-usage:: uninstall 12 | 13 | Description 14 | *********** 15 | 16 | .. pip-command-description:: uninstall 17 | 18 | Options 19 | ******* 20 | 21 | .. pip-command-options:: uninstall 22 | 23 | 24 | Examples 25 | ******** 26 | 27 | 1) Uninstall a package. 28 | 29 | :: 30 | 31 | $ pip uninstall simplejson 32 | Uninstalling simplejson: 33 | /home/me/env/lib/python2.7/site-packages/simplejson 34 | /home/me/env/lib/python2.7/site-packages/simplejson-2.2.1-py2.7.egg-info 35 | Proceed (y/n)? y 36 | Successfully uninstalled simplejson 37 | 38 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/reference/pip_wheel.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _`pip wheel`: 3 | 4 | pip wheel 5 | --------- 6 | 7 | .. contents:: 8 | 9 | Usage 10 | ***** 11 | 12 | .. pip-command-usage:: wheel 13 | 14 | 15 | Description 16 | *********** 17 | 18 | .. pip-command-description:: wheel 19 | 20 | 21 | Options 22 | ******* 23 | 24 | .. pip-command-options:: wheel 25 | 26 | .. pip-index-options:: 27 | 28 | 29 | Examples 30 | ******** 31 | 32 | 1. Build wheels for a requirement (and all its dependencies), and then install 33 | 34 | :: 35 | 36 | $ pip wheel --wheel-dir=/tmp/wheelhouse SomePackage 37 | $ pip install --no-index --find-links=/tmp/wheelhouse SomePackage 38 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/docs/usage.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ========== 4 | Usage 5 | ========== 6 | 7 | The "Usage" section is now covered in the :doc:`Reference Guide ` 8 | 9 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | pip = pip:main 3 | pip2.7 = pip:main 4 | pip2 = pip:main 5 | 6 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip.egg-info/not-zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | [testing] 4 | pytest 5 | virtualenv>=1.10 6 | scripttest>=1.3 7 | mock -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | pip 2 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/__main__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from .runner import run 3 | 4 | if __name__ == '__main__': 5 | exit = run() 6 | if exit: 7 | sys.exit(exit) 8 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pip._vendor is for vendoring dependencies of pip to prevent needing pip to 3 | depend on something external. 4 | 5 | Files inside of pip._vendor should be considered immutable and should only be 6 | updated to versions from upstream. 7 | """ 8 | from __future__ import absolute_import 9 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/_markerlib/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ast 3 | from pip._vendor._markerlib.markers import default_environment, compile, interpret 4 | except ImportError: 5 | if 'ast' in globals(): 6 | raise 7 | def default_environment(): 8 | return {} 9 | def compile(marker): 10 | def marker_fn(environment=None, override=None): 11 | # 'empty markers are True' heuristic won't install extra deps. 12 | return not marker.strip() 13 | marker_fn.__doc__ = marker 14 | return marker_fn 15 | def interpret(marker, environment=None, override=None): 16 | return compile(marker)() 17 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/colorama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from .initialise import init, deinit, reinit 3 | from .ansi import Fore, Back, Style 4 | from .ansitowin32 import AnsiToWin32 5 | 6 | VERSION = '0.2.7' 7 | 8 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/colorama/ansi.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | ''' 3 | This module generates ANSI character codes to printing colors to terminals. 4 | See: http://en.wikipedia.org/wiki/ANSI_escape_code 5 | ''' 6 | 7 | CSI = '\033[' 8 | 9 | def code_to_chars(code): 10 | return CSI + str(code) + 'm' 11 | 12 | class AnsiCodes(object): 13 | def __init__(self, codes): 14 | for name in dir(codes): 15 | if not name.startswith('_'): 16 | value = getattr(codes, name) 17 | setattr(self, name, code_to_chars(value)) 18 | 19 | class AnsiFore: 20 | BLACK = 30 21 | RED = 31 22 | GREEN = 32 23 | YELLOW = 33 24 | BLUE = 34 25 | MAGENTA = 35 26 | CYAN = 36 27 | WHITE = 37 28 | RESET = 39 29 | 30 | class AnsiBack: 31 | BLACK = 40 32 | RED = 41 33 | GREEN = 42 34 | YELLOW = 43 35 | BLUE = 44 36 | MAGENTA = 45 37 | CYAN = 46 38 | WHITE = 47 39 | RESET = 49 40 | 41 | class AnsiStyle: 42 | BRIGHT = 1 43 | DIM = 2 44 | NORMAL = 22 45 | RESET_ALL = 0 46 | 47 | Fore = AnsiCodes( AnsiFore ) 48 | Back = AnsiCodes( AnsiBack ) 49 | Style = AnsiCodes( AnsiStyle ) 50 | 51 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/colorama/initialise.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | import atexit 3 | import sys 4 | 5 | from .ansitowin32 import AnsiToWin32 6 | 7 | 8 | orig_stdout = sys.stdout 9 | orig_stderr = sys.stderr 10 | 11 | wrapped_stdout = sys.stdout 12 | wrapped_stderr = sys.stderr 13 | 14 | atexit_done = False 15 | 16 | 17 | def reset_all(): 18 | AnsiToWin32(orig_stdout).reset_all() 19 | 20 | 21 | def init(autoreset=False, convert=None, strip=None, wrap=True): 22 | 23 | if not wrap and any([autoreset, convert, strip]): 24 | raise ValueError('wrap=False conflicts with any other arg=True') 25 | 26 | global wrapped_stdout, wrapped_stderr 27 | sys.stdout = wrapped_stdout = \ 28 | wrap_stream(orig_stdout, convert, strip, autoreset, wrap) 29 | sys.stderr = wrapped_stderr = \ 30 | wrap_stream(orig_stderr, convert, strip, autoreset, wrap) 31 | 32 | global atexit_done 33 | if not atexit_done: 34 | atexit.register(reset_all) 35 | atexit_done = True 36 | 37 | 38 | def deinit(): 39 | sys.stdout = orig_stdout 40 | sys.stderr = orig_stderr 41 | 42 | 43 | def reinit(): 44 | sys.stdout = wrapped_stdout 45 | sys.stderr = wrapped_stdout 46 | 47 | 48 | def wrap_stream(stream, convert, strip, autoreset, wrap): 49 | if wrap: 50 | wrapper = AnsiToWin32(stream, 51 | convert=convert, strip=strip, autoreset=autoreset) 52 | if wrapper.should_wrap(): 53 | stream = wrapper.stream 54 | return stream 55 | 56 | 57 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012-2013 Vinay Sajip. 4 | # Licensed to the Python Software Foundation under a contributor agreement. 5 | # See LICENSE.txt and CONTRIBUTORS.txt. 6 | # 7 | import logging 8 | 9 | __version__ = '0.1.7' 10 | 11 | class DistlibException(Exception): 12 | pass 13 | 14 | try: 15 | from logging import NullHandler 16 | except ImportError: # pragma: no cover 17 | class NullHandler(logging.Handler): 18 | def handle(self, record): pass 19 | def emit(self, record): pass 20 | 21 | logger = logging.getLogger(__name__) 22 | logger.addHandler(NullHandler()) 23 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/_backport/__init__.py: -------------------------------------------------------------------------------- 1 | """Modules copied from Python 3 standard libraries, for internal use only. 2 | 3 | Individual classes and functions are found in d2._backport.misc. Intended 4 | usage is to always import things missing from 3.1 from that module: the 5 | built-in/stdlib objects will be used if found. 6 | """ 7 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/_backport/misc.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (C) 2012 The Python Software Foundation. 4 | # See LICENSE.txt and CONTRIBUTORS.txt. 5 | # 6 | """Backports for individual classes and functions.""" 7 | 8 | import os 9 | import sys 10 | 11 | __all__ = ['cache_from_source', 'callable', 'fsencode'] 12 | 13 | 14 | try: 15 | from imp import cache_from_source 16 | except ImportError: 17 | def cache_from_source(py_file, debug=__debug__): 18 | ext = debug and 'c' or 'o' 19 | return py_file + ext 20 | 21 | 22 | try: 23 | callable = callable 24 | except NameError: 25 | from collections import Callable 26 | 27 | def callable(obj): 28 | return isinstance(obj, Callable) 29 | 30 | 31 | try: 32 | fsencode = os.fsencode 33 | except AttributeError: 34 | def fsencode(filename): 35 | if isinstance(filename, bytes): 36 | return filename 37 | elif isinstance(filename, str): 38 | return filename.encode(sys.getfilesystemencoding()) 39 | else: 40 | raise TypeError("expect bytes or str, not %s" % 41 | type(filename).__name__) 42 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/t32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/distlib/t32.exe -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/t64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/distlib/t64.exe -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/w32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/distlib/w32.exe -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/distlib/w64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/distlib/w64.exe -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | HTML parsing library based on the WHATWG "HTML5" 3 | specification. The parser is designed to be compatible with existing 4 | HTML found in the wild and implements well-defined error recovery that 5 | is largely compatible with modern desktop web browsers. 6 | 7 | Example usage: 8 | 9 | import html5lib 10 | f = open("my_document.html") 11 | tree = html5lib.parse(f) 12 | """ 13 | 14 | from __future__ import absolute_import, division, unicode_literals 15 | 16 | from .html5parser import HTMLParser, parse, parseFragment 17 | from .treebuilders import getTreeBuilder 18 | from .treewalkers import getTreeWalker 19 | from .serializer import serialize 20 | 21 | __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", 22 | "getTreeWalker", "serialize"] 23 | __version__ = "1.0b1" 24 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/filters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/html5lib/filters/__init__.py -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/filters/_base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | 4 | class Filter(object): 5 | def __init__(self, source): 6 | self.source = source 7 | 8 | def __iter__(self): 9 | return iter(self.source) 10 | 11 | def __getattr__(self, name): 12 | return getattr(self.source, name) 13 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/filters/alphabeticalattributes.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from . import _base 4 | 5 | try: 6 | from collections import OrderedDict 7 | except ImportError: 8 | from ordereddict import OrderedDict 9 | 10 | 11 | class Filter(_base.Filter): 12 | def __iter__(self): 13 | for token in _base.Filter.__iter__(self): 14 | if token["type"] in ("StartTag", "EmptyTag"): 15 | attrs = OrderedDict() 16 | for name, value in sorted(token["data"].items(), 17 | key=lambda x: x[0]): 18 | attrs[name] = value 19 | token["data"] = attrs 20 | yield token 21 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/filters/sanitizer.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from . import _base 4 | from ..sanitizer import HTMLSanitizerMixin 5 | 6 | 7 | class Filter(_base.Filter, HTMLSanitizerMixin): 8 | def __iter__(self): 9 | for token in _base.Filter.__iter__(self): 10 | token = self.sanitize_token(token) 11 | if token: 12 | yield token 13 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/filters/whitespace.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | import re 4 | 5 | from . import _base 6 | from ..constants import rcdataElements, spaceCharacters 7 | spaceCharacters = "".join(spaceCharacters) 8 | 9 | SPACES_REGEX = re.compile("[%s]+" % spaceCharacters) 10 | 11 | 12 | class Filter(_base.Filter): 13 | 14 | spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements)) 15 | 16 | def __iter__(self): 17 | preserve = 0 18 | for token in _base.Filter.__iter__(self): 19 | type = token["type"] 20 | if type == "StartTag" \ 21 | and (preserve or token["name"] in self.spacePreserveElements): 22 | preserve += 1 23 | 24 | elif type == "EndTag" and preserve: 25 | preserve -= 1 26 | 27 | elif not preserve and type == "SpaceCharacters" and token["data"]: 28 | # Test on token["data"] above to not introduce spaces where there were not 29 | token["data"] = " " 30 | 31 | elif not preserve and type == "Characters": 32 | token["data"] = collapse_spaces(token["data"]) 33 | 34 | yield token 35 | 36 | 37 | def collapse_spaces(text): 38 | return SPACES_REGEX.sub(' ', text) 39 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/serializer/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from .. import treewalkers 4 | 5 | from .htmlserializer import HTMLSerializer 6 | 7 | 8 | def serialize(input, tree="etree", format="html", encoding=None, 9 | **serializer_opts): 10 | # XXX: Should we cache this? 11 | walker = treewalkers.getTreeWalker(tree) 12 | if format == "html": 13 | s = HTMLSerializer(**serializer_opts) 14 | else: 15 | raise ValueError("type must be html") 16 | return s.render(walker(input), encoding) 17 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/treewalkers/__init__.py: -------------------------------------------------------------------------------- 1 | """A collection of modules for iterating through different kinds of 2 | tree, generating tokens identical to those produced by the tokenizer 3 | module. 4 | 5 | To create a tree walker for a new type of tree, you need to do 6 | implement a tree walker object (called TreeWalker by convention) that 7 | implements a 'serialize' method taking a tree as sole argument and 8 | returning an iterator generating tokens. 9 | """ 10 | 11 | from __future__ import absolute_import, division, unicode_literals 12 | 13 | import sys 14 | 15 | from ..utils import default_etree 16 | 17 | treeWalkerCache = {} 18 | 19 | 20 | def getTreeWalker(treeType, implementation=None, **kwargs): 21 | """Get a TreeWalker class for various types of tree with built-in support 22 | 23 | treeType - the name of the tree type required (case-insensitive). Supported 24 | values are: 25 | 26 | "dom" - The xml.dom.minidom DOM implementation 27 | "pulldom" - The xml.dom.pulldom event stream 28 | "etree" - A generic walker for tree implementations exposing an 29 | elementtree-like interface (known to work with 30 | ElementTree, cElementTree and lxml.etree). 31 | "lxml" - Optimized walker for lxml.etree 32 | "genshi" - a Genshi stream 33 | 34 | implementation - (Currently applies to the "etree" tree type only). A module 35 | implementing the tree type e.g. xml.etree.ElementTree or 36 | cElementTree.""" 37 | 38 | treeType = treeType.lower() 39 | if treeType not in treeWalkerCache: 40 | if treeType in ("dom", "pulldom"): 41 | name = "%s.%s" % (__name__, treeType) 42 | __import__(name) 43 | mod = sys.modules[name] 44 | treeWalkerCache[treeType] = mod.TreeWalker 45 | elif treeType == "genshi": 46 | from . import genshistream 47 | treeWalkerCache[treeType] = genshistream.TreeWalker 48 | elif treeType == "lxml": 49 | from . import lxmletree 50 | treeWalkerCache[treeType] = lxmletree.TreeWalker 51 | elif treeType == "etree": 52 | from . import etree 53 | if implementation is None: 54 | implementation = default_etree 55 | # XXX: NEVER cache here, caching is done in the etree submodule 56 | return etree.getETreeModule(implementation, **kwargs).TreeWalker 57 | return treeWalkerCache.get(treeType) 58 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/treewalkers/dom.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from xml.dom import Node 4 | 5 | import gettext 6 | _ = gettext.gettext 7 | 8 | from . import _base 9 | 10 | 11 | class TreeWalker(_base.NonRecursiveTreeWalker): 12 | def getNodeDetails(self, node): 13 | if node.nodeType == Node.DOCUMENT_TYPE_NODE: 14 | return _base.DOCTYPE, node.name, node.publicId, node.systemId 15 | 16 | elif node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): 17 | return _base.TEXT, node.nodeValue 18 | 19 | elif node.nodeType == Node.ELEMENT_NODE: 20 | attrs = {} 21 | for attr in list(node.attributes.keys()): 22 | attr = node.getAttributeNode(attr) 23 | if attr.namespaceURI: 24 | attrs[(attr.namespaceURI, attr.localName)] = attr.value 25 | else: 26 | attrs[(None, attr.name)] = attr.value 27 | return (_base.ELEMENT, node.namespaceURI, node.nodeName, 28 | attrs, node.hasChildNodes()) 29 | 30 | elif node.nodeType == Node.COMMENT_NODE: 31 | return _base.COMMENT, node.nodeValue 32 | 33 | elif node.nodeType in (Node.DOCUMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE): 34 | return (_base.DOCUMENT,) 35 | 36 | else: 37 | return _base.UNKNOWN, node.nodeType 38 | 39 | def getFirstChild(self, node): 40 | return node.firstChild 41 | 42 | def getNextSibling(self, node): 43 | return node.nextSibling 44 | 45 | def getParentNode(self, node): 46 | return node.parentNode 47 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/treewalkers/genshistream.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from genshi.core import QName 4 | from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT 5 | from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT 6 | 7 | from . import _base 8 | 9 | from ..constants import voidElements, namespaces 10 | 11 | 12 | class TreeWalker(_base.TreeWalker): 13 | def __iter__(self): 14 | # Buffer the events so we can pass in the following one 15 | previous = None 16 | for event in self.tree: 17 | if previous is not None: 18 | for token in self.tokens(previous, event): 19 | yield token 20 | previous = event 21 | 22 | # Don't forget the final event! 23 | if previous is not None: 24 | for token in self.tokens(previous, None): 25 | yield token 26 | 27 | def tokens(self, event, next): 28 | kind, data, pos = event 29 | if kind == START: 30 | tag, attribs = data 31 | name = tag.localname 32 | namespace = tag.namespace 33 | converted_attribs = {} 34 | for k, v in attribs: 35 | if isinstance(k, QName): 36 | converted_attribs[(k.namespace, k.localname)] = v 37 | else: 38 | converted_attribs[(None, k)] = v 39 | 40 | if namespace == namespaces["html"] and name in voidElements: 41 | for token in self.emptyTag(namespace, name, converted_attribs, 42 | not next or next[0] != END 43 | or next[1] != tag): 44 | yield token 45 | else: 46 | yield self.startTag(namespace, name, converted_attribs) 47 | 48 | elif kind == END: 49 | name = data.localname 50 | namespace = data.namespace 51 | if name not in voidElements: 52 | yield self.endTag(namespace, name) 53 | 54 | elif kind == COMMENT: 55 | yield self.comment(data) 56 | 57 | elif kind == TEXT: 58 | for token in self.text(data): 59 | yield token 60 | 61 | elif kind == DOCTYPE: 62 | yield self.doctype(*data) 63 | 64 | elif kind in (XML_NAMESPACE, DOCTYPE, START_NS, END_NS, 65 | START_CDATA, END_CDATA, PI): 66 | pass 67 | 68 | else: 69 | yield self.unknown(kind) 70 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/treewalkers/pulldom.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ 4 | COMMENT, IGNORABLE_WHITESPACE, CHARACTERS 5 | 6 | from . import _base 7 | 8 | from ..constants import voidElements 9 | 10 | 11 | class TreeWalker(_base.TreeWalker): 12 | def __iter__(self): 13 | ignore_until = None 14 | previous = None 15 | for event in self.tree: 16 | if previous is not None and \ 17 | (ignore_until is None or previous[1] is ignore_until): 18 | if previous[1] is ignore_until: 19 | ignore_until = None 20 | for token in self.tokens(previous, event): 21 | yield token 22 | if token["type"] == "EmptyTag": 23 | ignore_until = previous[1] 24 | previous = event 25 | if ignore_until is None or previous[1] is ignore_until: 26 | for token in self.tokens(previous, None): 27 | yield token 28 | elif ignore_until is not None: 29 | raise ValueError("Illformed DOM event stream: void element without END_ELEMENT") 30 | 31 | def tokens(self, event, next): 32 | type, node = event 33 | if type == START_ELEMENT: 34 | name = node.nodeName 35 | namespace = node.namespaceURI 36 | attrs = {} 37 | for attr in list(node.attributes.keys()): 38 | attr = node.getAttributeNode(attr) 39 | attrs[(attr.namespaceURI, attr.localName)] = attr.value 40 | if name in voidElements: 41 | for token in self.emptyTag(namespace, 42 | name, 43 | attrs, 44 | not next or next[1] is not node): 45 | yield token 46 | else: 47 | yield self.startTag(namespace, name, attrs) 48 | 49 | elif type == END_ELEMENT: 50 | name = node.nodeName 51 | namespace = node.namespaceURI 52 | if name not in voidElements: 53 | yield self.endTag(namespace, name) 54 | 55 | elif type == COMMENT: 56 | yield self.comment(node.nodeValue) 57 | 58 | elif type in (IGNORABLE_WHITESPACE, CHARACTERS): 59 | for token in self.text(node.nodeValue): 60 | yield token 61 | 62 | else: 63 | yield self.unknown(type) 64 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/trie/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from .py import Trie as PyTrie 4 | 5 | Trie = PyTrie 6 | 7 | try: 8 | from .datrie import Trie as DATrie 9 | except ImportError: 10 | pass 11 | else: 12 | Trie = DATrie 13 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/trie/_base.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from collections import Mapping 4 | 5 | 6 | class Trie(Mapping): 7 | """Abstract base class for tries""" 8 | 9 | def keys(self, prefix=None): 10 | keys = super().keys() 11 | 12 | if prefix is None: 13 | return set(keys) 14 | 15 | # Python 2.6: no set comprehensions 16 | return set([x for x in keys if x.startswith(prefix)]) 17 | 18 | def has_keys_with_prefix(self, prefix): 19 | for key in self.keys(): 20 | if key.startswith(prefix): 21 | return True 22 | 23 | return False 24 | 25 | def longest_prefix(self, prefix): 26 | if prefix in self: 27 | return prefix 28 | 29 | for i in range(1, len(prefix) + 1): 30 | if prefix[:-i] in self: 31 | return prefix[:-i] 32 | 33 | raise KeyError(prefix) 34 | 35 | def longest_prefix_item(self, prefix): 36 | lprefix = self.longest_prefix(prefix) 37 | return (lprefix, self[lprefix]) 38 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/trie/datrie.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from datrie import Trie as DATrie 4 | from pip._vendor.six import text_type 5 | 6 | from ._base import Trie as ABCTrie 7 | 8 | 9 | class Trie(ABCTrie): 10 | def __init__(self, data): 11 | chars = set() 12 | for key in data.keys(): 13 | if not isinstance(key, text_type): 14 | raise TypeError("All keys must be strings") 15 | for char in key: 16 | chars.add(char) 17 | 18 | self._data = DATrie("".join(chars)) 19 | for key, value in data.items(): 20 | self._data[key] = value 21 | 22 | def __contains__(self, key): 23 | return key in self._data 24 | 25 | def __len__(self): 26 | return len(self._data) 27 | 28 | def __iter__(self): 29 | raise NotImplementedError() 30 | 31 | def __getitem__(self, key): 32 | return self._data[key] 33 | 34 | def keys(self, prefix=None): 35 | return self._data.keys(prefix) 36 | 37 | def has_keys_with_prefix(self, prefix): 38 | return self._data.has_keys_with_prefix(prefix) 39 | 40 | def longest_prefix(self, prefix): 41 | return self._data.longest_prefix(prefix) 42 | 43 | def longest_prefix_item(self, prefix): 44 | return self._data.longest_prefix_item(prefix) 45 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/trie/py.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | from pip._vendor.six import text_type 3 | 4 | from bisect import bisect_left 5 | 6 | from ._base import Trie as ABCTrie 7 | 8 | 9 | class Trie(ABCTrie): 10 | def __init__(self, data): 11 | if not all(isinstance(x, text_type) for x in data.keys()): 12 | raise TypeError("All keys must be strings") 13 | 14 | self._data = data 15 | self._keys = sorted(data.keys()) 16 | self._cachestr = "" 17 | self._cachepoints = (0, len(data)) 18 | 19 | def __contains__(self, key): 20 | return key in self._data 21 | 22 | def __len__(self): 23 | return len(self._data) 24 | 25 | def __iter__(self): 26 | return iter(self._data) 27 | 28 | def __getitem__(self, key): 29 | return self._data[key] 30 | 31 | def keys(self, prefix=None): 32 | if prefix is None or prefix == "" or not self._keys: 33 | return set(self._keys) 34 | 35 | if prefix.startswith(self._cachestr): 36 | lo, hi = self._cachepoints 37 | start = i = bisect_left(self._keys, prefix, lo, hi) 38 | else: 39 | start = i = bisect_left(self._keys, prefix) 40 | 41 | keys = set() 42 | if start == len(self._keys): 43 | return keys 44 | 45 | while self._keys[i].startswith(prefix): 46 | keys.add(self._keys[i]) 47 | i += 1 48 | 49 | self._cachestr = prefix 50 | self._cachepoints = (start, i) 51 | 52 | return keys 53 | 54 | def has_keys_with_prefix(self, prefix): 55 | if prefix in self._data: 56 | return True 57 | 58 | if prefix.startswith(self._cachestr): 59 | lo, hi = self._cachepoints 60 | i = bisect_left(self._keys, prefix, lo, hi) 61 | else: 62 | i = bisect_left(self._keys, prefix) 63 | 64 | if i == len(self._keys): 65 | return False 66 | 67 | return self._keys[i].startswith(prefix) 68 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/html5lib/utils.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, unicode_literals 2 | 3 | from types import ModuleType 4 | 5 | try: 6 | import xml.etree.cElementTree as default_etree 7 | except ImportError: 8 | import xml.etree.ElementTree as default_etree 9 | 10 | 11 | class MethodDispatcher(dict): 12 | """Dict with 2 special properties: 13 | 14 | On initiation, keys that are lists, sets or tuples are converted to 15 | multiple keys so accessing any one of the items in the original 16 | list-like object returns the matching value 17 | 18 | md = MethodDispatcher({("foo", "bar"):"baz"}) 19 | md["foo"] == "baz" 20 | 21 | A default value which can be set through the default attribute. 22 | """ 23 | 24 | def __init__(self, items=()): 25 | # Using _dictEntries instead of directly assigning to self is about 26 | # twice as fast. Please do careful performance testing before changing 27 | # anything here. 28 | _dictEntries = [] 29 | for name, value in items: 30 | if type(name) in (list, tuple, frozenset, set): 31 | for item in name: 32 | _dictEntries.append((item, value)) 33 | else: 34 | _dictEntries.append((name, value)) 35 | dict.__init__(self, _dictEntries) 36 | self.default = None 37 | 38 | def __getitem__(self, key): 39 | return dict.get(self, key, self.default) 40 | 41 | 42 | # Some utility functions to dal with weirdness around UCS2 vs UCS4 43 | # python builds 44 | 45 | def isSurrogatePair(data): 46 | return (len(data) == 2 and 47 | ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and 48 | ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF) 49 | 50 | 51 | def surrogatePairToCodepoint(data): 52 | char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 + 53 | (ord(data[1]) - 0xDC00)) 54 | return char_val 55 | 56 | # Module Factory Factory (no, this isn't Java, I know) 57 | # Here to stop this being duplicated all over the place. 58 | 59 | 60 | def moduleFactoryFactory(factory): 61 | moduleCache = {} 62 | 63 | def moduleFactory(baseModule, *args, **kwargs): 64 | if isinstance(ModuleType.__name__, type("")): 65 | name = "_%s_factory" % baseModule.__name__ 66 | else: 67 | name = b"_%s_factory" % baseModule.__name__ 68 | 69 | if name in moduleCache: 70 | return moduleCache[name] 71 | else: 72 | mod = ModuleType(name) 73 | objs = factory(baseModule, *args, **kwargs) 74 | mod.__dict__.update(objs) 75 | moduleCache[name] = mod 76 | return mod 77 | 78 | return moduleFactory 79 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/re-vendor.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pip 4 | import glob 5 | import shutil 6 | 7 | here = os.path.abspath(os.path.dirname(__file__)) 8 | 9 | def usage(): 10 | print("Usage: re-vendor.py [clean|vendor]") 11 | sys.exit(1) 12 | 13 | def clean(): 14 | for fn in os.listdir(here): 15 | dirname = os.path.join(here, fn) 16 | if os.path.isdir(dirname): 17 | shutil.rmtree(dirname) 18 | # six is a single file, not a package 19 | os.unlink(os.path.join(here, 'six.py')) 20 | 21 | def vendor(): 22 | pip.main(['install', '-t', here, '-r', 'vendor.txt']) 23 | for dirname in glob.glob('*.egg-info'): 24 | shutil.rmtree(dirname) 25 | 26 | if __name__ == '__main__': 27 | if len(sys.argv) != 2: 28 | usage() 29 | if sys.argv[1] == 'clean': 30 | clean() 31 | elif sys.argv[1] == 'vendor': 32 | vendor() 33 | else: 34 | usage() 35 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # __ 4 | # /__) _ _ _ _ _/ _ 5 | # / ( (- (/ (/ (- _) / _) 6 | # / 7 | 8 | """ 9 | requests HTTP library 10 | ~~~~~~~~~~~~~~~~~~~~~ 11 | 12 | Requests is an HTTP library, written in Python, for human beings. Basic GET 13 | usage: 14 | 15 | >>> import requests 16 | >>> r = requests.get('http://python.org') 17 | >>> r.status_code 18 | 200 19 | >>> 'Python is a programming language' in r.content 20 | True 21 | 22 | ... or POST: 23 | 24 | >>> payload = dict(key1='value1', key2='value2') 25 | >>> r = requests.post("http://httpbin.org/post", data=payload) 26 | >>> print(r.text) 27 | { 28 | ... 29 | "form": { 30 | "key2": "value2", 31 | "key1": "value1" 32 | }, 33 | ... 34 | } 35 | 36 | The other HTTP methods are supported - see `requests.api`. Full documentation 37 | is at . 38 | 39 | :copyright: (c) 2014 by Kenneth Reitz. 40 | :license: Apache 2.0, see LICENSE for more details. 41 | 42 | """ 43 | 44 | __title__ = 'requests' 45 | __version__ = '2.2.1' 46 | __build__ = 0x020201 47 | __author__ = 'Kenneth Reitz' 48 | __license__ = 'Apache 2.0' 49 | __copyright__ = 'Copyright 2014 Kenneth Reitz' 50 | 51 | # Attempt to enable urllib3's SNI support, if possible 52 | try: 53 | from .packages.urllib3.contrib import pyopenssl 54 | pyopenssl.inject_into_urllib3() 55 | except ImportError: 56 | pass 57 | 58 | from . import utils 59 | from .models import Request, Response, PreparedRequest 60 | from .api import request, get, head, post, patch, put, delete, options 61 | from .sessions import session, Session 62 | from .status_codes import codes 63 | from .exceptions import ( 64 | RequestException, Timeout, URLRequired, 65 | TooManyRedirects, HTTPError, ConnectionError 66 | ) 67 | 68 | # Set default logging handler to avoid "No handler found" warnings. 69 | import logging 70 | try: # Python 2.7+ 71 | from logging import NullHandler 72 | except ImportError: 73 | class NullHandler(logging.Handler): 74 | def emit(self, record): 75 | pass 76 | 77 | logging.getLogger(__name__).addHandler(NullHandler()) 78 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/certs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | certs.py 6 | ~~~~~~~~ 7 | 8 | This module returns the preferred default CA certificate bundle. 9 | 10 | If you are packaging Requests, e.g., for a Linux distribution or a managed 11 | environment, you can change the definition of where() to return a separately 12 | packaged CA bundle. 13 | """ 14 | 15 | import os.path 16 | 17 | 18 | def where(): 19 | """Return the preferred certificate bundle.""" 20 | # vendored bundle inside Requests 21 | return os.path.join(os.path.dirname(__file__), 'cacert.pem') 22 | 23 | if __name__ == '__main__': 24 | print(where()) 25 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.exceptions 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | This module contains the set of Requests' exceptions. 8 | 9 | """ 10 | from .packages.urllib3.exceptions import HTTPError as BaseHTTPError 11 | 12 | 13 | class RequestException(IOError): 14 | """There was an ambiguous exception that occurred while handling your 15 | request.""" 16 | 17 | 18 | class HTTPError(RequestException): 19 | """An HTTP error occurred.""" 20 | 21 | def __init__(self, *args, **kwargs): 22 | """ Initializes HTTPError with optional `response` object. """ 23 | self.response = kwargs.pop('response', None) 24 | super(HTTPError, self).__init__(*args, **kwargs) 25 | 26 | 27 | class ConnectionError(RequestException): 28 | """A Connection error occurred.""" 29 | 30 | 31 | class ProxyError(ConnectionError): 32 | """A proxy error occurred.""" 33 | 34 | 35 | class SSLError(ConnectionError): 36 | """An SSL error occurred.""" 37 | 38 | 39 | class Timeout(RequestException): 40 | """The request timed out.""" 41 | 42 | 43 | class URLRequired(RequestException): 44 | """A valid URL is required to make a request.""" 45 | 46 | 47 | class TooManyRedirects(RequestException): 48 | """Too many redirects.""" 49 | 50 | 51 | class MissingSchema(RequestException, ValueError): 52 | """The URL schema (e.g. http or https) is missing.""" 53 | 54 | 55 | class InvalidSchema(RequestException, ValueError): 56 | """See defaults.py for valid schemas.""" 57 | 58 | 59 | class InvalidURL(RequestException, ValueError): 60 | """ The URL provided was somehow invalid. """ 61 | 62 | 63 | class ChunkedEncodingError(RequestException): 64 | """The server declared chunked encoding but sent an invalid chunk.""" 65 | 66 | 67 | class ContentDecodingError(RequestException, BaseHTTPError): 68 | """Failed to decode response content""" 69 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | requests.hooks 5 | ~~~~~~~~~~~~~~ 6 | 7 | This module provides the capabilities for the Requests hooks system. 8 | 9 | Available hooks: 10 | 11 | ``response``: 12 | The response generated from a Request. 13 | 14 | """ 15 | 16 | 17 | HOOKS = ['response'] 18 | 19 | 20 | def default_hooks(): 21 | hooks = {} 22 | for event in HOOKS: 23 | hooks[event] = [] 24 | return hooks 25 | 26 | # TODO: response is the only one 27 | 28 | 29 | def dispatch_hook(key, hooks, hook_data, **kwargs): 30 | """Dispatches a hook dictionary on a given piece of data.""" 31 | 32 | hooks = hooks or dict() 33 | 34 | if key in hooks: 35 | hooks = hooks.get(key) 36 | 37 | if hasattr(hooks, '__call__'): 38 | hooks = [hooks] 39 | 40 | for hook in hooks: 41 | _hook_data = hook(hook_data, **kwargs) 42 | if _hook_data is not None: 43 | hook_data = _hook_data 44 | 45 | return hook_data 46 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import urllib3 4 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/__init__.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # This library is free software; you can redistribute it and/or 3 | # modify it under the terms of the GNU Lesser General Public 4 | # License as published by the Free Software Foundation; either 5 | # version 2.1 of the License, or (at your option) any later version. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 15 | # 02110-1301 USA 16 | ######################### END LICENSE BLOCK ######################### 17 | 18 | __version__ = "1.0.3" 19 | from sys import version_info 20 | 21 | 22 | def detect(aBuf): 23 | if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 24 | (version_info >= (3, 0) and not isinstance(aBuf, bytes))): 25 | raise ValueError('Expected a bytes object, not a unicode object') 26 | 27 | from . import universaldetector 28 | u = universaldetector.UniversalDetector() 29 | u.reset() 30 | u.feed(aBuf) 31 | u.close() 32 | return u.result 33 | 34 | def _description_of(path): 35 | """Return a string describing the probable encoding of a file.""" 36 | from charade.universaldetector import UniversalDetector 37 | 38 | u = UniversalDetector() 39 | for line in open(path, 'rb'): 40 | u.feed(line) 41 | u.close() 42 | result = u.result 43 | if result['encoding']: 44 | return '%s: %s with confidence %s' % (path, 45 | result['encoding'], 46 | result['confidence']) 47 | else: 48 | return '%s: no result' % path 49 | 50 | 51 | def charade_cli(): 52 | """ 53 | Script which takes one or more file paths and reports on their detected 54 | encodings 55 | 56 | Example:: 57 | 58 | % chardetect.py somefile someotherfile 59 | somefile: windows-1252 with confidence 0.5 60 | someotherfile: ascii with confidence 1.0 61 | 62 | """ 63 | from sys import argv 64 | for path in argv[1:]: 65 | print(_description_of(path)) 66 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/__main__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | support ';python -m charade [file2] ...' package execution syntax (2.7+) 3 | ''' 4 | 5 | from charade import charade_cli 6 | 7 | charade_cli() 8 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import Big5DistributionAnalysis 31 | from .mbcssm import Big5SMModel 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(Big5SMModel) 38 | self._mDistributionAnalyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "Big5" 43 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/charsetprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | from . import constants 30 | import re 31 | 32 | 33 | class CharSetProber: 34 | def __init__(self): 35 | pass 36 | 37 | def reset(self): 38 | self._mState = constants.eDetecting 39 | 40 | def get_charset_name(self): 41 | return None 42 | 43 | def feed(self, aBuf): 44 | pass 45 | 46 | def get_state(self): 47 | return self._mState 48 | 49 | def get_confidence(self): 50 | return 0.0 51 | 52 | def filter_high_bit_only(self, aBuf): 53 | aBuf = re.sub(b'([\x00-\x7F])+', b' ', aBuf) 54 | return aBuf 55 | 56 | def filter_without_english_letters(self, aBuf): 57 | aBuf = re.sub(b'([A-Za-z])+', b' ', aBuf) 58 | return aBuf 59 | 60 | def filter_with_english_letters(self, aBuf): 61 | # TODO 62 | return aBuf 63 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/codingstatemachine.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .constants import eStart 29 | from .compat import wrap_ord 30 | 31 | 32 | class CodingStateMachine: 33 | def __init__(self, sm): 34 | self._mModel = sm 35 | self._mCurrentBytePos = 0 36 | self._mCurrentCharLen = 0 37 | self.reset() 38 | 39 | def reset(self): 40 | self._mCurrentState = eStart 41 | 42 | def next_state(self, c): 43 | # for each byte we get its class 44 | # if it is first byte, we also get byte length 45 | # PY3K: aBuf is a byte stream, so c is an int, not a byte 46 | byteCls = self._mModel['classTable'][wrap_ord(c)] 47 | if self._mCurrentState == eStart: 48 | self._mCurrentBytePos = 0 49 | self._mCurrentCharLen = self._mModel['charLenTable'][byteCls] 50 | # from byte's class and stateTable, we get its next state 51 | curr_state = (self._mCurrentState * self._mModel['classFactor'] 52 | + byteCls) 53 | self._mCurrentState = self._mModel['stateTable'][curr_state] 54 | self._mCurrentBytePos += 1 55 | return self._mCurrentState 56 | 57 | def get_current_charlen(self): 58 | return self._mCurrentCharLen 59 | 60 | def get_coding_state_machine(self): 61 | return self._mModel['name'] 62 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/compat.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # Contributor(s): 3 | # Ian Cordasco - port to Python 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | # 02110-1301 USA 19 | ######################### END LICENSE BLOCK ######################### 20 | 21 | import sys 22 | 23 | 24 | if sys.version_info < (3, 0): 25 | base_str = (str, unicode) 26 | else: 27 | base_str = (bytes, str) 28 | 29 | 30 | def wrap_ord(a): 31 | if sys.version_info < (3, 0) and isinstance(a, base_str): 32 | return ord(a) 33 | else: 34 | return a 35 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/constants.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | _debug = 0 30 | 31 | eDetecting = 0 32 | eFoundIt = 1 33 | eNotMe = 2 34 | 35 | eStart = 0 36 | eError = 1 37 | eItsMe = 2 38 | 39 | SHORTCUT_THRESHOLD = 0.95 40 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/cp949prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import CP949SMModel 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(CP949SMModel) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | def get_charset_name(self): 44 | return "CP949" 45 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/euckrprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import EUCKRSMModel 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(EUCKRSMModel) 38 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "EUC-KR" 43 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/euctwprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCTWDistributionAnalysis 31 | from .mbcssm import EUCTWSMModel 32 | 33 | class EUCTWProber(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(EUCTWSMModel) 37 | self._mDistributionAnalyzer = EUCTWDistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "EUC-TW" 42 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/gb2312prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import GB2312DistributionAnalysis 31 | from .mbcssm import GB2312SMModel 32 | 33 | class GB2312Prober(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(GB2312SMModel) 37 | self._mDistributionAnalyzer = GB2312DistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "GB2312" 42 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/charade/mbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .charsetgroupprober import CharSetGroupProber 31 | from .utf8prober import UTF8Prober 32 | from .sjisprober import SJISProber 33 | from .eucjpprober import EUCJPProber 34 | from .gb2312prober import GB2312Prober 35 | from .euckrprober import EUCKRProber 36 | from .cp949prober import CP949Prober 37 | from .big5prober import Big5Prober 38 | from .euctwprober import EUCTWProber 39 | 40 | 41 | class MBCSGroupProber(CharSetGroupProber): 42 | def __init__(self): 43 | CharSetGroupProber.__init__(self) 44 | self._mProbers = [ 45 | UTF8Prober(), 46 | SJISProber(), 47 | EUCJPProber(), 48 | GB2312Prober(), 49 | EUCKRProber(), 50 | CP949Prober(), 51 | Big5Prober(), 52 | EUCTWProber() 53 | ] 54 | self.reset() 55 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/__init__.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # This library is free software; you can redistribute it and/or 3 | # modify it under the terms of the GNU Lesser General Public 4 | # License as published by the Free Software Foundation; either 5 | # version 2.1 of the License, or (at your option) any later version. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 15 | # 02110-1301 USA 16 | ######################### END LICENSE BLOCK ######################### 17 | 18 | __version__ = "2.2.1" 19 | from sys import version_info 20 | 21 | 22 | def detect(aBuf): 23 | if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 24 | (version_info >= (3, 0) and not isinstance(aBuf, bytes))): 25 | raise ValueError('Expected a bytes object, not a unicode object') 26 | 27 | from . import universaldetector 28 | u = universaldetector.UniversalDetector() 29 | u.reset() 30 | u.feed(aBuf) 31 | u.close() 32 | return u.result 33 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import Big5DistributionAnalysis 31 | from .mbcssm import Big5SMModel 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(Big5SMModel) 38 | self._mDistributionAnalyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "Big5" 43 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/chardetect.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Script which takes one or more file paths and reports on their detected 4 | encodings 5 | 6 | Example:: 7 | 8 | % chardetect somefile someotherfile 9 | somefile: windows-1252 with confidence 0.5 10 | someotherfile: ascii with confidence 1.0 11 | 12 | If no paths are provided, it takes its input from stdin. 13 | 14 | """ 15 | from io import open 16 | from sys import argv, stdin 17 | 18 | from chardet.universaldetector import UniversalDetector 19 | 20 | 21 | def description_of(file, name='stdin'): 22 | """Return a string describing the probable encoding of a file.""" 23 | u = UniversalDetector() 24 | for line in file: 25 | u.feed(line) 26 | u.close() 27 | result = u.result 28 | if result['encoding']: 29 | return '%s: %s with confidence %s' % (name, 30 | result['encoding'], 31 | result['confidence']) 32 | else: 33 | return '%s: no result' % name 34 | 35 | 36 | def main(): 37 | if len(argv) <= 1: 38 | print(description_of(stdin)) 39 | else: 40 | for path in argv[1:]: 41 | with open(path, 'rb') as f: 42 | print(description_of(f, path)) 43 | 44 | 45 | if __name__ == '__main__': 46 | main() 47 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/charsetprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | from . import constants 30 | import re 31 | 32 | 33 | class CharSetProber: 34 | def __init__(self): 35 | pass 36 | 37 | def reset(self): 38 | self._mState = constants.eDetecting 39 | 40 | def get_charset_name(self): 41 | return None 42 | 43 | def feed(self, aBuf): 44 | pass 45 | 46 | def get_state(self): 47 | return self._mState 48 | 49 | def get_confidence(self): 50 | return 0.0 51 | 52 | def filter_high_bit_only(self, aBuf): 53 | aBuf = re.sub(b'([\x00-\x7F])+', b' ', aBuf) 54 | return aBuf 55 | 56 | def filter_without_english_letters(self, aBuf): 57 | aBuf = re.sub(b'([A-Za-z])+', b' ', aBuf) 58 | return aBuf 59 | 60 | def filter_with_english_letters(self, aBuf): 61 | # TODO 62 | return aBuf 63 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/codingstatemachine.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .constants import eStart 29 | from .compat import wrap_ord 30 | 31 | 32 | class CodingStateMachine: 33 | def __init__(self, sm): 34 | self._mModel = sm 35 | self._mCurrentBytePos = 0 36 | self._mCurrentCharLen = 0 37 | self.reset() 38 | 39 | def reset(self): 40 | self._mCurrentState = eStart 41 | 42 | def next_state(self, c): 43 | # for each byte we get its class 44 | # if it is first byte, we also get byte length 45 | # PY3K: aBuf is a byte stream, so c is an int, not a byte 46 | byteCls = self._mModel['classTable'][wrap_ord(c)] 47 | if self._mCurrentState == eStart: 48 | self._mCurrentBytePos = 0 49 | self._mCurrentCharLen = self._mModel['charLenTable'][byteCls] 50 | # from byte's class and stateTable, we get its next state 51 | curr_state = (self._mCurrentState * self._mModel['classFactor'] 52 | + byteCls) 53 | self._mCurrentState = self._mModel['stateTable'][curr_state] 54 | self._mCurrentBytePos += 1 55 | return self._mCurrentState 56 | 57 | def get_current_charlen(self): 58 | return self._mCurrentCharLen 59 | 60 | def get_coding_state_machine(self): 61 | return self._mModel['name'] 62 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/compat.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # Contributor(s): 3 | # Ian Cordasco - port to Python 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | # 02110-1301 USA 19 | ######################### END LICENSE BLOCK ######################### 20 | 21 | import sys 22 | 23 | 24 | if sys.version_info < (3, 0): 25 | base_str = (str, unicode) 26 | else: 27 | base_str = (bytes, str) 28 | 29 | 30 | def wrap_ord(a): 31 | if sys.version_info < (3, 0) and isinstance(a, base_str): 32 | return ord(a) 33 | else: 34 | return a 35 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/constants.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # 13 | # This library is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU Lesser General Public 15 | # License as published by the Free Software Foundation; either 16 | # version 2.1 of the License, or (at your option) any later version. 17 | # 18 | # This library is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | # Lesser General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU Lesser General Public 24 | # License along with this library; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 26 | # 02110-1301 USA 27 | ######################### END LICENSE BLOCK ######################### 28 | 29 | _debug = 0 30 | 31 | eDetecting = 0 32 | eFoundIt = 1 33 | eNotMe = 2 34 | 35 | eStart = 0 36 | eError = 1 37 | eItsMe = 2 38 | 39 | SHORTCUT_THRESHOLD = 0.95 40 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/cp949prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import CP949SMModel 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(CP949SMModel) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | def get_charset_name(self): 44 | return "CP949" 45 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/euckrprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import EUCKRSMModel 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | MultiByteCharSetProber.__init__(self) 37 | self._mCodingSM = CodingStateMachine(EUCKRSMModel) 38 | self._mDistributionAnalyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | def get_charset_name(self): 42 | return "EUC-KR" 43 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/euctwprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCTWDistributionAnalysis 31 | from .mbcssm import EUCTWSMModel 32 | 33 | class EUCTWProber(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(EUCTWSMModel) 37 | self._mDistributionAnalyzer = EUCTWDistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "EUC-TW" 42 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/gb2312prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import GB2312DistributionAnalysis 31 | from .mbcssm import GB2312SMModel 32 | 33 | class GB2312Prober(MultiByteCharSetProber): 34 | def __init__(self): 35 | MultiByteCharSetProber.__init__(self) 36 | self._mCodingSM = CodingStateMachine(GB2312SMModel) 37 | self._mDistributionAnalyzer = GB2312DistributionAnalysis() 38 | self.reset() 39 | 40 | def get_charset_name(self): 41 | return "GB2312" 42 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .charsetgroupprober import CharSetGroupProber 31 | from .utf8prober import UTF8Prober 32 | from .sjisprober import SJISProber 33 | from .eucjpprober import EUCJPProber 34 | from .gb2312prober import GB2312Prober 35 | from .euckrprober import EUCKRProber 36 | from .cp949prober import CP949Prober 37 | from .big5prober import Big5Prober 38 | from .euctwprober import EUCTWProber 39 | 40 | 41 | class MBCSGroupProber(CharSetGroupProber): 42 | def __init__(self): 43 | CharSetGroupProber.__init__(self) 44 | self._mProbers = [ 45 | UTF8Prober(), 46 | SJISProber(), 47 | EUCJPProber(), 48 | GB2312Prober(), 49 | EUCKRProber(), 50 | CP949Prober(), 51 | Big5Prober(), 52 | EUCTWProber() 53 | ] 54 | self.reset() 55 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/urllib3/__init__.py: -------------------------------------------------------------------------------- 1 | # urllib3/__init__.py 2 | # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) 3 | # 4 | # This module is part of urllib3 and is released under 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 6 | 7 | """ 8 | urllib3 - Thread-safe connection pooling and re-using. 9 | """ 10 | 11 | __author__ = 'Andrey Petrov (andrey.petrov@shazow.net)' 12 | __license__ = 'MIT' 13 | __version__ = 'dev' 14 | 15 | 16 | from .connectionpool import ( 17 | HTTPConnectionPool, 18 | HTTPSConnectionPool, 19 | connection_from_url 20 | ) 21 | 22 | from . import exceptions 23 | from .filepost import encode_multipart_formdata 24 | from .poolmanager import PoolManager, ProxyManager, proxy_from_url 25 | from .response import HTTPResponse 26 | from .util import make_headers, get_host, Timeout 27 | 28 | 29 | # Set default logging handler to avoid "No handler found" warnings. 30 | import logging 31 | try: # Python 2.7+ 32 | from logging import NullHandler 33 | except ImportError: 34 | class NullHandler(logging.Handler): 35 | def emit(self, record): 36 | pass 37 | 38 | logging.getLogger(__name__).addHandler(NullHandler()) 39 | 40 | def add_stderr_logger(level=logging.DEBUG): 41 | """ 42 | Helper for quickly adding a StreamHandler to the logger. Useful for 43 | debugging. 44 | 45 | Returns the handler after adding it. 46 | """ 47 | # This method needs to be in this __init__.py to get the __name__ correct 48 | # even if urllib3 is vendored within another package. 49 | logger = logging.getLogger(__name__) 50 | handler = logging.StreamHandler() 51 | handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s')) 52 | logger.addHandler(handler) 53 | logger.setLevel(level) 54 | logger.debug('Added an stderr logging handler to logger: %s' % __name__) 55 | return handler 56 | 57 | # ... Clean up. 58 | del NullHandler 59 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/pip-1.5.4/pip/_vendor/requests/packages/urllib3/contrib/__init__.py -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/urllib3/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import ssl_match_hostname 4 | 5 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | # Python 3.2+ 3 | from ssl import CertificateError, match_hostname 4 | except ImportError: 5 | try: 6 | # Backport of the function from a pypi module 7 | from backports.ssl_match_hostname import CertificateError, match_hostname 8 | except ImportError: 9 | # Our vendored copy 10 | from _implementation import CertificateError, match_hostname 11 | 12 | # Not needed, but documenting what we provide. 13 | __all__ = ('CertificateError', 'match_hostname') 14 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Package containing all pip commands 3 | """ 4 | 5 | 6 | from pip.commands.bundle import BundleCommand 7 | from pip.commands.completion import CompletionCommand 8 | from pip.commands.freeze import FreezeCommand 9 | from pip.commands.help import HelpCommand 10 | from pip.commands.list import ListCommand 11 | from pip.commands.search import SearchCommand 12 | from pip.commands.show import ShowCommand 13 | from pip.commands.install import InstallCommand 14 | from pip.commands.uninstall import UninstallCommand 15 | from pip.commands.unzip import UnzipCommand 16 | from pip.commands.zip import ZipCommand 17 | from pip.commands.wheel import WheelCommand 18 | 19 | 20 | commands = { 21 | BundleCommand.name: BundleCommand, 22 | CompletionCommand.name: CompletionCommand, 23 | FreezeCommand.name: FreezeCommand, 24 | HelpCommand.name: HelpCommand, 25 | SearchCommand.name: SearchCommand, 26 | ShowCommand.name: ShowCommand, 27 | InstallCommand.name: InstallCommand, 28 | UninstallCommand.name: UninstallCommand, 29 | UnzipCommand.name: UnzipCommand, 30 | ZipCommand.name: ZipCommand, 31 | ListCommand.name: ListCommand, 32 | WheelCommand.name: WheelCommand, 33 | } 34 | 35 | 36 | commands_order = [ 37 | InstallCommand, 38 | UninstallCommand, 39 | FreezeCommand, 40 | ListCommand, 41 | ShowCommand, 42 | SearchCommand, 43 | WheelCommand, 44 | ZipCommand, 45 | UnzipCommand, 46 | BundleCommand, 47 | HelpCommand, 48 | ] 49 | 50 | 51 | def get_summaries(ignore_hidden=True, ordered=True): 52 | """Yields sorted (command name, command summary) tuples.""" 53 | 54 | if ordered: 55 | cmditems = _sort_commands(commands, commands_order) 56 | else: 57 | cmditems = commands.items() 58 | 59 | for name, command_class in cmditems: 60 | if ignore_hidden and command_class.hidden: 61 | continue 62 | 63 | yield (name, command_class.summary) 64 | 65 | 66 | def get_similar_commands(name): 67 | """Command name auto-correct.""" 68 | from difflib import get_close_matches 69 | 70 | close_commands = get_close_matches(name, commands.keys()) 71 | 72 | if close_commands: 73 | guess = close_commands[0] 74 | else: 75 | guess = False 76 | 77 | return guess 78 | 79 | 80 | def _sort_commands(cmddict, order): 81 | def keyfn(key): 82 | try: 83 | return order.index(key[1]) 84 | except ValueError: 85 | # unordered items should come last 86 | return 0xff 87 | 88 | return sorted(cmddict.items(), key=keyfn) 89 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/bundle.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | from pip.locations import build_prefix, src_prefix 3 | from pip.util import display_path, backup_dir 4 | from pip.log import logger 5 | from pip.exceptions import InstallationError 6 | from pip.commands.install import InstallCommand 7 | 8 | 9 | class BundleCommand(InstallCommand): 10 | """Create pybundles (archives containing multiple packages).""" 11 | name = 'bundle' 12 | usage = """ 13 | %prog [options] .pybundle ...""" 14 | summary = 'DEPRECATED. Create pybundles.' 15 | bundle = True 16 | 17 | def __init__(self, *args, **kw): 18 | super(BundleCommand, self).__init__(*args, **kw) 19 | # bundle uses different default source and build dirs 20 | build_opt = self.parser.get_option("--build") 21 | build_opt.default = backup_dir(build_prefix, '-bundle') 22 | src_opt = self.parser.get_option("--src") 23 | src_opt.default = backup_dir(src_prefix, '-bundle') 24 | self.parser.set_defaults(**{ 25 | src_opt.dest: src_opt.default, 26 | build_opt.dest: build_opt.default, 27 | }) 28 | 29 | def run(self, options, args): 30 | 31 | logger.deprecated('1.6', "DEPRECATION: 'pip bundle' and support for installing from *.pybundle files is deprecated. " 32 | "See https://github.com/pypa/pip/pull/1046") 33 | 34 | if not args: 35 | raise InstallationError('You must give a bundle filename') 36 | # We have to get everything when creating a bundle: 37 | options.ignore_installed = True 38 | logger.notify('Putting temporary build files in %s and source/develop files in %s' 39 | % (display_path(options.build_dir), display_path(options.src_dir))) 40 | self.bundle_filename = args.pop(0) 41 | requirement_set = super(BundleCommand, self).run(options, args) 42 | return requirement_set 43 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/completion.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from pip.basecommand import Command 3 | 4 | BASE_COMPLETION = """ 5 | # pip %(shell)s completion start%(script)s# pip %(shell)s completion end 6 | """ 7 | 8 | COMPLETION_SCRIPTS = { 9 | 'bash': """ 10 | _pip_completion() 11 | { 12 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ 13 | COMP_CWORD=$COMP_CWORD \\ 14 | PIP_AUTO_COMPLETE=1 $1 ) ) 15 | } 16 | complete -o default -F _pip_completion pip 17 | """, 'zsh': """ 18 | function _pip_completion { 19 | local words cword 20 | read -Ac words 21 | read -cn cword 22 | reply=( $( COMP_WORDS="$words[*]" \\ 23 | COMP_CWORD=$(( cword-1 )) \\ 24 | PIP_AUTO_COMPLETE=1 $words[1] ) ) 25 | } 26 | compctl -K _pip_completion pip 27 | """} 28 | 29 | 30 | class CompletionCommand(Command): 31 | """A helper command to be used for command completion.""" 32 | name = 'completion' 33 | summary = 'A helper command to be used for command completion' 34 | hidden = True 35 | 36 | def __init__(self, *args, **kw): 37 | super(CompletionCommand, self).__init__(*args, **kw) 38 | self.parser.add_option( 39 | '--bash', '-b', 40 | action='store_const', 41 | const='bash', 42 | dest='shell', 43 | help='Emit completion code for bash') 44 | self.parser.add_option( 45 | '--zsh', '-z', 46 | action='store_const', 47 | const='zsh', 48 | dest='shell', 49 | help='Emit completion code for zsh') 50 | 51 | def run(self, options, args): 52 | """Prints the completion code of the given shell""" 53 | shells = COMPLETION_SCRIPTS.keys() 54 | shell_options = ['--' + shell for shell in sorted(shells)] 55 | if options.shell in shells: 56 | script = COMPLETION_SCRIPTS.get(options.shell, '') 57 | print(BASE_COMPLETION % {'script': script, 'shell': options.shell}) 58 | else: 59 | sys.stderr.write('ERROR: You must pass %s\n' % ' or '.join(shell_options)) 60 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/help.py: -------------------------------------------------------------------------------- 1 | from pip.basecommand import Command, SUCCESS 2 | from pip.exceptions import CommandError 3 | 4 | 5 | class HelpCommand(Command): 6 | """Show help for commands""" 7 | name = 'help' 8 | usage = """ 9 | %prog """ 10 | summary = 'Show help for commands.' 11 | 12 | def run(self, options, args): 13 | from pip.commands import commands, get_similar_commands 14 | 15 | try: 16 | # 'pip help' with no args is handled by pip.__init__.parseopt() 17 | cmd_name = args[0] # the command we need help for 18 | except IndexError: 19 | return SUCCESS 20 | 21 | if cmd_name not in commands: 22 | guess = get_similar_commands(cmd_name) 23 | 24 | msg = ['unknown command "%s"' % cmd_name] 25 | if guess: 26 | msg.append('maybe you meant "%s"' % guess) 27 | 28 | raise CommandError(' - '.join(msg)) 29 | 30 | command = commands[cmd_name]() 31 | command.parser.print_help() 32 | 33 | return SUCCESS 34 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/uninstall.py: -------------------------------------------------------------------------------- 1 | from pip.req import InstallRequirement, RequirementSet, parse_requirements 2 | from pip.basecommand import Command 3 | from pip.exceptions import InstallationError 4 | 5 | 6 | class UninstallCommand(Command): 7 | """ 8 | Uninstall packages. 9 | 10 | pip is able to uninstall most installed packages. Known exceptions are: 11 | 12 | - Pure distutils packages installed with ``python setup.py install``, which 13 | leave behind no metadata to determine what files were installed. 14 | - Script wrappers installed by ``python setup.py develop``. 15 | """ 16 | name = 'uninstall' 17 | usage = """ 18 | %prog [options] ... 19 | %prog [options] -r ...""" 20 | summary = 'Uninstall packages.' 21 | 22 | def __init__(self, *args, **kw): 23 | super(UninstallCommand, self).__init__(*args, **kw) 24 | self.cmd_opts.add_option( 25 | '-r', '--requirement', 26 | dest='requirements', 27 | action='append', 28 | default=[], 29 | metavar='file', 30 | help='Uninstall all the packages listed in the given requirements file. ' 31 | 'This option can be used multiple times.') 32 | self.cmd_opts.add_option( 33 | '-y', '--yes', 34 | dest='yes', 35 | action='store_true', 36 | help="Don't ask for confirmation of uninstall deletions.") 37 | 38 | self.parser.insert_option_group(0, self.cmd_opts) 39 | 40 | def run(self, options, args): 41 | session = self._build_session(options) 42 | 43 | requirement_set = RequirementSet( 44 | build_dir=None, 45 | src_dir=None, 46 | download_dir=None, 47 | session=session, 48 | ) 49 | for name in args: 50 | requirement_set.add_requirement( 51 | InstallRequirement.from_line(name)) 52 | for filename in options.requirements: 53 | for req in parse_requirements(filename, 54 | options=options, session=session): 55 | requirement_set.add_requirement(req) 56 | if not requirement_set.has_requirements: 57 | raise InstallationError('You must give at least one requirement ' 58 | 'to %(name)s (see "pip help %(name)s")' % dict(name=self.name)) 59 | requirement_set.uninstall(auto_confirm=options.yes) 60 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/commands/unzip.py: -------------------------------------------------------------------------------- 1 | from pip.commands.zip import ZipCommand 2 | 3 | 4 | class UnzipCommand(ZipCommand): 5 | """Unzip individual packages.""" 6 | name = 'unzip' 7 | summary = 'DEPRECATED. Unzip individual packages.' 8 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/exceptions.py: -------------------------------------------------------------------------------- 1 | """Exceptions used throughout package""" 2 | 3 | 4 | class PipError(Exception): 5 | """Base pip exception""" 6 | 7 | 8 | class InstallationError(PipError): 9 | """General exception during installation""" 10 | 11 | 12 | class UninstallationError(PipError): 13 | """General exception during uninstallation""" 14 | 15 | 16 | class DistributionNotFound(InstallationError): 17 | """Raised when a distribution cannot be found to satisfy a requirement""" 18 | 19 | 20 | class BestVersionAlreadyInstalled(PipError): 21 | """Raised when the most up-to-date version of a package is already 22 | installed. """ 23 | 24 | 25 | class BadCommand(PipError): 26 | """Raised when virtualenv or a command is not found""" 27 | 28 | 29 | class CommandError(PipError): 30 | """Raised when there is an error in command-line arguments""" 31 | 32 | 33 | class PreviousBuildDirError(PipError): 34 | """Raised when there's a previous conflicting build directory""" 35 | 36 | 37 | class HashMismatch(InstallationError): 38 | """Distribution file hash values don't match.""" 39 | 40 | 41 | class InvalidWheelFilename(InstallationError): 42 | """Invalid wheel filename.""" 43 | 44 | 45 | class UnsupportedWheel(InstallationError): 46 | """Unsupported wheel.""" 47 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/runner.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | 5 | def run(): 6 | base = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 7 | ## FIXME: this is kind of crude; if we could create a fake pip 8 | ## module, then exec into it and update pip.__path__ properly, we 9 | ## wouldn't have to update sys.path: 10 | sys.path.insert(0, base) 11 | import pip 12 | return pip.main() 13 | 14 | 15 | if __name__ == '__main__': 16 | exit = run() 17 | if exit: 18 | sys.exit(exit) 19 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/pip/status_codes.py: -------------------------------------------------------------------------------- 1 | SUCCESS = 0 2 | ERROR = 1 3 | UNKNOWN_ERROR = 2 4 | VIRTUALENV_NOT_FOUND = 3 5 | PREVIOUS_BUILD_DIR_ERROR = 4 6 | NO_MATCHES_FOUND = 23 7 | -------------------------------------------------------------------------------- /vendor/pip-1.5.4/setup.cfg: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --ignore pip/_vendor --ignore tests/tests_cache 3 | 4 | [wheel] 5 | universal = 1 6 | 7 | [egg_info] 8 | tag_build = 9 | tag_date = 0 10 | tag_svn_revision = 0 11 | 12 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/CONTRIBUTORS.txt: -------------------------------------------------------------------------------- 1 | ============ 2 | Contributors 3 | ============ 4 | 5 | * Alex Grönholm 6 | * Alice Bevan-McGregor 7 | * Arfrever Frehtes Taifersar Arahesis 8 | * Christophe Combelles 9 | * Daniel Stutzbach 10 | * Daniel Holth 11 | * Dirley Rodrigues 12 | * Donald Stufft 13 | * Grigory Petrov 14 | * Hanno Schlichting 15 | * Jannis Leidel 16 | * Jason R. Coombs 17 | * Jim Fulton 18 | * Jonathan Lange 19 | * Justin Azoff 20 | * Lennart Regebro 21 | * Marc Abramowitz 22 | * Martin von Löwis 23 | * Noufal Ibrahim 24 | * Pedro Algarvio 25 | * Pete Hollobon 26 | * Phillip J. Eby 27 | * Philip Jenvey 28 | * Philip Thiem 29 | * Reinout van Rees 30 | * Robert Myers 31 | * Stefan H. Holek 32 | * Tarek Ziadé 33 | * Toshio Kuratomi 34 | 35 | If you think you name is missing, please add it (alpha order by first name) 36 | 37 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/DEVGUIDE.txt: -------------------------------------------------------------------------------- 1 | ============================ 2 | Quick notes for contributors 3 | ============================ 4 | 5 | Setuptools is developed using the DVCS Mercurial. 6 | 7 | Grab the code at bitbucket:: 8 | 9 | $ hg clone https://bitbucket.org/pypa/setuptools 10 | 11 | If you want to contribute changes, we recommend you fork the repository on 12 | bitbucket, commit the changes to your repository, and then make a pull request 13 | on bitbucket. If you make some changes, don't forget to: 14 | 15 | - add a note in CHANGES.txt 16 | 17 | Please commit bug-fixes against the current maintenance branch and new 18 | features to the default branch. 19 | 20 | You can run the tests via:: 21 | 22 | $ python setup.py test 23 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include setuptools *.py *.txt *.exe *.xml 2 | recursive-include tests *.py *.c *.pyx *.txt 3 | recursive-include setuptools/tests *.html entries* 4 | recursive-include setuptools/tests/svn_data *.zip 5 | recursive-include docs *.py *.txt *.conf *.css *.css_t Makefile indexsidebar.html 6 | recursive-include _markerlib *.py 7 | include *.py 8 | include *.txt 9 | include MANIFEST.in 10 | include launcher.c 11 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/_markerlib/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ast 3 | from _markerlib.markers import default_environment, compile, interpret 4 | except ImportError: 5 | if 'ast' in globals(): 6 | raise 7 | def default_environment(): 8 | return {} 9 | def compile(marker): 10 | def marker_fn(environment=None, override=None): 11 | # 'empty markers are True' heuristic won't install extra deps. 12 | return not marker.strip() 13 | marker_fn.__doc__ = marker 14 | return marker_fn 15 | def interpret(marker, environment=None, override=None): 16 | return compile(marker)() 17 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | 9 | # Internal variables. 10 | PAPEROPT_a4 = -D latex_paper_size=a4 11 | PAPEROPT_letter = -D latex_paper_size=letter 12 | ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 13 | 14 | .PHONY: help clean html web pickle htmlhelp latex changes linkcheck 15 | 16 | help: 17 | @echo "Please use \`make ' where is one of" 18 | @echo " html to make standalone HTML files" 19 | @echo " pickle to make pickle files" 20 | @echo " json to make JSON files" 21 | @echo " htmlhelp to make HTML files and a HTML help project" 22 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 23 | @echo " changes to make an overview over all changed/added/deprecated items" 24 | @echo " linkcheck to check all external links for integrity" 25 | 26 | clean: 27 | -rm -rf build/* 28 | 29 | html: 30 | mkdir -p build/html build/doctrees 31 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html 32 | @echo 33 | @echo "Build finished. The HTML pages are in build/html." 34 | 35 | pickle: 36 | mkdir -p build/pickle build/doctrees 37 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle 38 | @echo 39 | @echo "Build finished; now you can process the pickle files." 40 | 41 | web: pickle 42 | 43 | json: 44 | mkdir -p build/json build/doctrees 45 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json 46 | @echo 47 | @echo "Build finished; now you can process the JSON files." 48 | 49 | htmlhelp: 50 | mkdir -p build/htmlhelp build/doctrees 51 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp 52 | @echo 53 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 54 | ".hhp project file in build/htmlhelp." 55 | 56 | latex: 57 | mkdir -p build/latex build/doctrees 58 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex 59 | @echo 60 | @echo "Build finished; the LaTeX files are in build/latex." 61 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ 62 | "run these through (pdf)latex." 63 | 64 | changes: 65 | mkdir -p build/changes build/doctrees 66 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes 67 | @echo 68 | @echo "The overview file is in build/changes." 69 | 70 | linkcheck: 71 | mkdir -p build/linkcheck build/doctrees 72 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck 73 | @echo 74 | @echo "Link check complete; look for any errors in the above output " \ 75 | "or in build/linkcheck/output.txt." 76 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/_templates/indexsidebar.html: -------------------------------------------------------------------------------- 1 |

Download

2 | 3 |

Current version: {{ version }}

4 |

Get Setuptools from the Python Package Index 5 | 6 |

Questions? Suggestions? Contributions?

7 | 8 |

Visit the Setuptools project page

9 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/_theme/nature/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = nature.css 4 | pygments_style = tango 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/development.txt: -------------------------------------------------------------------------------- 1 | ------------------------- 2 | Development on Setuptools 3 | ------------------------- 4 | 5 | Setuptools is maintained by the Python community under the Python Packaging 6 | Authority (PyPA) and led by Jason R. Coombs. 7 | 8 | This document describes the process by which Setuptools is developed. 9 | This document assumes the reader has some passing familiarity with 10 | *using* setuptools, the ``pkg_resources`` module, and EasyInstall. It 11 | does not attempt to explain basic concepts like inter-project 12 | dependencies, nor does it contain detailed lexical syntax for most 13 | file formats. Neither does it explain concepts like "namespace 14 | packages" or "resources" in any detail, as all of these subjects are 15 | covered at length in the setuptools developer's guide and the 16 | ``pkg_resources`` reference manual. 17 | 18 | Instead, this is **internal** documentation for how those concepts and 19 | features are *implemented* in concrete terms. It is intended for people 20 | who are working on the setuptools code base, who want to be able to 21 | troubleshoot setuptools problems, want to write code that reads the file 22 | formats involved, or want to otherwise tinker with setuptools-generated 23 | files and directories. 24 | 25 | Note, however, that these are all internal implementation details and 26 | are therefore subject to change; stick to the published API if you don't 27 | want to be responsible for keeping your code from breaking when 28 | setuptools changes. You have been warned. 29 | 30 | .. toctree:: 31 | :maxdepth: 1 32 | 33 | formats 34 | releases 35 | 36 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/index.txt: -------------------------------------------------------------------------------- 1 | Welcome to Setuptools' documentation! 2 | ===================================== 3 | 4 | Setuptools is a fully-featured, actively-maintained, and stable library 5 | designed to facilitate packaging Python projects, where packaging includes: 6 | 7 | - Python package and module definitions 8 | - Distribution package metadata 9 | - Test hooks 10 | - Project installation 11 | - Platform-specific details 12 | - Python 3 support 13 | 14 | Documentation content: 15 | 16 | .. toctree:: 17 | :maxdepth: 2 18 | 19 | roadmap 20 | python3 21 | using 22 | setuptools 23 | easy_install 24 | pkg_resources 25 | development 26 | merge 27 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/releases.txt: -------------------------------------------------------------------------------- 1 | =============== 2 | Release Process 3 | =============== 4 | 5 | In order to allow for rapid, predictable releases, Setuptools uses a 6 | mechanical technique for releases. The release script, ``release.py`` in the 7 | repository, defines the details of the releases, and is executed by the 8 | `jaraco.packaging `_ release 9 | module. The script does some checks (some interactive) and fully automates 10 | the release process. 11 | 12 | A Setuptools release manager must have maintainer access on PyPI to the 13 | project and administrative access to the BitBucket project. 14 | 15 | Release Managers 16 | ---------------- 17 | 18 | Currently, the project has one release manager, Jason R. Coombs. 19 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/roadmap.txt: -------------------------------------------------------------------------------- 1 | ======= 2 | Roadmap 3 | ======= 4 | 5 | Setuptools is primarily in maintenance mode. The project attempts to address 6 | user issues, concerns, and feature requests in a timely fashion. 7 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/docs/using.txt: -------------------------------------------------------------------------------- 1 | ================================ 2 | Using Setuptools in your project 3 | ================================ 4 | 5 | To use Setuptools in your project, the recommended way is to ship 6 | `ez_setup.py` alongside your `setup.py` script and call 7 | it at the very beginning of `setup.py` like this:: 8 | 9 | from ez_setup import use_setuptools 10 | use_setuptools() 11 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/easy_install.py: -------------------------------------------------------------------------------- 1 | """Run the EasyInstall command""" 2 | 3 | if __name__ == '__main__': 4 | from setuptools.command.easy_install import main 5 | main() 6 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = 3 | tag_svn_revision = 0 4 | tag_date = 0 5 | 6 | [aliases] 7 | release = egg_info -RDb '' 8 | source = register sdist binary 9 | binary = bdist_egg upload --show-response 10 | 11 | [build_sphinx] 12 | source-dir = docs/ 13 | build-dir = docs/build 14 | all_files = 1 15 | 16 | [upload_docs] 17 | upload-dir = docs/build/html 18 | 19 | [sdist] 20 | formats = gztar 21 | 22 | [wheel] 23 | universal = 1 24 | 25 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | https://pypi.python.org/packages/source/c/certifi/certifi-0.0.8.tar.gz#md5=dc5f5e7f0b5fc08d27654b17daa6ecec 2 | https://pypi.python.org/packages/source/w/wincertstore/wincertstore-0.1.zip#md5=2f9accbebe8f7b4c06ac7aa83879b81c 3 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | [ssl:sys_platform=='win32'] 4 | wincertstore==0.1 5 | 6 | [certs] 7 | certifi==0.0.8 -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools.egg-info/requires.txt.orig: -------------------------------------------------------------------------------- 1 | 2 | 3 | [ssl:sys_platform=='win32'] 4 | wincertstore==0.1 5 | 6 | [certs] 7 | certifi==0.0.8 -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | pkg_resources 2 | setuptools 3 | _markerlib 4 | easy_install 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools.egg-info/zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/cli-32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/cli-32.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/cli-64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/cli-64.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/cli-arm-32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/cli-arm-32.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/cli.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = [ 2 | 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', 3 | 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', 4 | 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts', 5 | 'register', 'bdist_wininst', 'upload_docs', 6 | ] 7 | 8 | from setuptools.command import install_scripts 9 | import sys 10 | 11 | from distutils.command.bdist import bdist 12 | 13 | if 'egg' not in bdist.format_commands: 14 | bdist.format_command['egg'] = ('bdist_egg', "Python .egg file") 15 | bdist.format_commands.append('egg') 16 | 17 | del bdist, sys 18 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/bdist_rpm.py: -------------------------------------------------------------------------------- 1 | # This is just a kludge so that bdist_rpm doesn't guess wrong about the 2 | # distribution name and version, if the egg_info command is going to alter 3 | # them, another kludge to allow you to build old-style non-egg RPMs, and 4 | # finally, a kludge to track .rpm files for uploading when run on Python <2.5. 5 | 6 | from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm 7 | import sys, os 8 | 9 | class bdist_rpm(_bdist_rpm): 10 | 11 | def initialize_options(self): 12 | _bdist_rpm.initialize_options(self) 13 | self.no_egg = None 14 | 15 | if sys.version<"2.5": 16 | # Track for uploading any .rpm file(s) moved to self.dist_dir 17 | def move_file(self, src, dst, level=1): 18 | _bdist_rpm.move_file(self, src, dst, level) 19 | if dst==self.dist_dir and src.endswith('.rpm'): 20 | getattr(self.distribution,'dist_files',[]).append( 21 | ('bdist_rpm', 22 | src.endswith('.src.rpm') and 'any' or sys.version[:3], 23 | os.path.join(dst, os.path.basename(src))) 24 | ) 25 | 26 | def run(self): 27 | self.run_command('egg_info') # ensure distro name is up-to-date 28 | _bdist_rpm.run(self) 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | def _make_spec_file(self): 43 | version = self.distribution.get_version() 44 | rpmversion = version.replace('-','_') 45 | spec = _bdist_rpm._make_spec_file(self) 46 | line23 = '%define version '+version 47 | line24 = '%define version '+rpmversion 48 | spec = [ 49 | line.replace( 50 | "Source0: %{name}-%{version}.tar", 51 | "Source0: %{name}-%{unmangled_version}.tar" 52 | ).replace( 53 | "setup.py install ", 54 | "setup.py install --single-version-externally-managed " 55 | ).replace( 56 | "%setup", 57 | "%setup -n %{name}-%{unmangled_version}" 58 | ).replace(line23,line24) 59 | for line in spec 60 | ] 61 | spec.insert(spec.index(line24)+1, "%define unmangled_version "+version) 62 | return spec 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/bdist_wininst.py: -------------------------------------------------------------------------------- 1 | from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst 2 | import os, sys 3 | 4 | class bdist_wininst(_bdist_wininst): 5 | _good_upload = _bad_upload = None 6 | 7 | def create_exe(self, arcname, fullname, bitmap=None): 8 | _bdist_wininst.create_exe(self, arcname, fullname, bitmap) 9 | installer_name = self.get_installer_filename(fullname) 10 | if self.target_version: 11 | pyversion = self.target_version 12 | # fix 2.5+ bdist_wininst ignoring --target-version spec 13 | self._bad_upload = ('bdist_wininst', 'any', installer_name) 14 | else: 15 | pyversion = 'any' 16 | self._good_upload = ('bdist_wininst', pyversion, installer_name) 17 | 18 | def _fix_upload_names(self): 19 | good, bad = self._good_upload, self._bad_upload 20 | dist_files = getattr(self.distribution, 'dist_files', []) 21 | if bad in dist_files: 22 | dist_files.remove(bad) 23 | if good not in dist_files: 24 | dist_files.append(good) 25 | 26 | def reinitialize_command (self, command, reinit_subcommands=0): 27 | cmd = self.distribution.reinitialize_command( 28 | command, reinit_subcommands) 29 | if command in ('install', 'install_lib'): 30 | cmd.install_lib = None # work around distutils bug 31 | return cmd 32 | 33 | def run(self): 34 | self._is_running = True 35 | try: 36 | _bdist_wininst.run(self) 37 | self._fix_upload_names() 38 | finally: 39 | self._is_running = False 40 | 41 | 42 | if not hasattr(_bdist_wininst, 'get_installer_filename'): 43 | def get_installer_filename(self, fullname): 44 | # Factored out to allow overriding in subclasses 45 | if self.target_version: 46 | # if we create an installer for a specific python version, 47 | # it's better to include this in the name 48 | installer_name = os.path.join(self.dist_dir, 49 | "%s.win32-py%s.exe" % 50 | (fullname, self.target_version)) 51 | else: 52 | installer_name = os.path.join(self.dist_dir, 53 | "%s.win32.exe" % fullname) 54 | return installer_name 55 | # get_installer_filename() 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/install_scripts.py: -------------------------------------------------------------------------------- 1 | from distutils.command.install_scripts import install_scripts \ 2 | as _install_scripts 3 | from pkg_resources import Distribution, PathMetadata, ensure_directory 4 | import os 5 | from distutils import log 6 | 7 | class install_scripts(_install_scripts): 8 | """Do normal script install, plus any egg_info wrapper scripts""" 9 | 10 | def initialize_options(self): 11 | _install_scripts.initialize_options(self) 12 | self.no_ep = False 13 | 14 | def run(self): 15 | from setuptools.command.easy_install import get_script_args 16 | from setuptools.command.easy_install import sys_executable 17 | 18 | self.run_command("egg_info") 19 | if self.distribution.scripts: 20 | _install_scripts.run(self) # run first to set up self.outfiles 21 | else: 22 | self.outfiles = [] 23 | if self.no_ep: 24 | # don't install entry point scripts into .egg file! 25 | return 26 | 27 | ei_cmd = self.get_finalized_command("egg_info") 28 | dist = Distribution( 29 | ei_cmd.egg_base, PathMetadata(ei_cmd.egg_base, ei_cmd.egg_info), 30 | ei_cmd.egg_name, ei_cmd.egg_version, 31 | ) 32 | bs_cmd = self.get_finalized_command('build_scripts') 33 | executable = getattr(bs_cmd,'executable',sys_executable) 34 | is_wininst = getattr( 35 | self.get_finalized_command("bdist_wininst"), '_is_running', False 36 | ) 37 | for args in get_script_args(dist, executable, is_wininst): 38 | self.write_script(*args) 39 | 40 | def write_script(self, script_name, contents, mode="t", *ignored): 41 | """Write an executable file to the scripts directory""" 42 | from setuptools.command.easy_install import chmod, current_umask 43 | log.info("Installing %s script to %s", script_name, self.install_dir) 44 | target = os.path.join(self.install_dir, script_name) 45 | self.outfiles.append(target) 46 | 47 | mask = current_umask() 48 | if not self.dry_run: 49 | ensure_directory(target) 50 | f = open(target,"w"+mode) 51 | f.write(contents) 52 | f.close() 53 | chmod(target, 0x1FF-mask) # 0777 54 | 55 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/launcher manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/register.py: -------------------------------------------------------------------------------- 1 | from distutils.command.register import register as _register 2 | 3 | class register(_register): 4 | __doc__ = _register.__doc__ 5 | 6 | def run(self): 7 | # Make sure that we are using valid current name/version info 8 | self.run_command('egg_info') 9 | _register.run(self) 10 | 11 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/rotate.py: -------------------------------------------------------------------------------- 1 | import distutils, os 2 | from setuptools import Command 3 | from setuptools.compat import basestring 4 | from distutils.util import convert_path 5 | from distutils import log 6 | from distutils.errors import * 7 | 8 | class rotate(Command): 9 | """Delete older distributions""" 10 | 11 | description = "delete older distributions, keeping N newest files" 12 | user_options = [ 13 | ('match=', 'm', "patterns to match (required)"), 14 | ('dist-dir=', 'd', "directory where the distributions are"), 15 | ('keep=', 'k', "number of matching distributions to keep"), 16 | ] 17 | 18 | boolean_options = [] 19 | 20 | def initialize_options(self): 21 | self.match = None 22 | self.dist_dir = None 23 | self.keep = None 24 | 25 | def finalize_options(self): 26 | if self.match is None: 27 | raise DistutilsOptionError( 28 | "Must specify one or more (comma-separated) match patterns " 29 | "(e.g. '.zip' or '.egg')" 30 | ) 31 | if self.keep is None: 32 | raise DistutilsOptionError("Must specify number of files to keep") 33 | try: 34 | self.keep = int(self.keep) 35 | except ValueError: 36 | raise DistutilsOptionError("--keep must be an integer") 37 | if isinstance(self.match, basestring): 38 | self.match = [ 39 | convert_path(p.strip()) for p in self.match.split(',') 40 | ] 41 | self.set_undefined_options('bdist',('dist_dir', 'dist_dir')) 42 | 43 | def run(self): 44 | self.run_command("egg_info") 45 | from glob import glob 46 | for pattern in self.match: 47 | pattern = self.distribution.get_name()+'*'+pattern 48 | files = glob(os.path.join(self.dist_dir,pattern)) 49 | files = [(os.path.getmtime(f),f) for f in files] 50 | files.sort() 51 | files.reverse() 52 | 53 | log.info("%d file(s) matching %s", len(files), pattern) 54 | files = files[self.keep:] 55 | for (t,f) in files: 56 | log.info("Deleting %s", f) 57 | if not self.dry_run: 58 | os.unlink(f) 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/command/saveopts.py: -------------------------------------------------------------------------------- 1 | import distutils, os 2 | from setuptools import Command 3 | from setuptools.command.setopt import edit_config, option_base 4 | 5 | class saveopts(option_base): 6 | """Save command-line options to a file""" 7 | 8 | description = "save supplied options to setup.cfg or other config file" 9 | 10 | def run(self): 11 | dist = self.distribution 12 | settings = {} 13 | 14 | for cmd in dist.command_options: 15 | 16 | if cmd=='saveopts': 17 | continue # don't save our own options! 18 | 19 | for opt,(src,val) in dist.get_option_dict(cmd).items(): 20 | if src=="command line": 21 | settings.setdefault(cmd,{})[opt] = val 22 | 23 | edit_config(self.filename, settings, self.dry_run) 24 | 25 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/extension.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import distutils.core 3 | import distutils.extension 4 | 5 | from setuptools.dist import _get_unpatched 6 | 7 | _Extension = _get_unpatched(distutils.core.Extension) 8 | 9 | def have_pyrex(): 10 | """ 11 | Return True if Cython or Pyrex can be imported. 12 | """ 13 | pyrex_impls = 'Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext' 14 | for pyrex_impl in pyrex_impls: 15 | try: 16 | # from (pyrex_impl) import build_ext 17 | __import__(pyrex_impl, fromlist=['build_ext']).build_ext 18 | return True 19 | except Exception: 20 | pass 21 | return False 22 | 23 | 24 | class Extension(_Extension): 25 | """Extension that uses '.c' files in place of '.pyx' files""" 26 | 27 | def __init__(self, *args, **kw): 28 | _Extension.__init__(self, *args, **kw) 29 | if not have_pyrex(): 30 | self._convert_pyx_sources_to_c() 31 | 32 | def _convert_pyx_sources_to_c(self): 33 | "convert .pyx extensions to .c" 34 | def pyx_to_c(source): 35 | if source.endswith('.pyx'): 36 | source = source[:-4] + '.c' 37 | return source 38 | self.sources = list(map(pyx_to_c, self.sources)) 39 | 40 | class Library(Extension): 41 | """Just like a regular Extension, but built as a library instead""" 42 | 43 | distutils.core.Extension = Extension 44 | distutils.extension.Extension = Extension 45 | if 'distutils.command.build_ext' in sys.modules: 46 | sys.modules['distutils.command.build_ext'].Extension = Extension 47 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/gui-32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/gui-32.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/gui-64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/gui-64.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/gui-arm-32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/gui-arm-32.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/gui.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/gui.exe -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/lib2to3_ex.py: -------------------------------------------------------------------------------- 1 | """ 2 | Customized Mixin2to3 support: 3 | 4 | - adds support for converting doctests 5 | 6 | 7 | This module raises an ImportError on Python 2. 8 | """ 9 | 10 | from distutils.util import Mixin2to3 as _Mixin2to3 11 | from distutils import log 12 | from lib2to3.refactor import RefactoringTool, get_fixers_from_package 13 | import setuptools 14 | 15 | class DistutilsRefactoringTool(RefactoringTool): 16 | def log_error(self, msg, *args, **kw): 17 | log.error(msg, *args) 18 | 19 | def log_message(self, msg, *args): 20 | log.info(msg, *args) 21 | 22 | def log_debug(self, msg, *args): 23 | log.debug(msg, *args) 24 | 25 | class Mixin2to3(_Mixin2to3): 26 | def run_2to3(self, files, doctests = False): 27 | # See of the distribution option has been set, otherwise check the 28 | # setuptools default. 29 | if self.distribution.use_2to3 is not True: 30 | return 31 | if not files: 32 | return 33 | log.info("Fixing "+" ".join(files)) 34 | self.__build_fixer_names() 35 | self.__exclude_fixers() 36 | if doctests: 37 | if setuptools.run_2to3_on_doctests: 38 | r = DistutilsRefactoringTool(self.fixer_names) 39 | r.refactor(files, write=True, doctests_only=True) 40 | else: 41 | _Mixin2to3.run_2to3(self, files) 42 | 43 | def __build_fixer_names(self): 44 | if self.fixer_names: return 45 | self.fixer_names = [] 46 | for p in setuptools.lib2to3_fixer_packages: 47 | self.fixer_names.extend(get_fixers_from_package(p)) 48 | if self.distribution.use_2to3_fixers is not None: 49 | for p in self.distribution.use_2to3_fixers: 50 | self.fixer_names.extend(get_fixers_from_package(p)) 51 | 52 | def __exclude_fixers(self): 53 | excluded_fixers = getattr(self, 'exclude_fixers', []) 54 | if self.distribution.use_2to3_exclude_fixers is not None: 55 | excluded_fixers.extend(self.distribution.use_2to3_exclude_fixers) 56 | for fixer_name in excluded_fixers: 57 | if fixer_name in self.fixer_names: 58 | self.fixer_names.remove(fixer_name) 59 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/py26compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | Compatibility Support for Python 2.6 and earlier 3 | """ 4 | 5 | import sys 6 | 7 | from setuptools.compat import splittag 8 | 9 | def strip_fragment(url): 10 | """ 11 | In `Python 8280 `_, Python 2.7 and 12 | later was patched to disregard the fragment when making URL requests. 13 | Do the same for Python 2.6 and earlier. 14 | """ 15 | url, fragment = splittag(url) 16 | return url 17 | 18 | if sys.version_info >= (2,7): 19 | strip_fragment = lambda x: x 20 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/py27compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | Compatibility Support for Python 2.7 and earlier 3 | """ 4 | 5 | import sys 6 | 7 | def get_all_headers(message, key): 8 | """ 9 | Given an HTTPMessage, return all headers matching a given key. 10 | """ 11 | return message.get_all(key) 12 | 13 | if sys.version_info < (3,): 14 | def get_all_headers(message, key): 15 | return message.getheaders(key) 16 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/py31compat.py: -------------------------------------------------------------------------------- 1 | __all__ = ['get_config_vars', 'get_path'] 2 | 3 | try: 4 | # Python 2.7 or >=3.2 5 | from sysconfig import get_config_vars, get_path 6 | except ImportError: 7 | from distutils.sysconfig import get_config_vars, get_python_lib 8 | def get_path(name): 9 | if name not in ('platlib', 'purelib'): 10 | raise ValueError("Name must be purelib or platlib") 11 | return get_python_lib(name=='platlib') 12 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/script template (dev).py: -------------------------------------------------------------------------------- 1 | # EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r 2 | __requires__ = """%(spec)r""" 3 | import sys 4 | from pkg_resources import require 5 | require("""%(spec)r""") 6 | del require 7 | __file__ = """%(dev_path)r""" 8 | if sys.version_info < (3, 0): 9 | execfile(__file__) 10 | else: 11 | exec(compile(open(__file__).read(), __file__, 'exec')) 12 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/script template.py: -------------------------------------------------------------------------------- 1 | # EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r 2 | __requires__ = """%(spec)r""" 3 | import pkg_resources 4 | pkg_resources.run_script("""%(spec)r""", """%(script_name)r""") 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/indexes/test_links_priority/external.html: -------------------------------------------------------------------------------- 1 | 2 | bad old link 3 | 4 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/indexes/test_links_priority/simple/foobar/index.html: -------------------------------------------------------------------------------- 1 | 2 | foobar-0.1.tar.gz
3 | external homepage
4 | 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/py26compat.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | try: 4 | # provide skipIf for Python 2.4-2.6 5 | skipIf = unittest.skipIf 6 | except AttributeError: 7 | def skipIf(condition, reason): 8 | def skipper(func): 9 | def skip(*args, **kwargs): 10 | return 11 | if condition: 12 | return skip 13 | return func 14 | return skipper 15 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/script-with-bom.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | result = 'passed' 4 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy13.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy13.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy14.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy14.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy15.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy15.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy16.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy16.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy17.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy17.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/dummy18.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/dummy18.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn13_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn13_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn13_ext_list.txt: -------------------------------------------------------------------------------- 1 | third_party3 file:///C:/development/svn_example/repos/svn13/extra1 2 | third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1 3 | third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1 4 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn13_ext_list.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn13_ext_list.xml -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn14_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn14_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn14_ext_list.txt: -------------------------------------------------------------------------------- 1 | third_party3 file:///C:/development/svn_example/repos/svn13/extra1 2 | third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1 3 | third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1 4 | 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn14_ext_list.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn14_ext_list.xml -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn15_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn15_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn15_ext_list.txt: -------------------------------------------------------------------------------- 1 | third_party3 file:///C:/development/svn_example/repos/svn15/extra1 2 | -r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2 3 | file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party 4 | 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn15_ext_list.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 5 | third_party3 file:///C:/development/svn_example/repos/svn15/extra2 7 | -r3 file:///C:/development/svn_example/repos/svn15/extra2 third_party2 8 | file:///C:/development/svn_example/repos/svn15/extra2@r1 third_party大介 9 | 10 | 11 | 13 | third_party3 file:///C:/development/svn_example/repos/svn15/extra1 15 | -r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2 16 | file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party大介 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn16_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn16_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn16_ext_list.txt: -------------------------------------------------------------------------------- 1 | "third party3" file:///C:/development/svn_example/repos/svn16/extra1 2 | 'third party3b' file:///C:/development/svn_example/repos/svn16/extra1 3 | -r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2 4 | file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn16_ext_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | "third party3" file:///C:/development/svn_example/repos/svn16/extra2 7 | -r3 file:///C:/development/svn_example/repos/svn16/extra2 third\ party2 8 | file:///C:/development/svn_example/repos/svn16/extra2@r1 third_party大介 9 | 10 | 11 | 13 | "third party3" file:///C:/development/svn_example/repos/svn16/extra1 15 | -r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2 16 | file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn17_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn17_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn17_ext_list.txt: -------------------------------------------------------------------------------- 1 | "third party3" file:///C:/development/svn_example/repos/svn17/extra1 2 | 'third party3b' file:///C:/development/svn_example/repos/svn17/extra1 3 | -r3 file:///C:/development/svn_example/repos/svn17/extra1 third\ party2 4 | file:///C:/development/svn_example/repos/svn17/extra1@r1 third_party 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn17_ext_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | "third party3" file:///C:/development/svn_example/repos/svn16/extra1 7 | -r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2 8 | file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介 9 | 10 | 11 | 13 | "third party3" file:///C:/development/svn_example/repos/svn17/extra2 15 | -r3 file:///C:/development/svn_example/repos/svn17/extra2 third\ party2 16 | file:///C:/development/svn_example/repos/svn17/extra2@r1 third_party大介 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn18_example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agiliq/nginx-python-buildpack/67616586d77f3033d49c899f23abd797c7994741/vendor/setuptools-2.1/setuptools/tests/svn_data/svn18_example.zip -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn18_ext_list.txt: -------------------------------------------------------------------------------- 1 | "third party3" file:///C:/development/svn_example/repos/svn18/extra1 2 | 'third party3b' file:///C:/development/svn_example/repos/svn18/extra1 3 | -r3 file:///C:/development/svn_example/repos/svn18/extra1 third\ party2 4 | file:///C:/development/svn_example/repos/svn18/extra1@r1 third_party 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/svn_data/svn18_ext_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | "third party3" file:///C:/development/svn_example/repos/svn16/extra1 7 | -r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2 8 | file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介 9 | 10 | 11 | 13 | "third party3" file:///C:/development/svn_example/repos/svn18/extra2 15 | -r3 file:///C:/development/svn_example/repos/svn18/extra2 third\ party2 16 | file:///C:/development/svn_example/repos/svn18/extra2@r1 third_party大介 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/test_bdist_egg.py: -------------------------------------------------------------------------------- 1 | """develop tests 2 | """ 3 | import sys 4 | import os, re, shutil, tempfile, unittest 5 | import tempfile 6 | import site 7 | 8 | from distutils.errors import DistutilsError 9 | from setuptools.compat import StringIO 10 | from setuptools.command.bdist_egg import bdist_egg 11 | from setuptools.command import easy_install as easy_install_pkg 12 | from setuptools.dist import Distribution 13 | 14 | SETUP_PY = """\ 15 | from setuptools import setup 16 | 17 | setup(name='foo', py_modules=['hi']) 18 | """ 19 | 20 | class TestDevelopTest(unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.dir = tempfile.mkdtemp() 24 | self.old_cwd = os.getcwd() 25 | os.chdir(self.dir) 26 | f = open('setup.py', 'w') 27 | f.write(SETUP_PY) 28 | f.close() 29 | f = open('hi.py', 'w') 30 | f.write('1\n') 31 | f.close() 32 | if sys.version >= "2.6": 33 | self.old_base = site.USER_BASE 34 | site.USER_BASE = tempfile.mkdtemp() 35 | self.old_site = site.USER_SITE 36 | site.USER_SITE = tempfile.mkdtemp() 37 | 38 | def tearDown(self): 39 | os.chdir(self.old_cwd) 40 | shutil.rmtree(self.dir) 41 | if sys.version >= "2.6": 42 | shutil.rmtree(site.USER_BASE) 43 | shutil.rmtree(site.USER_SITE) 44 | site.USER_BASE = self.old_base 45 | site.USER_SITE = self.old_site 46 | 47 | def test_bdist_egg(self): 48 | dist = Distribution(dict( 49 | script_name='setup.py', 50 | script_args=['bdist_egg'], 51 | name='foo', 52 | py_modules=['hi'] 53 | )) 54 | os.makedirs(os.path.join('build', 'src')) 55 | old_stdout = sys.stdout 56 | sys.stdout = o = StringIO() 57 | try: 58 | dist.parse_command_line() 59 | dist.run_commands() 60 | finally: 61 | sys.stdout = old_stdout 62 | 63 | # let's see if we got our egg link at the right place 64 | [content] = os.listdir('dist') 65 | self.assertTrue(re.match('foo-0.0.0-py[23].\d.egg$', content)) 66 | 67 | def test_suite(): 68 | return unittest.makeSuite(TestDevelopTest) 69 | 70 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/test_build_ext.py: -------------------------------------------------------------------------------- 1 | """build_ext tests 2 | """ 3 | import os, shutil, tempfile, unittest 4 | from distutils.command.build_ext import build_ext as distutils_build_ext 5 | from setuptools.command.build_ext import build_ext 6 | from setuptools.dist import Distribution 7 | 8 | class TestBuildExtTest(unittest.TestCase): 9 | 10 | def test_get_ext_filename(self): 11 | # setuptools needs to give back the same 12 | # result than distutils, even if the fullname 13 | # is not in ext_map 14 | dist = Distribution() 15 | cmd = build_ext(dist) 16 | cmd.ext_map['foo/bar'] = '' 17 | res = cmd.get_ext_filename('foo') 18 | wanted = distutils_build_ext.get_ext_filename(cmd, 'foo') 19 | assert res == wanted 20 | 21 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/test_sandbox.py: -------------------------------------------------------------------------------- 1 | """develop tests 2 | """ 3 | import sys 4 | import os 5 | import shutil 6 | import unittest 7 | import tempfile 8 | import types 9 | 10 | import pkg_resources 11 | import setuptools.sandbox 12 | from setuptools.sandbox import DirectorySandbox, SandboxViolation 13 | 14 | def has_win32com(): 15 | """ 16 | Run this to determine if the local machine has win32com, and if it 17 | does, include additional tests. 18 | """ 19 | if not sys.platform.startswith('win32'): 20 | return False 21 | try: 22 | mod = __import__('win32com') 23 | except ImportError: 24 | return False 25 | return True 26 | 27 | class TestSandbox(unittest.TestCase): 28 | 29 | def setUp(self): 30 | self.dir = tempfile.mkdtemp() 31 | 32 | def tearDown(self): 33 | shutil.rmtree(self.dir) 34 | 35 | def test_devnull(self): 36 | if sys.version < '2.4': 37 | return 38 | sandbox = DirectorySandbox(self.dir) 39 | sandbox.run(self._file_writer(os.devnull)) 40 | 41 | def _file_writer(path): 42 | def do_write(): 43 | f = open(path, 'w') 44 | f.write('xxx') 45 | f.close() 46 | return do_write 47 | 48 | _file_writer = staticmethod(_file_writer) 49 | 50 | if has_win32com(): 51 | def test_win32com(self): 52 | """ 53 | win32com should not be prevented from caching COM interfaces 54 | in gen_py. 55 | """ 56 | import win32com 57 | gen_py = win32com.__gen_path__ 58 | target = os.path.join(gen_py, 'test_write') 59 | sandbox = DirectorySandbox(self.dir) 60 | try: 61 | try: 62 | sandbox.run(self._file_writer(target)) 63 | except SandboxViolation: 64 | self.fail("Could not create gen_py file due to SandboxViolation") 65 | finally: 66 | if os.path.exists(target): os.remove(target) 67 | 68 | def test_setup_py_with_BOM(self): 69 | """ 70 | It should be possible to execute a setup.py with a Byte Order Mark 71 | """ 72 | target = pkg_resources.resource_filename(__name__, 73 | 'script-with-bom.py') 74 | namespace = types.ModuleType('namespace') 75 | setuptools.sandbox.execfile(target, vars(namespace)) 76 | assert namespace.result == 'passed' 77 | 78 | if __name__ == '__main__': 79 | unittest.main() 80 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/tests/test_upload_docs.py: -------------------------------------------------------------------------------- 1 | """build_ext tests 2 | """ 3 | import sys, os, shutil, tempfile, unittest, site, zipfile 4 | from setuptools.command.upload_docs import upload_docs 5 | from setuptools.dist import Distribution 6 | 7 | SETUP_PY = """\ 8 | from setuptools import setup 9 | 10 | setup(name='foo') 11 | """ 12 | 13 | class TestUploadDocsTest(unittest.TestCase): 14 | def setUp(self): 15 | self.dir = tempfile.mkdtemp() 16 | setup = os.path.join(self.dir, 'setup.py') 17 | f = open(setup, 'w') 18 | f.write(SETUP_PY) 19 | f.close() 20 | self.old_cwd = os.getcwd() 21 | os.chdir(self.dir) 22 | 23 | self.upload_dir = os.path.join(self.dir, 'build') 24 | os.mkdir(self.upload_dir) 25 | 26 | # A test document. 27 | f = open(os.path.join(self.upload_dir, 'index.html'), 'w') 28 | f.write("Hello world.") 29 | f.close() 30 | 31 | # An empty folder. 32 | os.mkdir(os.path.join(self.upload_dir, 'empty')) 33 | 34 | if sys.version >= "2.6": 35 | self.old_base = site.USER_BASE 36 | site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp() 37 | self.old_site = site.USER_SITE 38 | site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp() 39 | 40 | def tearDown(self): 41 | os.chdir(self.old_cwd) 42 | shutil.rmtree(self.dir) 43 | if sys.version >= "2.6": 44 | shutil.rmtree(site.USER_BASE) 45 | shutil.rmtree(site.USER_SITE) 46 | site.USER_BASE = self.old_base 47 | site.USER_SITE = self.old_site 48 | 49 | def test_create_zipfile(self): 50 | # Test to make sure zipfile creation handles common cases. 51 | # This explicitly includes a folder containing an empty folder. 52 | 53 | dist = Distribution() 54 | 55 | cmd = upload_docs(dist) 56 | cmd.upload_dir = self.upload_dir 57 | cmd.target_dir = self.upload_dir 58 | tmp_dir = tempfile.mkdtemp() 59 | tmp_file = os.path.join(tmp_dir, 'foo.zip') 60 | try: 61 | zip_file = cmd.create_zipfile(tmp_file) 62 | 63 | assert zipfile.is_zipfile(tmp_file) 64 | 65 | zip_file = zipfile.ZipFile(tmp_file) # woh... 66 | 67 | assert zip_file.namelist() == ['index.html'] 68 | 69 | zip_file.close() 70 | finally: 71 | shutil.rmtree(tmp_dir) 72 | 73 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/setuptools/version.py: -------------------------------------------------------------------------------- 1 | __version__ = '2.1' 2 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/shlib_test/hello.pyx: -------------------------------------------------------------------------------- 1 | cdef extern char *get_hello_msg() 2 | 3 | def hello(): 4 | return get_hello_msg() 5 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/shlib_test/hellolib.c: -------------------------------------------------------------------------------- 1 | extern char* get_hello_msg() { 2 | return "Hello, world!"; 3 | } 4 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/shlib_test/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, Extension, Library 2 | 3 | setup( 4 | name="shlib_test", 5 | ext_modules = [ 6 | Library("hellolib", ["hellolib.c"]), 7 | Extension("hello", ["hello.pyx"], libraries=["hellolib"]) 8 | ], 9 | test_suite="test_hello.HelloWorldTest", 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/shlib_test/test_hello.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | class HelloWorldTest(TestCase): 4 | def testHelloMsg(self): 5 | from hello import hello 6 | self.assertEqual(hello(), "Hello, world!") 7 | 8 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/test_ez_setup.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import tempfile 4 | import unittest 5 | import shutil 6 | import copy 7 | 8 | CURDIR = os.path.abspath(os.path.dirname(__file__)) 9 | TOPDIR = os.path.split(CURDIR)[0] 10 | sys.path.insert(0, TOPDIR) 11 | 12 | from ez_setup import (use_setuptools, _build_egg, _python_cmd, _do_download, 13 | _install, DEFAULT_URL, DEFAULT_VERSION) 14 | import ez_setup 15 | 16 | class TestSetup(unittest.TestCase): 17 | 18 | def urlopen(self, url): 19 | return open(self.tarball, 'rb') 20 | 21 | def setUp(self): 22 | self.old_sys_path = copy.copy(sys.path) 23 | self.cwd = os.getcwd() 24 | self.tmpdir = tempfile.mkdtemp() 25 | os.chdir(TOPDIR) 26 | _python_cmd("setup.py", "-q", "egg_info", "-RDb", "''", "sdist", 27 | "--dist-dir", "%s" % self.tmpdir) 28 | tarball = os.listdir(self.tmpdir)[0] 29 | self.tarball = os.path.join(self.tmpdir, tarball) 30 | from setuptools.compat import urllib2 31 | urllib2.urlopen = self.urlopen 32 | 33 | def tearDown(self): 34 | shutil.rmtree(self.tmpdir) 35 | os.chdir(self.cwd) 36 | sys.path = copy.copy(self.old_sys_path) 37 | 38 | def test_build_egg(self): 39 | # making it an egg 40 | egg = _build_egg('Egg to be built', self.tarball, self.tmpdir) 41 | 42 | # now trying to import it 43 | sys.path[0] = egg 44 | import setuptools 45 | self.assertTrue(setuptools.__file__.startswith(egg)) 46 | 47 | def test_do_download(self): 48 | tmpdir = tempfile.mkdtemp() 49 | _do_download(DEFAULT_VERSION, DEFAULT_URL, tmpdir, 1) 50 | import setuptools 51 | self.assertTrue(setuptools.bootstrap_install_from.startswith(tmpdir)) 52 | 53 | def test_install(self): 54 | def _faked(*args): 55 | return True 56 | ez_setup.python_cmd = _faked 57 | _install(self.tarball) 58 | 59 | def test_use_setuptools(self): 60 | self.assertEqual(use_setuptools(), None) 61 | 62 | if __name__ == '__main__': 63 | unittest.main() 64 | -------------------------------------------------------------------------------- /vendor/setuptools-2.1/tests/test_pkg_resources.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import tempfile 3 | import os 4 | import zipfile 5 | 6 | import pkg_resources 7 | 8 | try: 9 | unicode 10 | except NameError: 11 | unicode = str 12 | 13 | class EggRemover(unicode): 14 | def __call__(self): 15 | if self in sys.path: 16 | sys.path.remove(self) 17 | if os.path.exists(self): 18 | os.remove(self) 19 | 20 | class TestZipProvider(object): 21 | finalizers = [] 22 | 23 | @classmethod 24 | def setup_class(cls): 25 | "create a zip egg and add it to sys.path" 26 | egg = tempfile.NamedTemporaryFile(suffix='.egg', delete=False) 27 | zip_egg = zipfile.ZipFile(egg, 'w') 28 | zip_info = zipfile.ZipInfo() 29 | zip_info.filename = 'mod.py' 30 | zip_info.date_time = 2013, 5, 12, 13, 25, 0 31 | zip_egg.writestr(zip_info, 'x = 3\n') 32 | zip_info = zipfile.ZipInfo() 33 | zip_info.filename = 'data.dat' 34 | zip_info.date_time = 2013, 5, 12, 13, 25, 0 35 | zip_egg.writestr(zip_info, 'hello, world!') 36 | zip_egg.close() 37 | egg.close() 38 | 39 | sys.path.append(egg.name) 40 | cls.finalizers.append(EggRemover(egg.name)) 41 | 42 | @classmethod 43 | def teardown_class(cls): 44 | for finalizer in cls.finalizers: 45 | finalizer() 46 | 47 | def test_resource_filename_rewrites_on_change(self): 48 | """ 49 | If a previous call to get_resource_filename has saved the file, but 50 | the file has been subsequently mutated with different file of the 51 | same size and modification time, it should not be overwritten on a 52 | subsequent call to get_resource_filename. 53 | """ 54 | import mod 55 | manager = pkg_resources.ResourceManager() 56 | zp = pkg_resources.ZipProvider(mod) 57 | filename = zp.get_resource_filename(manager, 'data.dat') 58 | assert os.stat(filename).st_mtime == 1368379500 59 | f = open(filename, 'w') 60 | f.write('hello, world?') 61 | f.close() 62 | os.utime(filename, (1368379500, 1368379500)) 63 | filename = zp.get_resource_filename(manager, 'data.dat') 64 | f = open(filename) 65 | assert f.read() == 'hello, world!' 66 | manager.cleanup_resources() 67 | 68 | class TestResourceManager(object): 69 | def test_get_cache_path(self): 70 | mgr = pkg_resources.ResourceManager() 71 | path = mgr.get_cache_path('foo') 72 | type_ = str(type(path)) 73 | message = "Unexpected type from get_cache_path: " + type_ 74 | assert isinstance(path, (unicode, str)), message 75 | --------------------------------------------------------------------------------