Package Base Details: python-num2words

Git Clone URL: https://aur.archlinux.org/python-num2words.git (read-only, click to copy)
Submitter: ImNtReal
Maintainer: Rogach
Last Packager: ImNtReal
Votes: 3
Popularity: 0.000100
First Submitted: 2017-07-31 17:29
Last Updated: 2019-12-11 03:32

Latest Comments

Rogach commented on 2020-09-16 08:50

@a.kudelin I usually take the approach of "don't break it if it's not broken". It works for now, and I do not have any package download statistics that can be used to justify removal of the feature.

a.kudelin commented on 2020-09-16 08:25

Maybe it's worth to remove python2 dependency? Arch Linux is in the course to get away from it.

Rogach commented on 2020-09-07 17:09

@genofire Are you sure? I don't see any references to wheel in the repository, and we use setup.py directly (we do not download the pre-built binary package).

genofire commented on 2020-09-07 15:31

Missing dependency: python-wheel

greyltc commented on 2019-09-26 17:55

Why not just stop building this for python2? 2 is dead anyway

Rogach commented on 2019-09-06 21:20

Test failures happen mostly because cli test runner refers to executable simply as python, regardless of what version it was invoked with. So when running python2 setup.py test environment and dependencies are set up for Python 2, but the Python 3 interpreter is invoked instead and the dependency resolution fails.

Also there seems to be an issue with Unicode output when using Python 2.

Below is the patch that fixes both problems and allows the package to build successfully for both python versions.

diff -ruN num2words-0.5.10.orig/bin/num2words num2words-0.5.10/bin/num2words
--- num2words-0.5.10.orig/bin/num2words 2019-09-07 00:06:15.933230111 +0300
+++ num2words-0.5.10/bin/num2words  2019-09-07 00:08:57.515532720 +0300
@@ -82,7 +82,7 @@
         sys.exit(0)
     try:
         words = num2words.num2words(args['<number>'], lang=args['--lang'], to=args['--to'])
-        sys.stdout.write(words+os.linesep)
+        sys.stdout.write((words.encode("utf-8") if sys.version_info[0] == 2 else words) + os.linesep)
         sys.exit(0)
     except Exception as err:
         sys.stderr.write(str(args['<number>']))
diff -ruN num2words-0.5.10.orig/tests/test_cli.py num2words-0.5.10/tests/test_cli.py
--- num2words-0.5.10.orig/tests/test_cli.py 2019-09-07 00:06:15.939896873 +0300
+++ num2words-0.5.10/tests/test_cli.py  2019-09-07 00:06:40.363578331 +0300
@@ -20,6 +20,7 @@

 import os
 import unittest
+import sys

 import delegator

@@ -31,7 +32,7 @@
     def __init__(self):
         self.cmd = os.path.realpath(os.path.join(os.path.dirname(__file__),
                                     "..", "bin", "num2words"))
-        self.cmd_list = ["python", self.cmd]
+        self.cmd_list = [sys.executable, self.cmd]

     def run_cmd(self, *args):
         cmd_list = self.cmd_list + [str(arg) for arg in args]

AbysmalBiscuit commented on 2019-08-29 06:41

I'm also getting test failures, but only with python2. Hence a possible workaround is to only build the python3 variant, if you don't need the python2 one.

ngoonee commented on 2019-08-05 03:39

Anyone getting test failures on this? I get 6 failures seemingly related to default language.

ImNtReal commented on 2019-05-23 13:18

@aucunhenac, I've changed the package, so that the binary for python2 gets renamed to num2words2. That should prevent the error.

aucunhenac commented on 2019-05-23 00:53

When i try update, report this message. I have only one package installed. I tried today:

Packages (2) python-num2words-0.5.9-1 python2-num2words-0.5.9-1

Total Installed Size: 0,92 MiB Net Upgrade Size: 0,55 MiB

:: Proceed with installation? [Y/n] y (2/2) checking keys in keyring [###################] 100% (2/2) checking package integrity [###################] 100% (2/2) loading package files [###################] 100% (2/2) checking for file conflicts [###################] 100% error: failed to commit transaction (conflicting files) /usr/bin/num2words exists in both 'python2-num2words' and 'python-num2words' Errors occurred, no packages were upgraded.