IMPROVE packaging and testing
* uses now tox (currently with no tests) on python 2.7 and 3.4 * upgraded setup.py to setuptools
This commit is contained in:
parent
6cc325b395
commit
029549aaae
|
@ -7,3 +7,7 @@ $~
|
|||
|
||||
# temporary data
|
||||
temp
|
||||
|
||||
# packaging and testing
|
||||
.tox/
|
||||
*.egg-info/
|
||||
|
|
35
setup.py
35
setup.py
|
@ -1,6 +1,35 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from distutils.core import setup
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
def read(fname):
|
||||
"""read file from same path as setup.py"""
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
class Tox(TestCommand):
|
||||
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
|
||||
|
||||
def initialize_options(self):
|
||||
TestCommand.initialize_options(self)
|
||||
self.tox_args = None
|
||||
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
|
||||
def run_tests(self):
|
||||
#import here, cause outside the eggs aren't loaded
|
||||
import tox
|
||||
import shlex
|
||||
args = self.tox_args
|
||||
if args:
|
||||
args = shlex.split(self.tox_args)
|
||||
errno = tox.cmdline(args=args)
|
||||
sys.exit(errno)
|
||||
|
||||
setup(
|
||||
name='escpos',
|
||||
|
@ -9,7 +38,7 @@ setup(
|
|||
download_url='https://github.com/manpaz/python-escpos.git',
|
||||
description='Python library to manipulate ESC/POS Printers',
|
||||
license='GNU GPL v3',
|
||||
long_description=open('README').read(),
|
||||
long_description=read('README'),
|
||||
author='Manuel F Martinez',
|
||||
author_email='manpaz@bashlinux.com',
|
||||
platforms=['linux'],
|
||||
|
@ -32,4 +61,6 @@ setup(
|
|||
'qrcode>=4.0',
|
||||
'pyserial',
|
||||
],
|
||||
tests_require=['tox'],
|
||||
cmdclass={'test': Tox},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue