We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
pylibdir of versionindependentpythonpackage.py is overwritten by pythonpackage.py
In 599869d `set_pylibdirs` of [pythonpackage.py](https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/generic/pythonpackage.py) was changed to always set `self.pylibdir` (not only if its value is `UNKNOWN`). This seems to break the `prepare_step` of [versionindependentpythonpackage.py](https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/generic/versionindependentpythonpackage.py) because pylibdir is now overwritten. This forces the `install_step` to crash afterwards due to missing subdirs within the `os.mkdir(full_pylibdir)` command.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `easybuild/easyblocks/generic/versionindependentpythonpackage.py`
Content:
```
1 ##
2 # Copyright 2013-2020 Ghent University
3 #
4 # This file is part of EasyBuild,
5 # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6 # with support of Ghent University (http://ugent.be/hpc),
7 # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8 # Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9 # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10 #
11 # https://github.com/easybuilders/easybuild
12 #
13 # EasyBuild is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation v2.
16 #
17 # EasyBuild is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.
24 ##
25 """
26 EasyBuild support for building and installing a Pythonpackage independend of a python version as an easyblock.
27 
28 Python installs libraries by defailt in site-packages/python-xxx/
29 But packages that are not dependend on the python version can be installed in a different prefix, e.g. lib
30 as long as we add this folder to the pythonpath.
31 
32 @author: Kenneth Hoste, Jens Timmerman (Ghent University)
33 """
34 import os
35 import re
36 
37 import easybuild.tools.environment as env
38 from easybuild.easyblocks.generic.pythonpackage import PythonPackage
39 from easybuild.tools.build_log import EasyBuildError
40 from easybuild.tools.run import run_cmd
41 
42 
43 class VersionIndependentPythonPackage(PythonPackage):
44     """Support for building/installing python packages without requiring a specific python package."""
45 
46     def build_step(self):
47         """No build procedure."""
48         pass
49 
50     def prepare_step(self, *args, **kwargs):
51         """Set pylibdir"""
52         self.pylibdir = 'lib'
53         super(VersionIndependentPythonPackage, self).prepare_step(*args, **kwargs)
54 
55     def install_step(self):
56         """Custom install procedure to skip selection of python package versions."""
57         full_pylibdir = os.path.join(self.installdir, self.pylibdir)
58 
59         env.setvar('PYTHONPATH', '%s:%s' % (full_pylibdir, os.getenv('PYTHONPATH')))
60 
61         try:
62             os.mkdir(full_pylibdir)
63         except OSError as err:
64             # this will raise an error and not return
65             raise EasyBuildError("Failed to install: %s", err)
66 
67         if self.use_setup_py:
68             extra_installopts = [
69                 '--install-lib=%s' % full_pylibdir,
70                 '--single-version-externally-managed',
71                 '--record %s' % os.path.join(self.builddir, 'record'),
72                 '--no-compile',
73             ]
74             self.cfg.update('installopts', ' '.join(extra_installopts))
75         else:
76             # using easy_install or pip always results in installation that is specific to Python version
77             eb_name = self.__class__.__name__
78             raise EasyBuildError("%s easyblock is not compatible with using easy_install or pip", eb_name)
79 
80         cmd = self.compose_install_command(self.installdir)
81         run_cmd(cmd, log_all=True, simple=True, log_output=True)
82 
83         # setuptools stubbornly replaces the shebang line in scripts with
84         # the full path to the Python interpreter used to install;
85         # we change it (back) to '#!/usr/bin/env python' here
86         shebang_re = re.compile("^#!/.*python")
87         bindir = os.path.join(self.installdir, 'bin')
88         if os.path.exists(bindir):
89             for script in os.listdir(bindir):
90                 script = os.path.join(bindir, script)
91                 if os.path.isfile(script):
92                     try:
93                         txt = open(script, 'r').read()
94                         if shebang_re.search(txt):
95                             new_shebang = "#!/usr/bin/env python"
96                             self.log.debug("Patching shebang header line in %s to '%s'" % (script, new_shebang))
97                             txt = shebang_re.sub(new_shebang, txt)
98                             open(script, 'w').write(txt)
99                     except IOError as err:
100                         raise EasyBuildError("Failed to patch shebang header line in %s: %s", script, err)
101
```
--- 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/easybuild/easyblocks/generic/versionindependentpythonpackage.py b/easybuild/easyblocks/generic/versionindependentpythonpackage.py
--- a/easybuild/easyblocks/generic/versionindependentpythonpackage.py
+++ b/easybuild/easyblocks/generic/versionindependentpythonpackage.py
@@ -47,10 +47,11 @@
         """No build procedure."""
         pass
 
-    def prepare_step(self, *args, **kwargs):
-        """Set pylibdir"""
+    def set_pylibdirs(self):
+        """Set pylibdir."""
+        super(VersionIndependentPythonPackage, self).set_pylibdirs()
         self.pylibdir = 'lib'
-        super(VersionIndependentPythonPackage, self).prepare_step(*args, **kwargs)
+        self.all_pylibdirs = ['lib']
 
     def install_step(self):
         """Custom install procedure to skip selection of python package versions."""

{"golden_diff": "diff --git a/easybuild/easyblocks/generic/versionindependentpythonpackage.py b/easybuild/easyblocks/generic/versionindependentpythonpackage.py\n--- a/easybuild/easyblocks/generic/versionindependentpythonpackage.py\n+++ b/easybuild/easyblocks/generic/versionindependentpythonpackage.py\n@@ -47,10 +47,11 @@\n         \"\"\"No build procedure.\"\"\"\n         pass\n \n-    def prepare_step(self, *args, **kwargs):\n-        \"\"\"Set pylibdir\"\"\"\n+    def set_pylibdirs(self):\n+        \"\"\"Set pylibdir.\"\"\"\n+        super(VersionIndependentPythonPackage, self).set_pylibdirs()\n         self.pylibdir = 'lib'\n-        super(VersionIndependentPythonPackage, self).prepare_step(*args, **kwargs)\n+        self.all_pylibdirs = ['lib']\n \n     def install_step(self):\n         \"\"\"Custom install procedure to skip selection of python package versions.\"\"\"\n", "issue": "pylibdir of versionindependentpythonpackage.py is overwritten by pythonpackage.py\nIn 599869d `set_pylibdirs` of [pythonpackage.py](https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/generic/pythonpackage.py) was changed to always set `self.pylibdir` (not only if its value is `UNKNOWN`). This seems to break the `prepare_step` of [versionindependentpythonpackage.py](https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/generic/versionindependentpythonpackage.py) because pylibdir is now overwritten. This forces the `install_step` to crash afterwards due to missing subdirs within the `os.mkdir(full_pylibdir)` command.\n", "before_files": [{"content": "##\n# Copyright 2013-2020 Ghent University\n#\n# This file is part of EasyBuild,\n# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),\n# with support of Ghent University (http://ugent.be/hpc),\n# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),\n# Flemish Research Foundation (FWO) (http://www.fwo.be/en)\n# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).\n#\n# https://github.com/easybuilders/easybuild\n#\n# EasyBuild is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation v2.\n#\n# EasyBuild is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.\n##\n\"\"\"\nEasyBuild support for building and installing a Pythonpackage independend of a python version as an easyblock.\n\nPython installs libraries by defailt in site-packages/python-xxx/\nBut packages that are not dependend on the python version can be installed in a different prefix, e.g. lib\nas long as we add this folder to the pythonpath.\n\n@author: Kenneth Hoste, Jens Timmerman (Ghent University)\n\"\"\"\nimport os\nimport re\n\nimport easybuild.tools.environment as env\nfrom easybuild.easyblocks.generic.pythonpackage import PythonPackage\nfrom easybuild.tools.build_log import EasyBuildError\nfrom easybuild.tools.run import run_cmd\n\n\nclass VersionIndependentPythonPackage(PythonPackage):\n    \"\"\"Support for building/installing python packages without requiring a specific python package.\"\"\"\n\n    def build_step(self):\n        \"\"\"No build procedure.\"\"\"\n        pass\n\n    def prepare_step(self, *args, **kwargs):\n        \"\"\"Set pylibdir\"\"\"\n        self.pylibdir = 'lib'\n        super(VersionIndependentPythonPackage, self).prepare_step(*args, **kwargs)\n\n    def install_step(self):\n        \"\"\"Custom install procedure to skip selection of python package versions.\"\"\"\n        full_pylibdir = os.path.join(self.installdir, self.pylibdir)\n\n        env.setvar('PYTHONPATH', '%s:%s' % (full_pylibdir, os.getenv('PYTHONPATH')))\n\n        try:\n            os.mkdir(full_pylibdir)\n        except OSError as err:\n            # this will raise an error and not return\n            raise EasyBuildError(\"Failed to install: %s\", err)\n\n        if self.use_setup_py:\n            extra_installopts = [\n                '--install-lib=%s' % full_pylibdir,\n                '--single-version-externally-managed',\n                '--record %s' % os.path.join(self.builddir, 'record'),\n                '--no-compile',\n            ]\n            self.cfg.update('installopts', ' '.join(extra_installopts))\n        else:\n            # using easy_install or pip always results in installation that is specific to Python version\n            eb_name = self.__class__.__name__\n            raise EasyBuildError(\"%s easyblock is not compatible with using easy_install or pip\", eb_name)\n\n        cmd = self.compose_install_command(self.installdir)\n        run_cmd(cmd, log_all=True, simple=True, log_output=True)\n\n        # setuptools stubbornly replaces the shebang line in scripts with\n        # the full path to the Python interpreter used to install;\n        # we change it (back) to '#!/usr/bin/env python' here\n        shebang_re = re.compile(\"^#!/.*python\")\n        bindir = os.path.join(self.installdir, 'bin')\n        if os.path.exists(bindir):\n            for script in os.listdir(bindir):\n                script = os.path.join(bindir, script)\n                if os.path.isfile(script):\n                    try:\n                        txt = open(script, 'r').read()\n                        if shebang_re.search(txt):\n                            new_shebang = \"#!/usr/bin/env python\"\n                            self.log.debug(\"Patching shebang header line in %s to '%s'\" % (script, new_shebang))\n                            txt = shebang_re.sub(new_shebang, txt)\n                            open(script, 'w').write(txt)\n                    except IOError as err:\n                        raise EasyBuildError(\"Failed to patch shebang header line in %s: %s\", script, err)\n", "path": "easybuild/easyblocks/generic/versionindependentpythonpackage.py"}], "after_files": [{"content": "##\n# Copyright 2013-2020 Ghent University\n#\n# This file is part of EasyBuild,\n# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),\n# with support of Ghent University (http://ugent.be/hpc),\n# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),\n# Flemish Research Foundation (FWO) (http://www.fwo.be/en)\n# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).\n#\n# https://github.com/easybuilders/easybuild\n#\n# EasyBuild is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation v2.\n#\n# EasyBuild is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.\n##\n\"\"\"\nEasyBuild support for building and installing a Pythonpackage independend of a python version as an easyblock.\n\nPython installs libraries by defailt in site-packages/python-xxx/\nBut packages that are not dependend on the python version can be installed in a different prefix, e.g. lib\nas long as we add this folder to the pythonpath.\n\n@author: Kenneth Hoste, Jens Timmerman (Ghent University)\n\"\"\"\nimport os\nimport re\n\nimport easybuild.tools.environment as env\nfrom easybuild.easyblocks.generic.pythonpackage import PythonPackage\nfrom easybuild.tools.build_log import EasyBuildError\nfrom easybuild.tools.run import run_cmd\n\n\nclass VersionIndependentPythonPackage(PythonPackage):\n    \"\"\"Support for building/installing python packages without requiring a specific python package.\"\"\"\n\n    def build_step(self):\n        \"\"\"No build procedure.\"\"\"\n        pass\n\n    def set_pylibdirs(self):\n        \"\"\"Set pylibdir.\"\"\"\n        super(VersionIndependentPythonPackage, self).set_pylibdirs()\n        self.pylibdir = 'lib'\n        self.all_pylibdirs = ['lib']\n\n    def install_step(self):\n        \"\"\"Custom install procedure to skip selection of python package versions.\"\"\"\n        full_pylibdir = os.path.join(self.installdir, self.pylibdir)\n\n        env.setvar('PYTHONPATH', '%s:%s' % (full_pylibdir, os.getenv('PYTHONPATH')))\n\n        try:\n            os.mkdir(full_pylibdir)\n        except OSError as err:\n            # this will raise an error and not return\n            raise EasyBuildError(\"Failed to install: %s\", err)\n\n        if self.use_setup_py:\n            extra_installopts = [\n                '--install-lib=%s' % full_pylibdir,\n                '--single-version-externally-managed',\n                '--record %s' % os.path.join(self.builddir, 'record'),\n                '--no-compile',\n            ]\n            self.cfg.update('installopts', ' '.join(extra_installopts))\n        else:\n            # using easy_install or pip always results in installation that is specific to Python version\n            eb_name = self.__class__.__name__\n            raise EasyBuildError(\"%s easyblock is not compatible with using easy_install or pip\", eb_name)\n\n        cmd = self.compose_install_command(self.installdir)\n        run_cmd(cmd, log_all=True, simple=True, log_output=True)\n\n        # setuptools stubbornly replaces the shebang line in scripts with\n        # the full path to the Python interpreter used to install;\n        # we change it (back) to '#!/usr/bin/env python' here\n        shebang_re = re.compile(\"^#!/.*python\")\n        bindir = os.path.join(self.installdir, 'bin')\n        if os.path.exists(bindir):\n            for script in os.listdir(bindir):\n                script = os.path.join(bindir, script)\n                if os.path.isfile(script):\n                    try:\n                        txt = open(script, 'r').read()\n                        if shebang_re.search(txt):\n                            new_shebang = \"#!/usr/bin/env python\"\n                            self.log.debug(\"Patching shebang header line in %s to '%s'\" % (script, new_shebang))\n                            txt = shebang_re.sub(new_shebang, txt)\n                            open(script, 'w').write(txt)\n                    except IOError as err:\n                        raise EasyBuildError(\"Failed to patch shebang header line in %s: %s\", script, err)\n", "path": "easybuild/easyblocks/generic/versionindependentpythonpackage.py"}]}