-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #2 add inv tasks for PyPi deploy and test automation
- Loading branch information
1 parent
f0e0896
commit b5668ac
Showing
6 changed files
with
114 additions
and
10 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,13 @@ | ||
# Changelog | ||
|
||
### develop (unreleased) | ||
|
||
### v0.1 (August 7, 2014) | ||
|
||
#### Enhancements | ||
|
||
- Add Travis-CI testing [#1][] | ||
- Create invoke tasks to automate PyPi deploy [#2][] | ||
|
||
[#1]: https://github.com/questrail/sdfascii/issues/1 | ||
[#2]: https://github.com/questrail/sdfascii/issues/2 |
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
distribute==0.6.31 | ||
git-remote-helpers==0.1.0 | ||
numpy==1.7.0 | ||
stevedore==0.7.2 | ||
virtualenv==1.8.4 | ||
virtualenv-clone==0.2.4 | ||
virtualenvwrapper==3.6 | ||
wsgiref==0.1.2 | ||
flake8==2.2.2 | ||
invoke==0.8.2 | ||
mccabe==0.2.1 | ||
nose==1.3.3 | ||
numpy==1.8.1 | ||
pep8==1.5.7 | ||
pyflakes==0.8.1 |
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,2 @@ | ||
[metadata] | ||
description-file = README.md |
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 |
---|---|---|
@@ -1,13 +1,53 @@ | ||
from distutils.core import setup | ||
import codecs | ||
import os | ||
import re | ||
|
||
from setuptools import setup | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
def read(*parts): | ||
"""Read parts of a file | ||
Taken from pip's setup.py | ||
intentionally *not* adding an encoding option to open | ||
see: https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 | ||
""" | ||
return codecs.open(os.path.join(here, *parts), 'r').read() | ||
|
||
|
||
def find_version(*file_paths): | ||
"""Find version in source file | ||
Read the version number from a source file. | ||
Code taken from pip's setup.py | ||
""" | ||
version_file = read(*file_paths) | ||
# The version line must have the form: | ||
# __version__ = 'ver' | ||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
version_file, re.M) | ||
if version_match: | ||
return version_match.group(1) | ||
raise RuntimeError("Unable to find version string.") | ||
|
||
try: | ||
import pypandoc | ||
long_description = pypandoc.convert('README.md', 'rst') | ||
except(IOError, ImportError): | ||
long_description = open('README.md').read() | ||
|
||
setup( | ||
name='sdfascii', | ||
version='0.1.0', | ||
version=find_version('sdfascii.py'), | ||
author='Matthew Rankin', | ||
author_email='[email protected]', | ||
py_modules=['sdfascii'], | ||
url='http://github.com/questrail/sdfascii', | ||
license='LICENSE.txt', | ||
description='Read HP SDF binary and ASCII files', | ||
long_description=long_description, | ||
requires=['numpy (>=1.6.0)'], | ||
classifiers=[ | ||
'Programming Language :: Python', | ||
|
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,43 @@ | ||
from invoke import run, task | ||
|
||
TESTPYPI = "https://testpypi.python.org/pypi" | ||
|
||
|
||
@task | ||
def lint(): | ||
"""Run flake8 to lint code""" | ||
run("python setup.py flake8") | ||
|
||
|
||
@task(lint) | ||
def test(): | ||
"""Lint, unit test, and check setup.py""" | ||
run("nosetests") | ||
run("python setup.py check") | ||
|
||
|
||
@task() | ||
def release(deploy=False, test=False, version=''): | ||
"""Tag release, run Travis-CI, and deploy to PyPI | ||
""" | ||
if test: | ||
run("python setup.py check") | ||
run("python setup.py register sdist upload --dry-run") | ||
|
||
if deploy: | ||
run("python setup.py check") | ||
if version: | ||
run("git checkout master") | ||
run("git tag -a v{ver} -m 'v{ver}'".format(ver=version)) | ||
run("git push") | ||
run("git push origin --tags") | ||
run("python setup.py register sdist upload") | ||
else: | ||
print("* Have you updated the version in taffmat.py?") | ||
print("* Have you updated CHANGES.md?") | ||
print("* Have you fixed any last minute bugs?") | ||
print("If you answered yes to all of the above questions,") | ||
print("then run `invoke release --deploy -vX.YY` to:") | ||
print("- Checkout master") | ||
print("- Tag the git release with provided vX.YY version") | ||
print("- Push the master branch and tags to repo") |