Skip to content

Commit

Permalink
Hooks: Add hook for phonenumbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurspa committed Jun 6, 2018
1 parent 9a74f7d commit ae41fcf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions PyInstaller/hooks/hook-phonenumbers.py
@@ -0,0 +1,16 @@
#-----------------------------------------------------------------------------
# Copyright (c) 2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#
# Hook for the phonenumbers package: https://pypi.org/project/phonenumbers/
#
# Tested with phonenumbers 8.9.7 and Python 3.6.1, on Ubuntu 16.04 64bit.

from PyInstaller.utils.hooks import collect_submodules

hiddenimports = collect_submodules('phonenumbers')
12 changes: 12 additions & 0 deletions tests/functional/test_libraries.py
Expand Up @@ -781,3 +781,15 @@ def test_uvloop(pyi_builder):
@importorskip('web3')
def test_web3(pyi_builder):
pyi_builder.test_source("import web3")

@importorskip('phonenumbers')
def test_phonenumbers(pyi_builder):
pyi_builder.test_source("""
import phonenumbers
number = '+17034820623'
parsed_number = phonenumbers.parse(number)
assert(parsed_number.country_code == 1)
assert(parsed_number.national_number == 7034820623)
""")
1 change: 1 addition & 0 deletions tests/requirements-libraries.txt
Expand Up @@ -34,6 +34,7 @@ Unidecode==1.0.22
h5py==2.7.1
web3==3.16.5
matplotlib==2.2.0
phonenumbers==8.9.7

# Url for downloading PyCrypto prebuilt Windows binaries:
# http://www.voidspace.org.uk/python/pycrypto-2.6.1/
Expand Down

0 comments on commit ae41fcf

Please sign in to comment.