progrium/pyjwt — pull request #25 by chillipino (2014-02-07 08:45:10+00:00)
Title: refactor decode(), fix setup.py for automated sdist builds

two small changes:

i split the ```decode()``` internals into two functions, ```load()``` and ```verify_signature()```. ```decode()``` still does what it used to, but unconditionally getting the payload while also verifying the signature doesn't require parsing the JWT twice.

during deployment, i build my forked dependencies by using ```distutils.core.run_setup()``` to make an sdist archive. previously, setup.py would fail because of the way distutils runs the setup script (at least, it does so in python 2.7.5). pulling the code out of the ```read()``` function fixes this, and by using a ```with``` statement, the file gets closed on exceptions as a nice side effect. i didn't touch the version number even though it doesn't match the one on pypi.

to reproduce the error i'm talking about, start up python while in the directory where setup.py is, and run the following:

```python
>>> from distutils.core import run_setup
>>> run_setup('setup.py', ['--dry-run', 'sdist'], 'run')
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\distutils\core.py", line 221, in run_setup
exec f.read() in g, l
File "", line 20, in
File "", line 7, in read
NameError: global name 'os' is not defined
```