<NME> setup.py
<BEF> #!/usr/bin/env python

# Original libphonenumber Java code:
#   Copyright (C) 2009-2011 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import distutils.core
import io
import sys
# Importing setuptools adds some features like "setup.py test", but
# it's optional so swallow the error if it's not there.
try:
    import setuptools
    pass

major, minor = sys.version_info[:2]
python_26 = (major > 2 or (major == 2 and minor >= 6))
if not python_26:
    raise RuntimeError("Python 2.6 or newer is required")
python_3x = (major >= 3)
if python_3x:
    dev_status = 'Development Status :: 3 - Alpha'
from phonenumbers import __version__

# Discover whether per-prefix data is available
if 'lite' in sys.argv:
    lite = True
    del sys.argv[sys.argv.index('lite')]
else:
    lite = False
if not lite:
    try:
        import phonenumbers.tzdata
    except ImportError:
        lite = True

with io.open("README.md", mode="r", encoding="utf-8") as readme:
    long_description = readme.read()

# Various parameters depend on whether we are the lite package or not
if lite:
    pkgname = 'phonenumberslite'
    pkgs = ['phonenumbers', 'phonenumbers.data', 'phonenumbers.shortdata']
else:
    pkgname = 'phonenumbers'
    pkgs = ['phonenumbers', 'phonenumbers.data', 'phonenumbers.geodata', 'phonenumbers.shortdata',
            'phonenumbers.carrierdata', 'phonenumbers.tzdata']

distutils.core.setup(name=pkgname,
                     version=__version__,
                     description="Python version of Google's common library for parsing, formatting, storing and validating international phone numbers.",
                     long_description=long_description,
                     long_description_content_type="text/markdown",
                     author='David Drysdale',
                     author_email='dmd@lurklurk.org',
                     url='https://github.com/daviddrysdale/python-phonenumbers',
                     license='Apache License 2.0',
                     packages=pkgs,
                     test_suite="tests.examplenumberstest",
                     platforms='Posix; MacOS X; Windows',
                     package_data={"": ["*.pyi", "py.typed"]},
                     classifiers=['Development Status :: 5 - Production/Stable',
                                  'Intended Audience :: Developers',
                                  'License :: OSI Approved :: Apache Software License',
                                  'Operating System :: OS Independent',
                                  'Topic :: Communications :: Telephony',
                                  'Programming Language :: Python :: 2',
                                  'Programming Language :: Python :: 2.5',
                                  'Programming Language :: Python :: 2.6',
                                  'Programming Language :: Python :: 2.7',
                                  'Programming Language :: Python :: 3',
                                  'Programming Language :: Python :: 3.3',
                                  'Programming Language :: Python :: 3.4',
                                  'Programming Language :: Python :: 3.5',
                                  'Programming Language :: Python :: 3.6',
                                  'Programming Language :: Python :: 3.7',
                                  'Programming Language :: Python :: 3.8',
                                  'Programming Language :: Python :: 3.9',
                                  'Programming Language :: Python :: 3.10',
                                  'Programming Language :: Python :: Implementation :: CPython',
                                  'Programming Language :: Python :: Implementation :: PyPy',
                                  ],
                     )

<MSG> Merge branch 'dev' into python3

<DFF> @@ -25,9 +25,9 @@ except ImportError:
     pass
 
 major, minor = sys.version_info[:2]
-python_26 = (major > 2 or (major == 2 and minor >= 6))
-if not python_26:
-    raise RuntimeError("Python 2.6 or newer is required")
+python_25 = (major > 2 or (major == 2 and minor >= 5))
+if not python_25:
+    raise RuntimeError("Python 2.5 or newer is required")
 python_3x = (major >= 3)
 if python_3x:
     dev_status = 'Development Status :: 3 - Alpha'

