Added wheel support

Should make installation via pip work on OSX Mavericks (#148).

Also added a nifty Makefile.
This commit is contained in:
Jakub Roztocil 2014-04-28 13:25:45 +02:00
parent 2aa53e4be3
commit 29a564ef56
7 changed files with 86 additions and 18 deletions

View File

@ -5,10 +5,8 @@ python:
- 2.7
- pypy
- 3.3
install:
- pip install pytest pytest-cov python-coveralls --use-mirrors
- pip install . --use-mirrors
script:
- py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests
- make
after_success:
- pip install python-coveralls
- coveralls

View File

@ -38,12 +38,9 @@ Development Environment
# (Recommended: create a new virtualenv)
# Install dev. requirements:
pip install -r requirements-dev.txt
# Install HTTPie in editable mode
# (the `http' command will point to your working copy):
pip install --upgrade --force-reinstall --editable .
# Install dev. requirements and also HTTPie (in editable mode
# so that the `http' command will point to your working copy):
make
Making Changes
@ -66,10 +63,13 @@ HTTPie uses `pytest`_ and `Tox`_.
### Running all tests:
# Current Python
python setup.py test
make test
# All the supported and available Pythons
tox
# Current Python with coverage
make test-cover
# All the supported and available Pythons via Tox
make test-tox
### Running specific tests:

67
MakeFile Normal file
View File

@ -0,0 +1,67 @@
VERSION=$(shell grep __version__ httpie/__init__.py)
REQUIREMENTS="requirements-dev.txt"
TAG="\n\n\033[0;32m\#\#\# "
END=" \#\#\# \033[0m\n"
all: test
uninstall-httpie:
@echo $(TAG)Removing existing installation of HTTPie$(END)
- pip uninstall --yes httpie >/dev/null
! which http
@echo
uninstall-all: uninstall-httpie
- pip uninstall --yes -r $(REQUIREMENTS)
init: uninstall-httpie
@echo $(TAG)Installing dev requirements$(END)
pip install --upgrade -r $(REQUIREMENTS)
@echo $(TAG)Installing HTTPie$(END)
pip install --upgrade --editable .
@echo
test: init
@echo $(TAG)Running tests in on current Python in parallel and with coverage $(END)
py.test --cov ./httpie --cov ./tests -n 8 --doctest-modules --verbose ./httpie ./tests
@echo
test-tox: init
@echo $(TAG)Running tests on all Pythons via Tox$(END)
tox
@echo
test-dist: test-sdist test-bdist-wheel
@echo
test-sdist: clean uninstall-httpie
@echo $(TAG)Testing sdist build an installation$(END)
python setup.py sdist
pip install --force-reinstall --upgrade dist/*.gz
which http
@echo
test-bdist-wheel: clean uninstall-httpie
@echo $(TAG)Testing wheel build an installation$(END)
python setup.py bdist_wheel
pip install --force-reinstall --upgrade dist/*.whl
which http
@echo
# This tests everything, even this Makefile.
test-all: uninstall-all clean init test test-tox test-dist
publish: test-all
@echo $(TAG)Testing wheel build an installation$(END)
@echo "$(VERSION)"
@echo "$(VERSION)" | grep -q "dev" && echo "!!!Not publishing dev version!!!" && exit 1
python setup.py register
python setup.py sdist upload
python setup.py bdist_wheel upload
@echo
clean:
@echo $(TAG)Cleaning up$(END)
rm -rf .tox *.egg dist build .coverage
find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print
@echo

View File

@ -1,4 +1,5 @@
tox
pytest
pytest-xdist
pytest-cov
docutils

View File

@ -1,12 +1,14 @@
import sys
import codecs
from setuptools import setup
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import httpie
class PyTest(TestCommand):
# `$ python setup.py test' simply installs minimal requirements
# and runs the tests with no fancy stuff like parallel execution.
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_suite = True
@ -45,7 +47,6 @@ def long_description():
with codecs.open('README.rst', encoding='utf8') as f:
return f.read()
setup(
name='httpie',
version=httpie.__version__,
@ -56,7 +57,7 @@ setup(
author=httpie.__author__,
author_email='jakub@roztocil.name',
license=httpie.__licence__,
packages=['httpie', 'httpie.plugins'],
packages=find_packages(),
entry_points={
'console_scripts': [
'http = httpie.__main__:main',
@ -72,6 +73,8 @@ setup(
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',

View File

@ -5,7 +5,6 @@ from httpie.output.processors.colors import get_lexer
from utils import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF
class TestVerboseFlag:
def test_verbose(self):
r = http('--verbose', 'GET', httpbin('/get'), 'test-header:__test__')

View File

@ -15,4 +15,4 @@ deps =
pytest-xdist
commands =
py.test --doctest-modules --basetemp={envtmpdir} -n 8 {posargs:./tests ./httpie}
py.test -n 8 --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie}