prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Installation issues when using pdm
  [pdm](https://github.com/frostming/pdm/) is a new tool for Python environment managing.
  It works very well, but when I try to install playwright, it fails to install. You can find the details here: 
  https://github.com/frostming/pdm/issues/269
  
  The PDM developer points out that playwright seems to be missing some required fields in the wheels configs (see last comment in the linked issue).
  
  I would highly appreciate if you could look into this issue. Cheers! 🍺
  
  --- 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 # Copyright (c) Microsoft Corporation.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 # http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import glob
  16 import os
  17 import shutil
  18 import subprocess
  19 import sys
  20 import zipfile
  21 from pathlib import Path
  22 
  23 import setuptools
  24 from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
  25 
  26 driver_version = "1.9.0-1614037901000"
  27 
  28 def extractall(zip: zipfile.ZipFile, path: str) -> None:
  29     for name in zip.namelist():
  30         member = zip.getinfo(name)
  31         extracted_path = zip.extract(member, path)
  32         attr = member.external_attr >> 16
  33         if attr != 0:
  34             os.chmod(extracted_path, attr)
  35 
  36 
  37 class PlaywrightBDistWheelCommand(BDistWheelCommand):
  38     def run(self) -> None:
  39         if os.path.exists("build"):
  40             shutil.rmtree("build")
  41         if os.path.exists("dist"):
  42             shutil.rmtree("dist")
  43         if os.path.exists("playwright.egg-info"):
  44             shutil.rmtree("playwright.egg-info")
  45         super().run()
  46         os.makedirs("driver", exist_ok=True)
  47         os.makedirs("playwright/driver", exist_ok=True)
  48         for platform in ["mac", "linux", "win32", "win32_x64"]:
  49             zip_file = f"playwright-{driver_version}-{platform}.zip"
  50             if not os.path.exists("driver/" + zip_file):
  51                 url = "https://playwright.azureedge.net/builds/driver/"
  52                 url = url + "next/"
  53                 url = url + zip_file
  54                 print("Fetching ", url)
  55                 subprocess.check_call(
  56                     ["curl", "--http1.1", url, "-o", "driver/" + zip_file]
  57                 )
  58         base_wheel_location = glob.glob("dist/*.whl")[0]
  59         without_platform = base_wheel_location[:-7]
  60         platform_map = {
  61             "darwin": "mac",
  62             "linux": "linux",
  63             "win32": "win32_x64" if sys.maxsize > 2 ** 32 else "win32",
  64         }
  65         for platform in ["mac", "linux", "win32", "win32_x64"]:
  66             zip_file = f"driver/playwright-{driver_version}-{platform}.zip"
  67             with zipfile.ZipFile(zip_file, "r") as zip:
  68                 extractall(zip, f"driver/{platform}")
  69             if platform_map[sys.platform] == platform:
  70                 with zipfile.ZipFile(zip_file, "r") as zip:
  71                     extractall(zip, "playwright/driver")
  72             wheel = ""
  73             if platform == "mac":
  74                 wheel = "macosx_10_13_x86_64.whl"
  75             if platform == "linux":
  76                 wheel = "manylinux1_x86_64.whl"
  77             if platform == "win32":
  78                 wheel = "win32.whl"
  79             if platform == "win32_x64":
  80                 wheel = "win_amd64.whl"
  81             wheel_location = without_platform + wheel
  82             shutil.copy(base_wheel_location, wheel_location)
  83             with zipfile.ZipFile(wheel_location, "a") as zip:
  84                 driver_root = os.path.abspath(f"driver/{platform}")
  85                 for dir_path, _, files in os.walk(driver_root):
  86                     for file in files:
  87                         from_path = os.path.join(dir_path, file)
  88                         to_path = os.path.relpath(from_path, driver_root)
  89                         zip.write(from_path, f"playwright/driver/{to_path}")
  90             if platform == "mac":
  91                 # Ship mac both as 10_13 as and 11_0 universal to work across Macs.
  92                 universal_location = without_platform + "macosx_11_0_universal2.whl"
  93                 shutil.copyfile(wheel_location, universal_location)
  94                 with zipfile.ZipFile(universal_location, "a") as zip:
  95                     zip.writestr("playwright/driver/README.md", "Universal Mac package")
  96 
  97         os.remove(base_wheel_location)
  98 
  99 
  100 setuptools.setup(
  101     name="playwright",
  102     author="Microsoft Corporation",
  103     author_email="",
  104     description="A high-level API to automate web browsers",
  105     long_description=Path("README.md").read_text(encoding="utf-8"),
  106     long_description_content_type="text/markdown",
  107     url="https://github.com/Microsoft/playwright-python",
  108     packages=["playwright"],
  109     include_package_data=True,
  110     install_requires=[
  111         "greenlet==1.0.0",
  112         "pyee>=8.0.1",
  113         "typing-extensions;python_version<='3.8'",
  114     ],
  115     classifiers=[
  116         "Topic :: Software Development :: Testing",
  117         "Topic :: Internet :: WWW/HTTP :: Browsers",
  118         "Intended Audience :: Developers",
  119         "Programming Language :: Python :: 3",
  120         "Programming Language :: Python :: 3.7",
  121         "Programming Language :: Python :: 3.8",
  122         "Programming Language :: Python :: 3.9",
  123         "License :: OSI Approved :: Apache Software License",
  124         "Operating System :: OS Independent",
  125     ],
  126     python_requires=">=3.7",
  127     cmdclass={"bdist_wheel": PlaywrightBDistWheelCommand},
  128     use_scm_version={
  129         "version_scheme": "post-release",
  130         "write_to": "playwright/_repo_version.py",
  131         "write_to_template": 'version = "{version}"\n',
  132     },
  133     setup_requires=["setuptools_scm", "wheel"],
  134     entry_points={
  135         "console_scripts": [
  136             "playwright=playwright.__main__:main",
  137         ],
  138     },
  139 )
  140
  ```
  --- 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
  @@ -21,10 +21,12 @@
   from pathlib import Path
   
   import setuptools
  +from auditwheel.wheeltools import InWheel
   from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
   
   driver_version = "1.9.0-1614037901000"
   
  +
   def extractall(zip: zipfile.ZipFile, path: str) -> None:
       for name in zip.namelist():
           member = zip.getinfo(name)
  @@ -95,6 +97,18 @@
                       zip.writestr("playwright/driver/README.md", "Universal Mac package")
   
           os.remove(base_wheel_location)
  +        for whlfile in glob.glob("dist/*.whl"):
  +
  +            os.makedirs("wheelhouse", exist_ok=True)
  +            with InWheel(
  +                in_wheel=whlfile,
  +                out_wheel=os.path.join("wheelhouse", os.path.basename(whlfile)),
  +                ret_self=True,
  +            ):
  +                print("Updating RECORD file of %s" % whlfile)
  +        shutil.rmtree("dist")
  +        print("Copying new wheels")
  +        shutil.move("wheelhouse", "dist")
   
   
   setuptools.setup(
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -21,10 +21,12 @@\n from pathlib import Path\n \n import setuptools\n+from auditwheel.wheeltools import InWheel\n from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand\n \n driver_version = \"1.9.0-1614037901000\"\n \n+\n def extractall(zip: zipfile.ZipFile, path: str) -> None:\n     for name in zip.namelist():\n         member = zip.getinfo(name)\n@@ -95,6 +97,18 @@\n                     zip.writestr(\"playwright/driver/README.md\", \"Universal Mac package\")\n \n         os.remove(base_wheel_location)\n+        for whlfile in glob.glob(\"dist/*.whl\"):\n+\n+            os.makedirs(\"wheelhouse\", exist_ok=True)\n+            with InWheel(\n+                in_wheel=whlfile,\n+                out_wheel=os.path.join(\"wheelhouse\", os.path.basename(whlfile)),\n+                ret_self=True,\n+            ):\n+                print(\"Updating RECORD file of %s\" % whlfile)\n+        shutil.rmtree(\"dist\")\n+        print(\"Copying new wheels\")\n+        shutil.move(\"wheelhouse\", \"dist\")\n \n \n setuptools.setup(\n", "issue": "Installation issues when using pdm\n[pdm](https://github.com/frostming/pdm/) is a new tool for Python environment managing.\r\nIt works very well, but when I try to install playwright, it fails to install. You can find the details here: \r\nhttps://github.com/frostming/pdm/issues/269\r\n\r\nThe PDM developer points out that playwright seems to be missing some required fields in the wheels configs (see last comment in the linked issue).\r\n\r\nI would highly appreciate if you could look into this issue. Cheers! \ud83c\udf7a\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation.\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 glob\nimport os\nimport shutil\nimport subprocess\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nimport setuptools\nfrom wheel.bdist_wheel import bdist_wheel as BDistWheelCommand\n\ndriver_version = \"1.9.0-1614037901000\"\n\ndef extractall(zip: zipfile.ZipFile, path: str) -> None:\n    for name in zip.namelist():\n        member = zip.getinfo(name)\n        extracted_path = zip.extract(member, path)\n        attr = member.external_attr >> 16\n        if attr != 0:\n            os.chmod(extracted_path, attr)\n\n\nclass PlaywrightBDistWheelCommand(BDistWheelCommand):\n    def run(self) -> None:\n        if os.path.exists(\"build\"):\n            shutil.rmtree(\"build\")\n        if os.path.exists(\"dist\"):\n            shutil.rmtree(\"dist\")\n        if os.path.exists(\"playwright.egg-info\"):\n            shutil.rmtree(\"playwright.egg-info\")\n        super().run()\n        os.makedirs(\"driver\", exist_ok=True)\n        os.makedirs(\"playwright/driver\", exist_ok=True)\n        for platform in [\"mac\", \"linux\", \"win32\", \"win32_x64\"]:\n            zip_file = f\"playwright-{driver_version}-{platform}.zip\"\n            if not os.path.exists(\"driver/\" + zip_file):\n                url = \"https://playwright.azureedge.net/builds/driver/\"\n                url = url + \"next/\"\n                url = url + zip_file\n                print(\"Fetching \", url)\n                subprocess.check_call(\n                    [\"curl\", \"--http1.1\", url, \"-o\", \"driver/\" + zip_file]\n                )\n        base_wheel_location = glob.glob(\"dist/*.whl\")[0]\n        without_platform = base_wheel_location[:-7]\n        platform_map = {\n            \"darwin\": \"mac\",\n            \"linux\": \"linux\",\n            \"win32\": \"win32_x64\" if sys.maxsize > 2 ** 32 else \"win32\",\n        }\n        for platform in [\"mac\", \"linux\", \"win32\", \"win32_x64\"]:\n            zip_file = f\"driver/playwright-{driver_version}-{platform}.zip\"\n            with zipfile.ZipFile(zip_file, \"r\") as zip:\n                extractall(zip, f\"driver/{platform}\")\n            if platform_map[sys.platform] == platform:\n                with zipfile.ZipFile(zip_file, \"r\") as zip:\n                    extractall(zip, \"playwright/driver\")\n            wheel = \"\"\n            if platform == \"mac\":\n                wheel = \"macosx_10_13_x86_64.whl\"\n            if platform == \"linux\":\n                wheel = \"manylinux1_x86_64.whl\"\n            if platform == \"win32\":\n                wheel = \"win32.whl\"\n            if platform == \"win32_x64\":\n                wheel = \"win_amd64.whl\"\n            wheel_location = without_platform + wheel\n            shutil.copy(base_wheel_location, wheel_location)\n            with zipfile.ZipFile(wheel_location, \"a\") as zip:\n                driver_root = os.path.abspath(f\"driver/{platform}\")\n                for dir_path, _, files in os.walk(driver_root):\n                    for file in files:\n                        from_path = os.path.join(dir_path, file)\n                        to_path = os.path.relpath(from_path, driver_root)\n                        zip.write(from_path, f\"playwright/driver/{to_path}\")\n            if platform == \"mac\":\n                # Ship mac both as 10_13 as and 11_0 universal to work across Macs.\n                universal_location = without_platform + \"macosx_11_0_universal2.whl\"\n                shutil.copyfile(wheel_location, universal_location)\n                with zipfile.ZipFile(universal_location, \"a\") as zip:\n                    zip.writestr(\"playwright/driver/README.md\", \"Universal Mac package\")\n\n        os.remove(base_wheel_location)\n\n\nsetuptools.setup(\n    name=\"playwright\",\n    author=\"Microsoft Corporation\",\n    author_email=\"\",\n    description=\"A high-level API to automate web browsers\",\n    long_description=Path(\"README.md\").read_text(encoding=\"utf-8\"),\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/Microsoft/playwright-python\",\n    packages=[\"playwright\"],\n    include_package_data=True,\n    install_requires=[\n        \"greenlet==1.0.0\",\n        \"pyee>=8.0.1\",\n        \"typing-extensions;python_version<='3.8'\",\n    ],\n    classifiers=[\n        \"Topic :: Software Development :: Testing\",\n        \"Topic :: Internet :: WWW/HTTP :: Browsers\",\n        \"Intended Audience :: Developers\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Operating System :: OS Independent\",\n    ],\n    python_requires=\">=3.7\",\n    cmdclass={\"bdist_wheel\": PlaywrightBDistWheelCommand},\n    use_scm_version={\n        \"version_scheme\": \"post-release\",\n        \"write_to\": \"playwright/_repo_version.py\",\n        \"write_to_template\": 'version = \"{version}\"\\n',\n    },\n    setup_requires=[\"setuptools_scm\", \"wheel\"],\n    entry_points={\n        \"console_scripts\": [\n            \"playwright=playwright.__main__:main\",\n        ],\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation.\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 glob\nimport os\nimport shutil\nimport subprocess\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nimport setuptools\nfrom auditwheel.wheeltools import InWheel\nfrom wheel.bdist_wheel import bdist_wheel as BDistWheelCommand\n\ndriver_version = \"1.9.0-1614037901000\"\n\n\ndef extractall(zip: zipfile.ZipFile, path: str) -> None:\n    for name in zip.namelist():\n        member = zip.getinfo(name)\n        extracted_path = zip.extract(member, path)\n        attr = member.external_attr >> 16\n        if attr != 0:\n            os.chmod(extracted_path, attr)\n\n\nclass PlaywrightBDistWheelCommand(BDistWheelCommand):\n    def run(self) -> None:\n        if os.path.exists(\"build\"):\n            shutil.rmtree(\"build\")\n        if os.path.exists(\"dist\"):\n            shutil.rmtree(\"dist\")\n        if os.path.exists(\"playwright.egg-info\"):\n            shutil.rmtree(\"playwright.egg-info\")\n        super().run()\n        os.makedirs(\"driver\", exist_ok=True)\n        os.makedirs(\"playwright/driver\", exist_ok=True)\n        for platform in [\"mac\", \"linux\", \"win32\", \"win32_x64\"]:\n            zip_file = f\"playwright-{driver_version}-{platform}.zip\"\n            if not os.path.exists(\"driver/\" + zip_file):\n                url = \"https://playwright.azureedge.net/builds/driver/\"\n                url = url + \"next/\"\n                url = url + zip_file\n                print(\"Fetching \", url)\n                subprocess.check_call(\n                    [\"curl\", \"--http1.1\", url, \"-o\", \"driver/\" + zip_file]\n                )\n        base_wheel_location = glob.glob(\"dist/*.whl\")[0]\n        without_platform = base_wheel_location[:-7]\n        platform_map = {\n            \"darwin\": \"mac\",\n            \"linux\": \"linux\",\n            \"win32\": \"win32_x64\" if sys.maxsize > 2 ** 32 else \"win32\",\n        }\n        for platform in [\"mac\", \"linux\", \"win32\", \"win32_x64\"]:\n            zip_file = f\"driver/playwright-{driver_version}-{platform}.zip\"\n            with zipfile.ZipFile(zip_file, \"r\") as zip:\n                extractall(zip, f\"driver/{platform}\")\n            if platform_map[sys.platform] == platform:\n                with zipfile.ZipFile(zip_file, \"r\") as zip:\n                    extractall(zip, \"playwright/driver\")\n            wheel = \"\"\n            if platform == \"mac\":\n                wheel = \"macosx_10_13_x86_64.whl\"\n            if platform == \"linux\":\n                wheel = \"manylinux1_x86_64.whl\"\n            if platform == \"win32\":\n                wheel = \"win32.whl\"\n            if platform == \"win32_x64\":\n                wheel = \"win_amd64.whl\"\n            wheel_location = without_platform + wheel\n            shutil.copy(base_wheel_location, wheel_location)\n            with zipfile.ZipFile(wheel_location, \"a\") as zip:\n                driver_root = os.path.abspath(f\"driver/{platform}\")\n                for dir_path, _, files in os.walk(driver_root):\n                    for file in files:\n                        from_path = os.path.join(dir_path, file)\n                        to_path = os.path.relpath(from_path, driver_root)\n                        zip.write(from_path, f\"playwright/driver/{to_path}\")\n            if platform == \"mac\":\n                # Ship mac both as 10_13 as and 11_0 universal to work across Macs.\n                universal_location = without_platform + \"macosx_11_0_universal2.whl\"\n                shutil.copyfile(wheel_location, universal_location)\n                with zipfile.ZipFile(universal_location, \"a\") as zip:\n                    zip.writestr(\"playwright/driver/README.md\", \"Universal Mac package\")\n\n        os.remove(base_wheel_location)\n        for whlfile in glob.glob(\"dist/*.whl\"):\n\n            os.makedirs(\"wheelhouse\", exist_ok=True)\n            with InWheel(\n                in_wheel=whlfile,\n                out_wheel=os.path.join(\"wheelhouse\", os.path.basename(whlfile)),\n                ret_self=True,\n            ):\n                print(\"Updating RECORD file of %s\" % whlfile)\n        shutil.rmtree(\"dist\")\n        print(\"Copying new wheels\")\n        shutil.move(\"wheelhouse\", \"dist\")\n\n\nsetuptools.setup(\n    name=\"playwright\",\n    author=\"Microsoft Corporation\",\n    author_email=\"\",\n    description=\"A high-level API to automate web browsers\",\n    long_description=Path(\"README.md\").read_text(encoding=\"utf-8\"),\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/Microsoft/playwright-python\",\n    packages=[\"playwright\"],\n    include_package_data=True,\n    install_requires=[\n        \"greenlet==1.0.0\",\n        \"pyee>=8.0.1\",\n        \"typing-extensions;python_version<='3.8'\",\n    ],\n    classifiers=[\n        \"Topic :: Software Development :: Testing\",\n        \"Topic :: Internet :: WWW/HTTP :: Browsers\",\n        \"Intended Audience :: Developers\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Operating System :: OS Independent\",\n    ],\n    python_requires=\">=3.7\",\n    cmdclass={\"bdist_wheel\": PlaywrightBDistWheelCommand},\n    use_scm_version={\n        \"version_scheme\": \"post-release\",\n        \"write_to\": \"playwright/_repo_version.py\",\n        \"write_to_template\": 'version = \"{version}\"\\n',\n    },\n    setup_requires=[\"setuptools_scm\", \"wheel\"],\n    entry_points={\n        \"console_scripts\": [\n            \"playwright=playwright.__main__:main\",\n        ],\n    },\n)\n", "path": "setup.py"}]}