prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  setup.py lacks appropriate metadata for differing python versions
  Please see this issue for the full context: https://github.com/NixOS/nixpkgs/issues/46318
  
  Basically, it appears the METADATA in the resulting installation differs depending on the installation method.
  
  I've done some minimal patching to `setup.py` to include the same `python_version` constraints that appear in `setup.cfg` and it appears to fix the issues with regards to METADATA.
  
  However, I'm not very experienced in python packaging and am surprised that no one else has run into this issue before me.
  
  Can anyone confirm that there is a mismatch here and that adding additional constraints to `setup.py` would be appropriate? I'll go ahead and get a PR together in the meantime.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 
  3 from setuptools import setup
  4 
  5 import os
  6 import re
  7 import codecs
  8 
  9 base_path = os.path.dirname(__file__)
  10 
  11 # Get the version (borrowed from SQLAlchemy)
  12 with open(os.path.join(base_path, 'src', 'urllib3', '__init__.py')) as fp:
  13     VERSION = re.compile(r".*__version__ = '(.*?)'",
  14                          re.S).match(fp.read()).group(1)
  15 
  16 with codecs.open('README.rst', encoding='utf-8') as fp:
  17     readme = fp.read()
  18 with codecs.open('CHANGES.rst', encoding='utf-8') as fp:
  19     changes = fp.read()
  20 version = VERSION
  21 
  22 setup(name='urllib3',
  23       version=version,
  24       description="HTTP library with thread-safe connection pooling, file post, and more.",
  25       long_description=u'\n\n'.join([readme, changes]),
  26       classifiers=[
  27           'Environment :: Web Environment',
  28           'Intended Audience :: Developers',
  29           'License :: OSI Approved :: MIT License',
  30           'Operating System :: OS Independent',
  31           'Programming Language :: Python',
  32           'Programming Language :: Python :: 2',
  33           'Programming Language :: Python :: 2.7',
  34           'Programming Language :: Python :: 3',
  35           'Programming Language :: Python :: 3.4',
  36           'Programming Language :: Python :: 3.5',
  37           'Programming Language :: Python :: 3.6',
  38           'Programming Language :: Python :: 3.7',
  39           'Programming Language :: Python :: 3.8',
  40           'Programming Language :: Python :: Implementation :: CPython',
  41           'Programming Language :: Python :: Implementation :: PyPy',
  42           'Topic :: Internet :: WWW/HTTP',
  43           'Topic :: Software Development :: Libraries',
  44       ],
  45       keywords='urllib httplib threadsafe filepost http https ssl pooling',
  46       author='Andrey Petrov',
  47       author_email='andrey.petrov@shazow.net',
  48       url='https://urllib3.readthedocs.io/',
  49       license='MIT',
  50       packages=['urllib3',
  51                 'urllib3.packages', 'urllib3.packages.ssl_match_hostname',
  52                 'urllib3.packages.backports', 'urllib3.packages.rfc3986',
  53                 'urllib3.contrib', 'urllib3.contrib._securetransport',
  54                 'urllib3.util'],
  55       package_dir={'': 'src'},
  56       requires=[],
  57       python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4",
  58       tests_require=[
  59           # These are a less-specific subset of dev-requirements.txt, for the
  60           # convenience of distro package maintainers.
  61           'pytest',
  62           'mock',
  63           'tornado',
  64       ],
  65       test_suite='test',
  66       extras_require={
  67           'secure': [
  68               'pyOpenSSL >= 0.14',
  69               'cryptography>=1.3.4',
  70               'idna>=2.0.0',
  71               'certifi',
  72               "ipaddress",
  73           ],
  74           'socks': [
  75               'PySocks>=1.5.6,<2.0,!=1.5.7',
  76           ]
  77       },
  78       )
  79
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -65,11 +65,11 @@
         test_suite='test',
         extras_require={
             'secure': [
  -              'pyOpenSSL >= 0.14',
  +              'pyOpenSSL>=0.14',
                 'cryptography>=1.3.4',
                 'idna>=2.0.0',
                 'certifi',
  -              "ipaddress",
  +              "ipaddress; python_version=='2.7'",
             ],
             'socks': [
                 'PySocks>=1.5.6,<2.0,!=1.5.7',
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -65,11 +65,11 @@\n       test_suite='test',\n       extras_require={\n           'secure': [\n-              'pyOpenSSL >= 0.14',\n+              'pyOpenSSL>=0.14',\n               'cryptography>=1.3.4',\n               'idna>=2.0.0',\n               'certifi',\n-              \"ipaddress\",\n+              \"ipaddress; python_version=='2.7'\",\n           ],\n           'socks': [\n               'PySocks>=1.5.6,<2.0,!=1.5.7',\n", "issue": "setup.py lacks appropriate metadata for differing python versions\nPlease see this issue for the full context: https://github.com/NixOS/nixpkgs/issues/46318\r\n\r\nBasically, it appears the METADATA in the resulting installation differs depending on the installation method.\r\n\r\nI've done some minimal patching to `setup.py` to include the same `python_version` constraints that appear in `setup.cfg` and it appears to fix the issues with regards to METADATA.\r\n\r\nHowever, I'm not very experienced in python packaging and am surprised that no one else has run into this issue before me.\r\n\r\nCan anyone confirm that there is a mismatch here and that adding additional constraints to `setup.py` would be appropriate? I'll go ahead and get a PR together in the meantime.\n", "before_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nimport os\nimport re\nimport codecs\n\nbase_path = os.path.dirname(__file__)\n\n# Get the version (borrowed from SQLAlchemy)\nwith open(os.path.join(base_path, 'src', 'urllib3', '__init__.py')) as fp:\n    VERSION = re.compile(r\".*__version__ = '(.*?)'\",\n                         re.S).match(fp.read()).group(1)\n\nwith codecs.open('README.rst', encoding='utf-8') as fp:\n    readme = fp.read()\nwith codecs.open('CHANGES.rst', encoding='utf-8') as fp:\n    changes = fp.read()\nversion = VERSION\n\nsetup(name='urllib3',\n      version=version,\n      description=\"HTTP library with thread-safe connection pooling, file post, and more.\",\n      long_description=u'\\n\\n'.join([readme, changes]),\n      classifiers=[\n          'Environment :: Web Environment',\n          'Intended Audience :: Developers',\n          'License :: OSI Approved :: MIT License',\n          'Operating System :: OS Independent',\n          'Programming Language :: Python',\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 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 :: Implementation :: CPython',\n          'Programming Language :: Python :: Implementation :: PyPy',\n          'Topic :: Internet :: WWW/HTTP',\n          'Topic :: Software Development :: Libraries',\n      ],\n      keywords='urllib httplib threadsafe filepost http https ssl pooling',\n      author='Andrey Petrov',\n      author_email='andrey.petrov@shazow.net',\n      url='https://urllib3.readthedocs.io/',\n      license='MIT',\n      packages=['urllib3',\n                'urllib3.packages', 'urllib3.packages.ssl_match_hostname',\n                'urllib3.packages.backports', 'urllib3.packages.rfc3986',\n                'urllib3.contrib', 'urllib3.contrib._securetransport',\n                'urllib3.util'],\n      package_dir={'': 'src'},\n      requires=[],\n      python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4\",\n      tests_require=[\n          # These are a less-specific subset of dev-requirements.txt, for the\n          # convenience of distro package maintainers.\n          'pytest',\n          'mock',\n          'tornado',\n      ],\n      test_suite='test',\n      extras_require={\n          'secure': [\n              'pyOpenSSL >= 0.14',\n              'cryptography>=1.3.4',\n              'idna>=2.0.0',\n              'certifi',\n              \"ipaddress\",\n          ],\n          'socks': [\n              'PySocks>=1.5.6,<2.0,!=1.5.7',\n          ]\n      },\n      )\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nimport os\nimport re\nimport codecs\n\nbase_path = os.path.dirname(__file__)\n\n# Get the version (borrowed from SQLAlchemy)\nwith open(os.path.join(base_path, 'src', 'urllib3', '__init__.py')) as fp:\n    VERSION = re.compile(r\".*__version__ = '(.*?)'\",\n                         re.S).match(fp.read()).group(1)\n\nwith codecs.open('README.rst', encoding='utf-8') as fp:\n    readme = fp.read()\nwith codecs.open('CHANGES.rst', encoding='utf-8') as fp:\n    changes = fp.read()\nversion = VERSION\n\nsetup(name='urllib3',\n      version=version,\n      description=\"HTTP library with thread-safe connection pooling, file post, and more.\",\n      long_description=u'\\n\\n'.join([readme, changes]),\n      classifiers=[\n          'Environment :: Web Environment',\n          'Intended Audience :: Developers',\n          'License :: OSI Approved :: MIT License',\n          'Operating System :: OS Independent',\n          'Programming Language :: Python',\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 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 :: Implementation :: CPython',\n          'Programming Language :: Python :: Implementation :: PyPy',\n          'Topic :: Internet :: WWW/HTTP',\n          'Topic :: Software Development :: Libraries',\n      ],\n      keywords='urllib httplib threadsafe filepost http https ssl pooling',\n      author='Andrey Petrov',\n      author_email='andrey.petrov@shazow.net',\n      url='https://urllib3.readthedocs.io/',\n      license='MIT',\n      packages=['urllib3',\n                'urllib3.packages', 'urllib3.packages.ssl_match_hostname',\n                'urllib3.packages.backports', 'urllib3.packages.rfc3986',\n                'urllib3.contrib', 'urllib3.contrib._securetransport',\n                'urllib3.util'],\n      package_dir={'': 'src'},\n      requires=[],\n      python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4\",\n      tests_require=[\n          # These are a less-specific subset of dev-requirements.txt, for the\n          # convenience of distro package maintainers.\n          'pytest',\n          'mock',\n          'tornado',\n      ],\n      test_suite='test',\n      extras_require={\n          'secure': [\n              'pyOpenSSL>=0.14',\n              'cryptography>=1.3.4',\n              'idna>=2.0.0',\n              'certifi',\n              \"ipaddress; python_version=='2.7'\",\n          ],\n          'socks': [\n              'PySocks>=1.5.6,<2.0,!=1.5.7',\n          ]\n      },\n      )\n", "path": "setup.py"}]}