prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  santiy_check_commands doesn't work for ipython
  
  
  </issue>
  <code>
  [start of easybuild/framework/extensioneasyblock.py]
  1 ##
  2 # Copyright 2013 Ghent University
  3 #
  4 # This file is part of EasyBuild,
  5 # originally created by the HPC team of the University of Ghent (http://ugent.be/hpc).
  6 #
  7 # http://github.com/hpcugent/easybuild
  8 #
  9 # EasyBuild is free software: you can redistribute it and/or modify
  10 # it under the terms of the GNU General Public License as published by
  11 # the Free Software Foundation v2.
  12 #
  13 # EasyBuild is distributed in the hope that it will be useful,
  14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16 # GNU General Public License for more details.
  17 #
  18 # You should have received a copy of the GNU General Public License
  19 # along with EasyBuild.  If not, see <http://www.gnu.org/licenses/>.
  20 ##
  21 """
  22 EasyBuild support for building and installing extensions as actual extensions or as stand-alone modules,
  23 implemented as an easyblock
  24 
  25 @author: Kenneth Hoste (Ghent University)
  26 """
  27 import copy
  28 import os
  29 
  30 from easybuild.framework.easyblock import EasyBlock
  31 from easybuild.framework.easyconfig import CUSTOM
  32 from easybuild.framework.extension import Extension
  33 from easybuild.tools.filetools import apply_patch, extract_file
  34 from easybuild.tools.utilities import remove_unwanted_chars
  35 
  36 
  37 class ExtensionEasyBlock(EasyBlock, Extension):
  38     """
  39     Install an extension as a separate module, or as an extension.
  40 
  41     Deriving classes should implement the following functions:
  42     * required EasyBlock functions:
  43       - configure_step
  44       - build_step
  45       - install_step
  46     * required Extension functions
  47       - run
  48     """
  49 
  50     @staticmethod
  51     def extra_options(extra_vars=None):
  52         """Extra easyconfig parameters specific to ExtensionEasyBlock."""
  53 
  54         # using [] as default value is a bad idea, so we handle it this way
  55         if extra_vars is None:
  56             extra_vars = []
  57 
  58         extra_vars.extend([
  59                            ('options', [{}, "Dictionary with extension options.", CUSTOM]),
  60                           ])
  61         return EasyBlock.extra_options(extra_vars)
  62 
  63     def __init__(self, *args, **kwargs):
  64         """Initialize either as EasyBlock or as Extension."""
  65 
  66         self.is_extension = False
  67 
  68         if isinstance(args[0], EasyBlock):
  69             Extension.__init__(self, *args, **kwargs)
  70             # name and version properties of EasyBlock are used, so make sure name and version are correct
  71             self.cfg['name'] = self.ext.get('name', None)
  72             self.cfg['version'] = self.ext.get('version', None)
  73             self.builddir = self.master.builddir
  74             self.installdir = self.master.installdir
  75             self.is_extension = True
  76             self.unpack_options = None
  77         else:
  78             EasyBlock.__init__(self, *args, **kwargs)
  79             self.options = copy.deepcopy(self.cfg.get('options', {}))  # we need this for Extension.sanity_check_step
  80 
  81         self.ext_dir = None  # dir where extension source was unpacked
  82 
  83     def run(self, unpack_src=False):
  84         """Common operations for extensions: unpacking sources, patching, ..."""
  85 
  86         # unpack file if desired
  87         if unpack_src:
  88             targetdir = os.path.join(self.master.builddir, remove_unwanted_chars(self.name))
  89             self.ext_dir = extract_file("%s" % self.src, targetdir, extra_options=self.unpack_options)
  90 
  91         # patch if needed
  92         if self.patches:
  93             for patchfile in self.patches:
  94                 if not apply_patch(patchfile, self.ext_dir):
  95                     self.log.error("Applying patch %s failed" % patchfile)
  96 
  97     def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None):
  98         """
  99         Custom sanity check for extensions, whether installed as stand-alone module or not
  100         """
  101         if not self.cfg['exts_filter']:
  102             self.cfg['exts_filter'] = exts_filter
  103         self.log.debug("starting sanity check for extension with filter %s", self.cfg['exts_filter'])
  104 
  105         if not self.is_extension:
  106             # load fake module
  107             fake_mod_data = self.load_fake_module(purge=True)
  108 
  109         # perform sanity check
  110         sanity_check_ok = Extension.sanity_check_step(self)
  111 
  112         if not self.is_extension:
  113             # unload fake module and clean up
  114             self.clean_up_fake_module(fake_mod_data)
  115 
  116         if custom_paths or custom_commands:
  117             EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands,
  118                 extension=self.is_extension)
  119 
  120         # pass or fail sanity check
  121         if not sanity_check_ok:
  122             msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs))
  123             if self.is_extension:
  124                 self.log.warning(msg)
  125             else:
  126                 self.log.error(msg)
  127             return False
  128         else:
  129             self.log.info("Sanity check for %s successful!" % self.name)
  130             return True
  131 
  132     def make_module_extra(self, extra=None):
  133         """Add custom entries to module."""
  134 
  135         txt = EasyBlock.make_module_extra(self)
  136         if not extra is None:
  137             txt += extra
  138         return txt
  139
  [end of easybuild/framework/extensioneasyblock.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/easybuild/framework/extensioneasyblock.py b/easybuild/framework/extensioneasyblock.py
  --- a/easybuild/framework/extensioneasyblock.py
  +++ b/easybuild/framework/extensioneasyblock.py
  @@ -113,7 +113,7 @@
               # unload fake module and clean up
               self.clean_up_fake_module(fake_mod_data)
   
  -        if custom_paths or custom_commands:
  +        if custom_paths or self.cfg['sanity_check_paths'] or custom_commands or self.cfg['sanity_check_commands']:
               EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands,
                   extension=self.is_extension)
  
