Skip to content

Commit 4d5cfc5

Browse files
author
Hugo Osvaldo Barrera
committed
Clean up and update setup.py
1 parent 2190a63 commit 4d5cfc5

File tree

6 files changed

+45
-64
lines changed

6 files changed

+45
-64
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ dist/*
1515
tests/*
1616
docs/_build/*
1717
MANIFEST
18-
19-
18+
barcode/version.py

barcode/__init__.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,14 @@
1111
installed, the barcodes can also be rendered as images (all
1212
formats supported by PIL).
1313
"""
14-
__docformat__ = 'restructuredtext en'
15-
16-
__project__ = 'python-barcode'
17-
__author__ = 'Thorsten Weimann'
18-
__copyright__ = '2010-2016, ' + __author__
19-
__author_email__ = '[email protected]'
20-
__description__ = ('Create standard barcodes with Python. No external '
21-
'modules needed (optional PIL support included).')
22-
__version__ = '0.8'
23-
__release__ = '{version}'.format(version=__version__)
24-
__license__ = 'MIT'
25-
__url__ = 'https://bitbucket.org/whitie/python-barcode/'
26-
__classifiers__ = [
27-
'Development Status :: 5 - Production/Stable',
28-
'Environment :: Console',
29-
'Intended Audience :: Developers',
30-
'License :: OSI Approved :: MIT License',
31-
'Operating System :: OS Independent',
32-
'Programming Language :: Python',
33-
'Topic :: Software Development :: Libraries :: Python Modules',
34-
'Topic :: Multimedia :: Graphics',
35-
]
3614

3715
from barcode.errors import BarcodeNotFoundError
3816
from barcode.codex import Code39, PZN, Code128
3917
from barcode.ean import EAN8, EAN13, EAN14, JAN
4018
from barcode.isxn import ISBN10, ISBN13, ISSN
4119
from barcode.upc import UPCA
4220
from barcode.itf import ITF
21+
from barcode.version import version # noqa: F401
4322

4423
try:
4524
_strbase = basestring # lint:ok

barcode/writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
import xml.dom
88

9-
from barcode import __release__
9+
from barcode import version
1010

1111
try:
1212
import Image
@@ -49,7 +49,7 @@ def create_svg_object():
4949

5050

5151
SIZE = '{0:.3f}mm'
52-
COMMENT = 'Autogenerated with pyBarcode {0}'.format(__release__)
52+
COMMENT = 'Autogenerated with python-barcode {0}'.format(version)
5353
PATH = os.path.dirname(os.path.abspath(__file__))
5454
FONT = os.path.join(PATH, 'DejaVuSansMono.ttf')
5555

docs/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
1919
#sys.path.append(os.path.abspath('.'))
2020
sys.path.append(os.path.abspath('..'))
21-
import barcode
21+
from barcode import version
2222
LOGO = os.path.join('images', 'pybarcode_small.png')
2323

2424
# -- General configuration -----------------------------------------------------
@@ -41,17 +41,17 @@
4141
master_doc = 'index'
4242

4343
# General information about the project.
44-
project = barcode.__project__
45-
copyright = barcode.__copyright__
44+
project = 'python-barcode'
45+
copyright = '2010-2017 Thorsten Weimann et al'
4646

4747
# The version info for the project you're documenting, acts as replacement for
4848
# |version| and |release|, also used in various other places throughout the
4949
# built documents.
5050
#
5151
# The short X.Y version.
52-
version = barcode.__version__
52+
version = version
5353
# The full version, including alpha/beta/rc tags.
54-
release = barcode.__release__
54+
release = version
5555

5656
# The language for content autogenerated by Sphinx. Refer to documentation
5757
# for a list of supported languages.

setup.py

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
# -*- coding: utf-8 -*-
22

3-
import sys
4-
from os.path import join, dirname
5-
6-
import barcode as pkg
7-
8-
from setuptools import setup, find_packages
9-
10-
11-
# Avoid name clashes if the user has Python 2 and 3 installed
12-
console_script = 'pybarcode{0}'.format(sys.version_info[0])
13-
try:
14-
import argparse # lint:ok
15-
required = []
16-
except ImportError:
17-
required = ['argparse']
18-
19-
with open(join(dirname(__file__), 'README.rst')) as fp:
20-
long_desc = fp.read()
3+
from pathlib import Path
4+
from setuptools import find_packages, setup
215

226

237
setup(
24-
name=pkg.__project__,
25-
version=pkg.__release__,
8+
name='python-barcode',
269
packages=find_packages(),
27-
url=pkg.__url__,
28-
license=pkg.__license__,
29-
author=pkg.__author__,
30-
author_email=pkg.__author_email__,
31-
description=pkg.__description__,
32-
long_description=long_desc,
33-
classifiers=pkg.__classifiers__,
10+
url="https://github.com/WhyNotHugo/python-barcode",
11+
license='MIT',
12+
author='Thorsten Weimann et al',
13+
author_email='[email protected]',
14+
description=(
15+
'Create standard barcodes with Python. No external modules needed '
16+
'(optional PIL support included).'
17+
),
18+
long_description=Path('README.rst').read_text(),
19+
classifiers=[
20+
'Development Status :: 5 - Production/Stable',
21+
'Environment :: Console',
22+
'Intended Audience :: Developers',
23+
'License :: OSI Approved :: MIT License',
24+
'Operating System :: OS Independent',
25+
'Programming Language :: Python',
26+
'Programming Language :: Python :: 3',
27+
'Programming Language :: Python :: 3.5',
28+
'Programming Language :: Python :: 3.6',
29+
'Topic :: Multimedia :: Graphics',
30+
'Topic :: Software Development :: Libraries :: Python Modules',
31+
],
3432
entry_points={
35-
'console_scripts':
36-
['{0} = barcode.pybarcode:main'.format(console_script)],
37-
},
38-
install_requires=required,
33+
'console_scripts': [
34+
'python-barcode = barcode.pybarcode:main',
35+
],
36+
},
37+
use_scm_version={
38+
'version_scheme': 'post-release',
39+
'write_to': 'barcode/version.py',
40+
},
41+
setup_requires=['setuptools_scm'],
3942
include_package_data=True,
4043
)

test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import unittest
1717

18-
from barcode import get_barcode, get_barcode_class, __version__
18+
from barcode import get_barcode, get_barcode_class, version
1919
try:
2020
from barcode.writer import ImageWriter
2121
except ImportError:
@@ -102,7 +102,7 @@ def test():
102102
# Save htmlfile with all objects
103103
with codecs.open(HTMLFILE, 'w', encoding='utf-8') as f:
104104
obj = '\n'.join(objects)
105-
f.write(HTML.format(version=__version__, body=obj))
105+
f.write(HTML.format(version=version, body=obj))
106106

107107

108108
class TestBarcodeBuilds(unittest.TestCase):

0 commit comments

Comments
 (0)