kennethreitz/requests — pull request #939 by bmcustodio (2012-11-16 13:46:12+00:00)
Title: ! Fixes packaging and installation behaviour under Python2 and Python3.

Long short story again... This PR aims at fixing #916 and #918 while still keeping dependencies vendored (unlike in #929 where I had removed them)... So, what I did was:

- Remove the`packages` folder (which made up `requests.packages`) from inside "requests" and separate it into three packages inside the `dependencies` folder:
- `common`: This contains all the packages needed by **requests** and which work *both* on PY2 and PY3 ( currently **urllib3** only ). It will be made into a package (`requests.packages.common`) by `setuptools`/`distutils` during installation via the `package_dir` instruction.
- `python2`: This contains PY2 specific packages ( currently **oauthlib** and **chardet** ). It will be made into a package (`requests.packages.environment`) during installation on PY2 (via the `package_dir` instruction).
- *python3*: This contains PY3 specific packages ( currently **chardet2** ). It will be made into a package (`requests.packages.environment`) during installation on PY3 (via the `package_dir` instruction).

Next, I had to add a `recursive-include` affecting the `dependencies` folder, so that *all* the packages get included when `sdist`ing... Finally I moved the `requests` source folder to `source/requests` to cheat `nose`'s test loader and force it to use the installed version instead (since on the source folder `requests.packages.*` doesn't really exist. A few changes to the `Makefile` were also necessary.

I have tested this in every supported Python version and is working great (Travis CI says the same). If you want to test `pip` before merging I have uploaded a testing package of this precise version:

pip install requests-packaging-fixes

Is now working flawlessly under Py2.6+. :-)