verification_info: {"golden_diff": "diff --git a/easybuild/framework/extensioneasyblock.py b/easybuild/framework/extensioneasyblock.py\n--- a/easybuild/framework/extensioneasyblock.py\n+++ b/easybuild/framework/extensioneasyblock.py\n@@ -113,7 +113,7 @@\n             # unload fake module and clean up\n             self.clean_up_fake_module(fake_mod_data)\n \n-        if custom_paths or custom_commands:\n+        if custom_paths or self.cfg['sanity_check_paths'] or custom_commands or self.cfg['sanity_check_commands']:\n             EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands,\n                 extension=self.is_extension)\n", "issue": "santiy_check_commands doesn't work for ipython\n\n", "before_files": [{"content": "##\n# Copyright 2013 Ghent University\n#\n# This file is part of EasyBuild,\n# originally created by the HPC team of the University of Ghent (http://ugent.be/hpc).\n#\n# http://github.com/hpcugent/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 extensions as actual extensions or as stand-alone modules,\nimplemented as an easyblock\n\n@author: Kenneth Hoste (Ghent University)\n\"\"\"\nimport copy\nimport os\n\nfrom easybuild.framework.easyblock import EasyBlock\nfrom easybuild.framework.easyconfig import CUSTOM\nfrom easybuild.framework.extension import Extension\nfrom easybuild.tools.filetools import apply_patch, extract_file\nfrom easybuild.tools.utilities import remove_unwanted_chars\n\n\nclass ExtensionEasyBlock(EasyBlock, Extension):\n    \"\"\"\n    Install an extension as a separate module, or as an extension.\n\n    Deriving classes should implement the following functions:\n    * required EasyBlock functions:\n      - configure_step\n      - build_step\n      - install_step\n    * required Extension functions\n      - run\n    \"\"\"\n\n    @staticmethod\n    def extra_options(extra_vars=None):\n        \"\"\"Extra easyconfig parameters specific to ExtensionEasyBlock.\"\"\"\n\n        # using [] as default value is a bad idea, so we handle it this way\n        if extra_vars is None:\n            extra_vars = []\n\n        extra_vars.extend([\n                           ('options', [{}, \"Dictionary with extension options.\", CUSTOM]),\n                          ])\n        return EasyBlock.extra_options(extra_vars)\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Initialize either as EasyBlock or as Extension.\"\"\"\n\n        self.is_extension = False\n\n        if isinstance(args[0], EasyBlock):\n            Extension.__init__(self, *args, **kwargs)\n            # name and version properties of EasyBlock are used, so make sure name and version are correct\n            self.cfg['name'] = self.ext.get('name', None)\n            self.cfg['version'] = self.ext.get('version', None)\n            self.builddir = self.master.builddir\n            self.installdir = self.master.installdir\n            self.is_extension = True\n            self.unpack_options = None\n        else:\n            EasyBlock.__init__(self, *args, **kwargs)\n            self.options = copy.deepcopy(self.cfg.get('options', {}))  # we need this for Extension.sanity_check_step\n\n        self.ext_dir = None  # dir where extension source was unpacked\n\n    def run(self, unpack_src=False):\n        \"\"\"Common operations for extensions: unpacking sources, patching, ...\"\"\"\n\n        # unpack file if desired\n        if unpack_src:\n            targetdir = os.path.join(self.master.builddir, remove_unwanted_chars(self.name))\n            self.ext_dir = extract_file(\"%s\" % self.src, targetdir, extra_options=self.unpack_options)\n\n        # patch if needed\n        if self.patches:\n            for patchfile in self.patches:\n                if not apply_patch(patchfile, self.ext_dir):\n                    self.log.error(\"Applying patch %s failed\" % patchfile)\n\n    def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None):\n        \"\"\"\n        Custom sanity check for extensions, whether installed as stand-alone module or not\n        \"\"\"\n        if not self.cfg['exts_filter']:\n            self.cfg['exts_filter'] = exts_filter\n        self.log.debug(\"starting sanity check for extension with filter %s\", self.cfg['exts_filter'])\n\n        if not self.is_extension:\n            # load fake module\n            fake_mod_data = self.load_fake_module(purge=True)\n\n        # perform sanity check\n        sanity_check_ok = Extension.sanity_check_step(self)\n\n        if not self.is_extension:\n            # unload fake module and clean up\n            self.clean_up_fake_module(fake_mod_data)\n\n        if custom_paths or custom_commands:\n            EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands,\n                extension=self.is_extension)\n\n        # pass or fail sanity check\n        if not sanity_check_ok:\n            msg = \"Sanity check for %s failed: %s\" % (self.name, '; '.join(self.sanity_check_fail_msgs))\n            if self.is_extension:\n                self.log.warning(msg)\n            else:\n                self.log.error(msg)\n            return False\n        else:\n            self.log.info(\"Sanity check for %s successful!\" % self.name)\n            return True\n\n    def make_module_extra(self, extra=None):\n        \"\"\"Add custom entries to module.\"\"\"\n\n        txt = EasyBlock.make_module_extra(self)\n        if not extra is None:\n            txt += extra\n        return txt\n", "path": "easybuild/framework/extensioneasyblock.py"}]}