-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn brew into a real python package
- Loading branch information
1 parent
3b75abe
commit 25141ab
Showing
9 changed files
with
174 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.py[o|c] | ||
*.swp | ||
.venv/ | ||
.coverage | ||
nosetests.xml | ||
|
||
*.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
.tox/ | ||
python-mingus/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /usr/bin/make | ||
|
||
PACKAGE_NAME=brew | ||
|
||
VENV_DIR?=.venv | ||
VENV_ACTIVATE=$(VENV_DIR)/bin/activate | ||
WITH_VENV=. $(VENV_ACTIVATE); | ||
|
||
TEST_OUTPUT?=nosetests.xml | ||
COVERAGE_OUTPUT?=coverage.xml | ||
|
||
.PHONY: help venv setup clean teardown lint test package | ||
|
||
help: ## Print the help documentation | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
$(VENV_ACTIVATE): requirements.txt requirements-dev.txt | ||
test -f $@ || virtualenv --python=python2.7 $(VENV_DIR) | ||
$(WITH_VENV) pip install --no-deps -r requirements.txt | ||
$(WITH_VENV) pip install --no-deps -r requirements-dev.txt | ||
touch $@ | ||
|
||
venv: $(VENV_ACTIVATE) | ||
|
||
setup: venv | ||
|
||
clean: ## Clean the library and test files | ||
python setup.py clean | ||
rm -rf build/ | ||
rm -rf dist/ | ||
rm -rf *.egg*/ | ||
rm -rf */__pycache__/ | ||
rm -f MANIFEST | ||
rm -f $(TEST_OUTPUT) | ||
coverage erase | ||
rm -f $(COVERAGE_OUTPUT) | ||
find ./ -type f -name '*.pyc' -delete | ||
|
||
teardown: ## Remove all virtualenv files | ||
rm -rf $(VENV_DIR)/ | ||
|
||
lint: venv ## Run linting tests | ||
$(WITH_VENV) flake8 $(PACKAGE_NAME)/ | ||
|
||
test: venv ## Run unit tests | ||
$(WITH_VENV) tox | ||
|
||
package: ## Create the python package | ||
python setup.py sdist | ||
|
||
install: ## Install the python package | ||
$(WITH_VENV) python setup.py install | ||
|
||
default: help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Coverage | ||
coverage==3.7.1 | ||
|
||
# Lint | ||
flake8==2.1.0 | ||
mccabe==0.2.1 | ||
pep8==1.5.6 | ||
pyflakes==0.8.1 | ||
|
||
# Testing | ||
nose==1.3.1 | ||
pluggy==0.3.1 | ||
py==1.4.31 | ||
tox==2.3.1 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name='brew', | ||
version='0.0.1', | ||
author='Chris Gilemr', | ||
author_email='[email protected]', | ||
maintainer='Chris Gilmer', | ||
maintainer_email='[email protected]', | ||
description='Brewing Tools', | ||
url='https://github.com/chrisgilmerproj/silliness/brewing', | ||
packages=find_packages(exclude=["*.tests", | ||
"*.tests.*", | ||
"tests.*", | ||
"tests"]), | ||
include_package_data=True, | ||
zip_safe=False, | ||
test_requires=[ | ||
'nose==1.3.1', | ||
'pluggy==0.3.1', | ||
'py==1.4.31', | ||
'tox==2.3.1', | ||
], | ||
classifiers=( | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Other Audience", | ||
"License :: OSI Approved :: GNU General Public License (GPL)", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 2.6", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3.3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[nosetests] | ||
verbosity=2 | ||
with-coverage=1 | ||
cover-package=brew | ||
cover-min-percentage=60 | ||
cover-inclusive=1 | ||
with-doctest=1 | ||
with-xunit=1 | ||
xunit-file=nosetests.xml | ||
logging-filter=-factory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Tox (http://tox.testrun.org/) is a tool for running tests | ||
# in multiple virtualenvs. This configuration file will run the | ||
# test suite on all supported python versions. To use it, "pip install tox" | ||
# and then run "tox" from this directory. | ||
|
||
[tox] | ||
envlist = py26,py27,py33,py34,py35 | ||
|
||
[testenv] | ||
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH | ||
commands = | ||
nosetests -c tests/nose.cfg | ||
python {toxinidir}/update_coveralls.py | ||
deps = | ||
nose | ||
coverage | ||
coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/env/python | ||
|
||
import os | ||
|
||
from distutils.sysconfig import get_python_lib | ||
from subprocess import call | ||
|
||
|
||
if __name__ == '__main__': | ||
# chdir to the site-packages directory so the report lists relative paths | ||
dot_coverage_path = os.path.join(os.getcwd(), '.coverage') | ||
os.chdir(get_python_lib()) | ||
try: | ||
os.remove('.coverage') | ||
except OSError: | ||
pass | ||
os.symlink(dot_coverage_path, '.coverage') | ||
|
||
# create a report from the coverage data | ||
if 'TRAVIS' in os.environ: | ||
rc = call('coveralls') | ||
raise SystemExit(rc) | ||
else: | ||
rc = call(['coverage', 'report']) | ||
raise SystemExit(rc) |