{'commit': 'diff --git a/python/phonenumbers/__init__.py b/python/phonenumbers/__init__.py\nindex 72b39068..6a9fd18e 100644\n--- a/python/phonenumbers/__init__.py\n+++ b/python/phonenumbers/__init__.py\n@@ -73,21 +73,55 @@ PhoneNumberMatch [51,62) 703-4800500\n # I\'ll use regular expressions."  Now they have two problems.\'\n #                                                   -- jwz 1997-08-12\n \n-# Version number is taken from the upstream libphonenumber version\n-# together with an indication of the version of the Python-specific code.\n-__version__ = "4.5b1"\n-\n # Data class definitions\n from .phonenumber import PhoneNumber, CountryCodeSource, FrozenPhoneNumber\n from .phonemetadata import REGION_CODE_FOR_NON_GEO_ENTITY, NumberFormat, PhoneNumberDesc, PhoneMetadata\n # Functionality\n from .asyoutypeformatter import AsYouTypeFormatter\n-from .phonenumberutil import *\n+from .phonenumberutil import (COUNTRY_CODE_TO_REGION_CODE, SUPPORTED_REGIONS, UNKNOWN_REGION,\n+                              MatchType, NumberParseException, PhoneNumberFormat,\n+                              PhoneNumberType, ValidationResult,\n+                              convert_alpha_characters_in_number,\n+                              country_code_for_region,\n+                              example_number,\n+                              example_number_for_type,\n+                              example_number_for_non_geo_entity,\n+                              format_by_pattern,\n+                              format_in_original_format,\n+                              format_national_number_with_carrier_code,\n+                              format_national_number_with_preferred_carrier_code,\n+                              format_number_for_mobile_dialing,\n+                              format_number,\n+                              format_out_of_country_calling_number,\n+                              format_out_of_country_keeping_alpha_chars,\n+                              is_alpha_number,\n+                              is_nanpa_country,\n+                              is_number_match,\n+                              is_possible_number,\n+                              is_possible_number_string,\n+                              is_possible_number_with_reason,\n+                              is_valid_number,\n+                              is_valid_number_for_region,\n+                              length_of_geographical_area_code,\n+                              length_of_national_destination_code,\n+                              national_significant_number,\n+                              ndd_prefix_for_region,\n+                              normalize_digits_only,\n+                              number_type,\n+                              parse,\n+                              region_code_for_country_code,\n+                              region_code_for_number,\n+                              truncate_too_long_number,)\n from .shortnumberutil import connects_to_emergency_number, is_emergency_number\n from .phonenumbermatcher import PhoneNumberMatch, PhoneNumberMatcher, Leniency\n from .geocoder import (area_description_for_number, country_name_for_number,\n                        description_for_number, description_for_valid_number)\n \n+\n+# Version number is taken from the upstream libphonenumber version\n+# together with an indication of the version of the Python-specific code.\n+__version__ = "4.5b1"\n+\n __all__ = [\'PhoneNumber\', \'CountryCodeSource\', \'FrozenPhoneNumber\',\n            \'REGION_CODE_FOR_NON_GEO_ENTITY\', \'NumberFormat\', \'PhoneNumberDesc\', \'PhoneMetadata\',\n            \'AsYouTypeFormatter\',\n@@ -126,6 +160,7 @@ __all__ = [\'PhoneNumber\', \'CountryCodeSource\', \'FrozenPhoneNumber\',\n            \'region_code_for_country_code\',\n            \'region_code_for_number\',\n            \'truncate_too_long_number\',\n+           # end of items from phonenumberutil.py\n            \'connects_to_emergency_number\', \'is_emergency_number\',\n            \'PhoneNumberMatch\', \'PhoneNumberMatcher\', \'Leniency\',\n            \'area_description_for_number\',\ndiff --git a/python/setup.py b/python/setup.py\nindex cc4518b6..63fae4a0 100755\n--- a/python/setup.py\n+++ b/python/setup.py\n@@ -25,9 +25,9 @@ except ImportError:\n     pass\n \n major, minor = sys.version_info[:2]\n-python_26 = (major > 2 or (major == 2 and minor >= 6))\n-if not python_26:\n-    raise RuntimeError("Python 2.6 or newer is required")\n+python_25 = (major > 2 or (major == 2 and minor >= 5))\n+if not python_25:\n+    raise RuntimeError("Python 2.5 or newer is required")\n python_3x = (major >= 3)\n if python_3x:\n     dev_status = \'Development Status :: 3 - Alpha\'\n', 'commit_subject': "Merge branch 'dev' into python3", 'repo_name': 'daviddrysdale/python-phonenumbers', 'committer': {'name': 'David Drysdale', 'email': '07f376931f78df73cd6e3224975643f4daeef4c7@lurklurk.org', 'time_sec': '1328605272', 'tz_offset': '0', 'date': {'seconds': '1328605272'}}, 'commit_tree': '7681cb4e45bf3848f77effcf6bb8396ae5bedf55', 'commit_message': "Merge branch 'dev' into python3\n", 'language_name': 'Python', 'license': 'apache-2.0', 'hunks': '@@ -25,9 +25,9 @@ except ImportError:\n     pass\n \n major, minor = sys.version_info[:2]\n-python_26 = (major > 2 or (major == 2 and minor >= 6))\n-if not python_26:\n-    raise RuntimeError("Python 2.6 or newer is required")\n+python_25 = (major > 2 or (major == 2 and minor >= 5))\n+if not python_25:\n+    raise RuntimeError("Python 2.5 or newer is required")\n python_3x = (major >= 3)\n if python_3x:\n     dev_status = \'Development Status :: 3 - Alpha\'\n', 'addition_count': 3, 'deletion_count': 3, 'src_file': 'a/python/setup.py', 'tgt_file': 'b/python/setup.py', 'file_extension': '.py', 'before_file': '#!/usr/bin/env python\n\n# Original libphonenumber Java code:\n#   Copyright (C) 2009-2011 The Libphonenumber Authors\n#\n# Licensed under the Apache License, Version 2.0 (the "License");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an "AS IS" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport distutils.core\nimport io\nimport sys\n# Importing setuptools adds some features like "setup.py test", but\n# it\'s optional so swallow the error if it\'s not there.\ntry:\n    import setuptools\n    pass\n\nmajor, minor = sys.version_info[:2]\npython_26 = (major > 2 or (major == 2 and minor >= 6))\nif not python_26:\n    raise RuntimeError("Python 2.6 or newer is required")\npython_3x = (major >= 3)\nif python_3x:\n    dev_status = \'Development Status :: 3 - Alpha\'\nfrom phonenumbers import __version__\n\n# Discover whether per-prefix data is available\nif \'lite\' in sys.argv:\n    lite = True\n    del sys.argv[sys.argv.index(\'lite\')]\nelse:\n    lite = False\nif not lite:\n    try:\n        import phonenumbers.tzdata\n    except ImportError:\n        lite = True\n\nwith io.open("README.md", mode="r", encoding="utf-8") as readme:\n    long_description = readme.read()\n\n# Various parameters depend on whether we are the lite package or not\nif lite:\n    pkgname = \'phonenumberslite\'\n    pkgs = [\'phonenumbers\', \'phonenumbers.data\', \'phonenumbers.shortdata\']\nelse:\n    pkgname = \'phonenumbers\'\n    pkgs = [\'phonenumbers\', \'phonenumbers.data\', \'phonenumbers.geodata\', \'phonenumbers.shortdata\',\n            \'phonenumbers.carrierdata\', \'phonenumbers.tzdata\']\n\ndistutils.core.setup(name=pkgname,\n                     version=__version__,\n                     description="Python version of Google\'s common library for parsing, formatting, storing and validating international phone numbers.",\n                     long_description=long_description,\n                     long_description_content_type="text/markdown",\n                     author=\'David Drysdale\',\n                     author_email=\'dmd@lurklurk.org\',\n                     url=\'https://github.com/daviddrysdale/python-phonenumbers\',\n                     license=\'Apache License 2.0\',\n                     packages=pkgs,\n                     test_suite="tests.examplenumberstest",\n                     platforms=\'Posix; MacOS X; Windows\',\n                     package_data={"": ["*.pyi", "py.typed"]},\n                     classifiers=[\'Development Status :: 5 - Production/Stable\',\n                                  \'Intended Audience :: Developers\',\n                                  \'License :: OSI Approved :: Apache Software License\',\n                                  \'Operating System :: OS Independent\',\n                                  \'Topic :: Communications :: Telephony\',\n                                  \'Programming Language :: Python :: 2\',\n                                  \'Programming Language :: Python :: 2.5\',\n                                  \'Programming Language :: Python :: 2.6\',\n                                  \'Programming Language :: Python :: 2.7\',\n                                  \'Programming Language :: Python :: 3\',\n                                  \'Programming Language :: Python :: 3.3\',\n                                  \'Programming Language :: Python :: 3.4\',\n                                  \'Programming Language :: Python :: 3.5\',\n                                  \'Programming Language :: Python :: 3.6\',\n                                  \'Programming Language :: Python :: 3.7\',\n                                  \'Programming Language :: Python :: 3.8\',\n                                  \'Programming Language :: Python :: 3.9\',\n                                  \'Programming Language :: Python :: 3.10\',\n                                  \'Programming Language :: Python :: Implementation :: CPython\',\n                                  \'Programming Language :: Python :: Implementation :: PyPy\',\n                                  ],\n                     )\n', 'message': "Merge branch 'dev' into python3\n", 'author_name': 'David Drysdale', 'lang': 'py'}