Skip to content

Commit

Permalink
1.8.0 (#25)
Browse files Browse the repository at this point in the history
* update setup.py and add LICENSE

* [email protected] compatibility

* change project name in setup.py
  • Loading branch information
benoitguigal committed May 16, 2016
1 parent 43f2b00 commit 7d89b2f
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ eggs
build
*.pyc
*.pyo
virtualenv
virtualenv
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2016 Benoît Guigal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 3 additions & 0 deletions epson_printer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

__version__ = "1.8.0"

__all__ = ["epsonprinter","testpage"]

9 changes: 4 additions & 5 deletions epson_printer/epsonprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,21 @@ class EpsonPrinter:

printer = None

def __init__(self, id_vendor, id_product, interface=0, in_ep=0x82, out_ep=0x01):
def __init__(self, id_vendor, id_product, out_ep=0x01):
"""
@param id_vendor : Vendor ID
@param id_product : Product ID
@param interface : USB device interface
@param in_ep : Input end point
@param out_ep : Output end point
"""
self.interface = interface
self.in_ep = in_ep

self.out_ep = out_ep

# Search device on USB tree and set is as printer
self.printer = usb.core.find(idVendor=id_vendor, idProduct=id_product)
if self.printer is None:
raise Exception("Printer not found. Make sure the cable is plugged in.")
raise ValueError("Printer not found. Make sure the cable is plugged in.")

if self.printer.is_kernel_driver_active(0):
try:
Expand Down Expand Up @@ -212,7 +211,7 @@ def write_bytes(self, byte_array):
self.write(msg)

def write(self, msg):
self.printer.write(self.out_ep, msg, self.interface, timeout=20000)
self.printer.write(self.out_ep, msg, timeout=20000)

def print_text(self, msg):
self.write(msg)
Expand Down
86 changes: 73 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,74 @@

from setuptools import setup

setup(name="python_epson_printer",
version="1.7.1",
description="A library to control Epson thermal printers based on ESC/POS language",
url="https://github.com/benoitguigal/python-epson-printer",
author="benoitguigal",
author_email="[email protected]",
packages=['epson_printer'],
install_requires=[
'pyusb==1.0.0b1',
'Pillow==2.6'
])
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
import os
import re


def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)

setup(
name='python-epson-printer',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=get_version('epson_printer'),

description='A library to control Epson thermal printers based on ESC/POS language',

# The project's main homepage.
url='https://github.com/benoitguigal/python-epson-printer/',

# Author details
author='Benoit Guigal',
author_email='[email protected]',

# Choose your license
license='MIT',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',

# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],

# What does your project relate to?
keywords='epson printer escpos',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['tests*']),

# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'pyusb>=1.0.0',
'Pillow>=3.1.0',
'numpy>=1.11.0'
]

)

0 comments on commit 7d89b2f

Please sign in to comment.