We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
setup.py: Install scripts without extensions on UNIX-like platforms
Because of issue #394 , meson install scripts as `xxx.py` , but in linux, install script with a extension name is no a good practice. And change the installed script name also break some package depend on meson.

Could you deal with it for different platform?

thx.


--- 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 python3
2 
3 # Copyright 2016 The Meson development team
4 
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 import sys
18 
19 if sys.version_info[0] < 3:
20     print('Tried to install with Python 2, Meson only supports Python 3.')
21     sys.exit(1)
22 
23 # We need to support Python installations that have nothing but the basic
24 # Python installation. Use setuptools when possible and fall back to
25 # plain distutils when setuptools is not available.
26 try:
27     from setuptools import setup
28 except ImportError:
29     from distutils.core import setup
30 
31 from mesonbuild.coredata import version
32 
33 setup(name='meson',
34       version=version,
35       description='A high performance build system',
36       author='Jussi Pakkanen',
37       author_email='jpakkane@gmail.com',
38       url='http://mesonbuild.com',
39       license=' Apache License, Version 2.0',
40       packages=['mesonbuild',
41                 'mesonbuild.modules',
42                 'mesonbuild.scripts',
43                 'mesonbuild.backend',
44                 'mesonbuild.wrap'],
45       scripts=['meson.py',
46                'mesonconf.py',
47                'mesonintrospect.py',
48                'wraptool.py'],
49       data_files=[('share/man/man1', ['man/meson.1',
50                                       'man/mesonconf.1',
51                                       'man/mesonintrospect.1',
52                                       'man/wraptool.1'])],
53       classifiers=['Development Status :: 5 - Production/Stable',
54                    'Environment :: Console',
55                    'Intended Audience :: Developers',
56                    'License :: OSI Approved :: Apache Software License',
57                    'Natural Language :: English',
58                    'Operating System :: MacOS :: MacOS X',
59                    'Operating System :: Microsoft :: Windows',
60                    'Operating System :: POSIX :: BSD',
61                    'Operating System :: POSIX :: Linux',
62                    'Programming Language :: Python :: 3 :: Only',
63                    'Topic :: Software Development :: Build Tools',
64                    ],
65       long_description='''Meson is a cross-platform build system designed to be both as
66 fast and as user friendly as possible. It supports many languages and compilers, including
67 GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
68 complete DSL.''')
69
```
--- 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()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
 import sys
+from os import path
 
 if sys.version_info[0] < 3:
     print('Tried to install with Python 2, Meson only supports Python 3.')
@@ -25,8 +27,32 @@
 # plain distutils when setuptools is not available.
 try:
     from setuptools import setup
+    from setuptools.command.install_scripts import install_scripts as orig
 except ImportError:
     from distutils.core import setup
+    from distutils.command.install_scripts import install_scripts as orig
+
+from distutils.file_util import copy_file
+from distutils.dir_util import mkpath
+from stat import ST_MODE
+
+class install_scripts(orig):
+    def run(self):
+        if sys.platform == 'win32':
+            super().run()
+            return
+
+        self.outfiles = []
+        if not self.dry_run:
+            mkpath(self.install_dir)
+
+        # We want the files to be installed without a suffix on Unix
+        for infile in self.get_inputs():
+            in_stripped = infile[:-3] if infile.endswith('.py') else infile
+            outfile = path.join(self.install_dir, in_stripped)
+            # NOTE: Mode is preserved by default
+            copy_file(infile, outfile, dry_run=self.dry_run)
+            self.outfiles.append(outfile)
 
 from mesonbuild.coredata import version
 
@@ -46,6 +72,7 @@
                'mesonconf.py',
                'mesonintrospect.py',
                'wraptool.py'],
+      cmdclass={'install_scripts': install_scripts},
       data_files=[('share/man/man1', ['man/meson.1',
                                       'man/mesonconf.1',
                                       'man/mesonintrospect.1',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -14,7 +14,9 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n+import os\n import sys\n+from os import path\n \n if sys.version_info[0] < 3:\n     print('Tried to install with Python 2, Meson only supports Python 3.')\n@@ -25,8 +27,32 @@\n # plain distutils when setuptools is not available.\n try:\n     from setuptools import setup\n+    from setuptools.command.install_scripts import install_scripts as orig\n except ImportError:\n     from distutils.core import setup\n+    from distutils.command.install_scripts import install_scripts as orig\n+\n+from distutils.file_util import copy_file\n+from distutils.dir_util import mkpath\n+from stat import ST_MODE\n+\n+class install_scripts(orig):\n+    def run(self):\n+        if sys.platform == 'win32':\n+            super().run()\n+            return\n+\n+        self.outfiles = []\n+        if not self.dry_run:\n+            mkpath(self.install_dir)\n+\n+        # We want the files to be installed without a suffix on Unix\n+        for infile in self.get_inputs():\n+            in_stripped = infile[:-3] if infile.endswith('.py') else infile\n+            outfile = path.join(self.install_dir, in_stripped)\n+            # NOTE: Mode is preserved by default\n+            copy_file(infile, outfile, dry_run=self.dry_run)\n+            self.outfiles.append(outfile)\n \n from mesonbuild.coredata import version\n \n@@ -46,6 +72,7 @@\n                'mesonconf.py',\n                'mesonintrospect.py',\n                'wraptool.py'],\n+      cmdclass={'install_scripts': install_scripts},\n       data_files=[('share/man/man1', ['man/meson.1',\n                                       'man/mesonconf.1',\n                                       'man/mesonintrospect.1',\n", "issue": "setup.py: Install scripts without extensions on UNIX-like platforms\nBecause of issue #394 , meson install scripts as `xxx.py` , but in linux, install script with a extension name is no a good practice. And change the installed script name also break some package depend on meson.\n\nCould you deal with it for different platform?\n\nthx.\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright 2016 The Meson development team\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 sys\n\nif sys.version_info[0] < 3:\n    print('Tried to install with Python 2, Meson only supports Python 3.')\n    sys.exit(1)\n\n# We need to support Python installations that have nothing but the basic\n# Python installation. Use setuptools when possible and fall back to\n# plain distutils when setuptools is not available.\ntry:\n    from setuptools import setup\nexcept ImportError:\n    from distutils.core import setup\n\nfrom mesonbuild.coredata import version\n\nsetup(name='meson',\n      version=version,\n      description='A high performance build system',\n      author='Jussi Pakkanen',\n      author_email='jpakkane@gmail.com',\n      url='http://mesonbuild.com',\n      license=' Apache License, Version 2.0',\n      packages=['mesonbuild',\n                'mesonbuild.modules',\n                'mesonbuild.scripts',\n                'mesonbuild.backend',\n                'mesonbuild.wrap'],\n      scripts=['meson.py',\n               'mesonconf.py',\n               'mesonintrospect.py',\n               'wraptool.py'],\n      data_files=[('share/man/man1', ['man/meson.1',\n                                      'man/mesonconf.1',\n                                      'man/mesonintrospect.1',\n                                      'man/wraptool.1'])],\n      classifiers=['Development Status :: 5 - Production/Stable',\n                   'Environment :: Console',\n                   'Intended Audience :: Developers',\n                   'License :: OSI Approved :: Apache Software License',\n                   'Natural Language :: English',\n                   'Operating System :: MacOS :: MacOS X',\n                   'Operating System :: Microsoft :: Windows',\n                   'Operating System :: POSIX :: BSD',\n                   'Operating System :: POSIX :: Linux',\n                   'Programming Language :: Python :: 3 :: Only',\n                   'Topic :: Software Development :: Build Tools',\n                   ],\n      long_description='''Meson is a cross-platform build system designed to be both as\nfast and as user friendly as possible. It supports many languages and compilers, including\nGCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing\ncomplete DSL.''')\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright 2016 The Meson development team\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 os\nimport sys\nfrom os import path\n\nif sys.version_info[0] < 3:\n    print('Tried to install with Python 2, Meson only supports Python 3.')\n    sys.exit(1)\n\n# We need to support Python installations that have nothing but the basic\n# Python installation. Use setuptools when possible and fall back to\n# plain distutils when setuptools is not available.\ntry:\n    from setuptools import setup\n    from setuptools.command.install_scripts import install_scripts as orig\nexcept ImportError:\n    from distutils.core import setup\n    from distutils.command.install_scripts import install_scripts as orig\n\nfrom distutils.file_util import copy_file\nfrom distutils.dir_util import mkpath\nfrom stat import ST_MODE\n\nclass install_scripts(orig):\n    def run(self):\n        if sys.platform == 'win32':\n            super().run()\n            return\n\n        self.outfiles = []\n        if not self.dry_run:\n            mkpath(self.install_dir)\n\n        # We want the files to be installed without a suffix on Unix\n        for infile in self.get_inputs():\n            in_stripped = infile[:-3] if infile.endswith('.py') else infile\n            outfile = path.join(self.install_dir, in_stripped)\n            # NOTE: Mode is preserved by default\n            copy_file(infile, outfile, dry_run=self.dry_run)\n            self.outfiles.append(outfile)\n\nfrom mesonbuild.coredata import version\n\nsetup(name='meson',\n      version=version,\n      description='A high performance build system',\n      author='Jussi Pakkanen',\n      author_email='jpakkane@gmail.com',\n      url='http://mesonbuild.com',\n      license=' Apache License, Version 2.0',\n      packages=['mesonbuild',\n                'mesonbuild.modules',\n                'mesonbuild.scripts',\n                'mesonbuild.backend',\n                'mesonbuild.wrap'],\n      scripts=['meson.py',\n               'mesonconf.py',\n               'mesonintrospect.py',\n               'wraptool.py'],\n      cmdclass={'install_scripts': install_scripts},\n      data_files=[('share/man/man1', ['man/meson.1',\n                                      'man/mesonconf.1',\n                                      'man/mesonintrospect.1',\n                                      'man/wraptool.1'])],\n      classifiers=['Development Status :: 5 - Production/Stable',\n                   'Environment :: Console',\n                   'Intended Audience :: Developers',\n                   'License :: OSI Approved :: Apache Software License',\n                   'Natural Language :: English',\n                   'Operating System :: MacOS :: MacOS X',\n                   'Operating System :: Microsoft :: Windows',\n                   'Operating System :: POSIX :: BSD',\n                   'Operating System :: POSIX :: Linux',\n                   'Programming Language :: Python :: 3 :: Only',\n                   'Topic :: Software Development :: Build Tools',\n                   ],\n      long_description='''Meson is a cross-platform build system designed to be both as\nfast and as user friendly as possible. It supports many languages and compilers, including\nGCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing\ncomplete DSL.''')\n", "path": "setup.py"}]}