Use setuptools if possible, add development docs

- If setuptools is available, use that.
  Setuptools can be very handy in development, because it provides
 `python setup.py develop`.
- Add development documentation, explaining how to use setuptools'
  develop with a virtual environment to work on cheat.
- Backwards compatibility with distutils is maintained.
  If setuptools is not available, distutils will be used.
This commit is contained in:
Romanos Skiadas 2016-08-09 18:52:01 +03:00
parent eff042d50b
commit ad6d567d87
3 changed files with 27 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ MANIFEST
build
cheat.egg-info
dist
venv

View File

@ -23,7 +23,7 @@ cheat tar
You will be presented with a cheatsheet resembling:
```sh
# To extract an uncompressed archive:
# To extract an uncompressed archive:
tar -xvf '/path/to/foo.tar'
# To extract a .gz archive:
@ -117,6 +117,27 @@ enable this feature, set a `CHEATCOLORS` environment variable:
export CHEATCOLORS=true
```
Development
-----------
Virtual environments and `setuptools` can be used to develop `cheat`:
Create a virtual environment with [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/):
$ virtualenv venv
Activate it:
$ source venv/bin/activate
Install `cheat` in the venv in [development mode](http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode):
$ python setup.py develop
Now `cheat` can be run from inside the venv:
$ venv/bin/cheat
See Also:
---------
- [Enabling Command-line Autocompletion][autocompletion]

View File

@ -1,4 +1,7 @@
from distutils.core import setup
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os
setup(