mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Add a command line tool to use num2words, credits to @hernamesbarbara
This commit is contained in:
28
setup.py
28
setup.py
@@ -1,5 +1,9 @@
|
||||
import re
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
PACKAGE_NAME = "num2words"
|
||||
|
||||
CLASSIFIERS = [
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
@@ -16,9 +20,27 @@ CLASSIFIERS = [
|
||||
LONG_DESC = open('README.rst', 'rt').read() + '\n\n' + \
|
||||
open('CHANGES.rst', 'rt').read()
|
||||
|
||||
|
||||
def find_version(fname):
|
||||
"""Parse file & return version number matching 0.0.1 regex
|
||||
Returns str or raises RuntimeError
|
||||
"""
|
||||
version = ''
|
||||
with open(fname, 'r') as fp:
|
||||
reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
|
||||
for line in fp:
|
||||
m = reg.match(line)
|
||||
if m:
|
||||
version = m.group(1)
|
||||
break
|
||||
if not version:
|
||||
raise RuntimeError('Cannot find version information')
|
||||
return version
|
||||
|
||||
|
||||
setup(
|
||||
name='num2words',
|
||||
version='0.5.7',
|
||||
name=PACKAGE_NAME,
|
||||
version=find_version("bin/num2words"),
|
||||
description='Modules to convert numbers to words. Easily extensible.',
|
||||
long_description=LONG_DESC,
|
||||
license='LGPL',
|
||||
@@ -33,4 +55,6 @@ setup(
|
||||
packages=find_packages(exclude=['tests']),
|
||||
test_suite='tests',
|
||||
classifiers=CLASSIFIERS,
|
||||
scripts=['bin/num2words'],
|
||||
install_requires=["docopt>=0.6.2"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user