Skip to content

Commit 49cef5d

Browse files
author
Ted Salmon
authored
Merge pull request #29 from LasLabs/feature/master/travis-pypi
[IMP] travis: Add PyPi deploy
2 parents c143f0a + 6a69008 commit 49cef5d

4 files changed

Lines changed: 94 additions & 83 deletions

File tree

.travis.yml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
addons:
2-
apt:
3-
packages:
4-
- expect-dev # provides unbuffer utility
5-
- unixodbc-dev
2+
apt:
3+
packages:
4+
- expect-dev # provides unbuffer utility
5+
- unixodbc-dev
66

77
language: python
88

99
python:
10-
- "2.7"
10+
- "2.7"
1111

1212
virtualenv:
13-
system_site_packages: true
13+
system_site_packages: true
1414

1515
env:
16-
global:
17-
- TESTS="0" LINT_CHECK="0" DOCS="0" VERSION="0.1.0" RELEASE="0.1.8" PROJECT="Python CarePoint" BRANCH_PROD="master" BRANCH_DOC="gh-pages"
18-
matrix:
19-
- TESTS="1"
20-
- DOCS="1"
16+
global:
17+
- VERSION="0.1.0"
18+
- RELEASE="0.1.8"
19+
- PROJECT="Python CarePoint"
20+
- BRANCH_PROD="master"
21+
- BRANCH_DOC="gh-pages"
22+
- TESTS="0"
23+
- LINT_CHECK="0"
24+
- DOCS="0"
25+
- PYPI="0"
26+
- secure: "Agq7rh2FbYpV5u1WhpEcfjx/V9dwB04NwWhQMGviVeTQgwszgoHZ6XzDCIoWRwBmxOHBPFw2FIBf7/QwQAOJrnB0C9Ijza1t9LmsUWextOBNGnZTYuMdM0sUigPhQ5mVgHEs5sWRPf8JyRS4n2v0bzlrIA3PGvUU3LBipJ6CsmgQLfEb9Xy16KTCcneRBCUZHEc4sNNPOnLrXC+DhnKKBzFhdQKeQlDj1SOsvYsFDRIRe1Y2A2lgXgIYXO6mfdBz51G3AcRI3dZTQoOawtXHz00IOeNMkgv4AtaywlcDd4Io+Z0z0O+p6CJRW6DvJo4Ldi9lh2/nLbPcm+1Gqv4qAaIACCTI34mO+K3u/Yrh1baS+QfI9V03k5hmV2MtiEeSjA0TwDJj24Pmczesccn4iVrlcn+XFSDz8BDLRhp1RMjSP8YQ3+7W5UFpEuVpyPFwpYJsbVHfHDBL94zcyyhoitriI9DRV4IgqiQ59TGfINLBh8ssZtDuNhLPjEvDMMQwEdOyFnkakEA83eGebVyEXHCAREL8G/XKqr2WJV7UMHpDtc0DmVlwuH4ZBYKCA9L2+sYg9s5d2Z+tJrDucXwBan1W7ov9wqer8DotyxgC5eht8KVS2WuTjsgxErevVDV+PGn9Wnfwlqxw/Rih6CKdT+W1/rEVr3ufcTJrYD3jm6U="
27+
matrix:
28+
- TESTS="1"
29+
- PYPI="1"
30+
- DOCS="1"
2131

2232
install:
23-
- git clone --depth=1 https://github.com/LasLabs/python-quality-tools.git ${HOME}/python-quality-tools
24-
- export PATH=${HOME}/python-quality-tools/travis:${PATH}
25-
- travis_install
33+
- git clone --depth=1 https://github.com/LasLabs/python-quality-tools.git ${HOME}/python-quality-tools
34+
- export PATH=${HOME}/python-quality-tools/travis:${PATH}
35+
- travis_install
2636

2737
script:
28-
- travis_run
38+
- travis_run
2939

3040
after_success:
31-
- travis_after_success
41+
- travis_after_success

__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

setup.py

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2015-TODAY LasLabs Inc.
2+
# Copyright 2016-TODAY LasLabs Inc.
33
# License MIT (https://opensource.org/licenses/MIT).
44

5-
from setuptools import setup
5+
from setuptools import Command, setup
66
from setuptools import find_packages
7-
from tests import Tests
7+
from unittest import TestLoader, TextTestRunner
8+
9+
from os import environ, path
10+
11+
12+
PROJECT = 'carepoint'
13+
SHORT_DESC = (
14+
'This library will allow you to interact with a remote CarePoint '
15+
'instance using Python.'
16+
)
17+
README_FILE = 'README.rst'
18+
19+
version = environ.get('RELEASE') or environ.get('VERSION') or '0.0.0'
20+
21+
if environ.get('TRAVIS_BUILD_NUMBER'):
22+
version += 'b%s' % environ.get('TRAVIS_BUILD_NUMBER')
823

924

1025
setup_vals = {
11-
'name': 'carepoint',
12-
'version': '0.1.8',
26+
'name': PROJECT,
1327
'author': 'LasLabs Inc.',
1428
'author_email': 'support@laslabs.com',
15-
'description': 'This library will allow you to interact with CarePoint '
16-
'using Python.',
17-
'url': 'https://github.com/laslabs/python-carepoint',
29+
'description': SHORT_DESC,
30+
'url': 'https://laslabs.github.io/%s' % PROJECT,
31+
'download_url': 'https://github.com/LasLabs/%s' % PROJECT,
1832
'license': 'MIT',
1933
'classifiers': [
2034
'Development Status :: 4 - Beta',
@@ -26,21 +40,52 @@
2640
'Programming Language :: Python',
2741
'Topic :: Software Development :: Libraries :: Python Modules',
2842
],
43+
'version': version,
2944
}
3045

3146

32-
setup(
33-
packages=find_packages(exclude=('tests')),
34-
cmdclass={'test': Tests},
35-
tests_require=[
36-
'xmlrunner',
37-
'mock',
38-
],
39-
install_requires=[
40-
'enum34',
41-
'pyodbc',
42-
'pysmb',
43-
'sqlalchemy',
44-
],
45-
**setup_vals
46-
)
47+
if path.exists(README_FILE):
48+
with open(README_FILE) as fh:
49+
setup_vals['long_description'] = fh.read()
50+
51+
52+
install_requires = []
53+
if path.exists('requirements.txt'):
54+
with open('requirements.txt') as fh:
55+
install_requires = fh.read().splitlines()
56+
57+
58+
class FailTestException(Exception):
59+
""" It provides a failing build """
60+
pass
61+
62+
63+
class Tests(Command):
64+
''' Run test & coverage, save reports as XML '''
65+
66+
user_options = [] # < For Command API compatibility
67+
68+
def initialize_options(self, ):
69+
pass
70+
71+
def finalize_options(self, ):
72+
pass
73+
74+
def run(self, ):
75+
loader = TestLoader()
76+
tests = loader.discover('.', 'test_*.py')
77+
t = TextTestRunner(verbosity=1)
78+
res = t.run(tests)
79+
if not res.wasSuccessful():
80+
raise FailTestException()
81+
82+
if __name__ == "__main__":
83+
setup(
84+
packages=find_packages(exclude=('tests')),
85+
cmdclass={'test': Tests},
86+
tests_require=[
87+
'mock',
88+
],
89+
install_requires=install_requires,
90+
**setup_vals
91+
)

tests.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)