prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Build adds the user folder inside the code base
  After building the SciPy on Windows 10, the base folder has a copy of the following folder
  
  ```
  C:\Users\<user>\Documents\GitHub\scipy\Users\<user>\AppData\Local\Temp\tmpuvtg6i4i\main.obj
  ```
  From the look of the structure, it seems like a relative folder is used instead of an absolute one hence it recreates the temp folder within the codebase. 
  
  <strike>I think this might be related to the pocketfft development as I recently started to see it but might also be another C++ source change.</strike> Happens at the `cluster._optimal_leaf_ordering` compilation
  
  
  
  </issue>
  <code>
  [start of scipy/fft/_pocketfft/setup.py]
  1 
  2 def try_compile(compiler, code=None, flags=[], ext='.cpp'):
  3     """Returns True if the compiler is able to compile the given code"""
  4     import tempfile
  5     from distutils.errors import CompileError
  6     import os
  7 
  8     code = code or 'int main (int argc, char **argv) { return 0; }'
  9 
  10     with tempfile.TemporaryDirectory() as temp_dir:
  11         fname = os.path.join(temp_dir, 'main'+ext)
  12         with open(fname, 'w') as f:
  13             f.write(code)
  14 
  15         try:
  16             compiler.compile([fname], extra_postargs=flags)
  17         except CompileError:
  18             return False
  19     return True
  20 
  21 
  22 def has_flag(compiler, flag):
  23     return try_compile(compiler, flags=[flag])
  24 
  25 
  26 def get_std_flag(compiler):
  27     # Test the compiler for the highest available c++ standard flag
  28     gnu_flags = ['--std=c++14', '--std=c++11']
  29     flags_by_cc = {
  30         'msvc': ['/std:c++14', None],
  31         'intelw': ['/Qstd=c++14', '/Qstd=c++11']
  32     }
  33     flags = flags_by_cc.get(compiler.compiler_type, gnu_flags)
  34 
  35     for flag in flags:
  36         if flag is None:
  37             return None
  38 
  39         if has_flag(compiler, flag):
  40             return flag
  41 
  42     from numpy.distutils import log
  43     log.warn('Could not detect c++ standard flag')
  44     return None
  45 
  46 
  47 def try_add_flag(args, compiler, flag):
  48     """Appends flag to the list of arguments if supported by the compiler"""
  49     if try_compile(compiler, flags=args+[flag]):
  50         args.append(flag)
  51 
  52 
  53 def pre_build_hook(build_ext, ext):
  54     cc = build_ext._cxx_compiler
  55     args = ext.extra_compile_args
  56 
  57     std_flag = get_std_flag(build_ext._cxx_compiler)
  58     if std_flag is not None:
  59         args.append(std_flag)
  60 
  61     if cc.compiler_type == 'msvc':
  62         args.append('/EHsc')
  63     else:
  64         try_add_flag(args, cc, '-fvisibility=hidden')
  65 
  66         import sys
  67         if sys.platform == 'darwin':
  68             args.append('-mmacosx-version-min=10.7')
  69             try_add_flag(args, cc, '-stdlib=libc++')
  70 
  71 
  72 def configuration(parent_package='', top_path=None):
  73     from numpy.distutils.misc_util import Configuration
  74     import pybind11
  75     include_dirs = [pybind11.get_include(True), pybind11.get_include(False)]
  76 
  77     config = Configuration('_pocketfft', parent_package, top_path)
  78     ext = config.add_extension('pypocketfft',
  79                                sources=['pypocketfft.cxx'],
  80                                depends=['pocketfft_hdronly.h'],
  81                                include_dirs=include_dirs,
  82                                language='c++')
  83     ext._pre_build_hook = pre_build_hook
  84 
  85     config.add_data_files('LICENSE.md')
  86     config.add_data_dir('tests')
  87     return config
  88 
  89 
  90 if __name__ == '__main__':
  91     from numpy.distutils.core import setup
  92     setup(**configuration(top_path='').todict())
  93
  [end of scipy/fft/_pocketfft/setup.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/scipy/fft/_pocketfft/setup.py b/scipy/fft/_pocketfft/setup.py
  --- a/scipy/fft/_pocketfft/setup.py
  +++ b/scipy/fft/_pocketfft/setup.py
  @@ -13,7 +13,7 @@
               f.write(code)
   
           try:
  -            compiler.compile([fname], extra_postargs=flags)
  +            compiler.compile([fname], output_dir=temp_dir, extra_postargs=flags)
           except CompileError:
               return False
       return True
  
verification_info: {"golden_diff": "diff --git a/scipy/fft/_pocketfft/setup.py b/scipy/fft/_pocketfft/setup.py\n--- a/scipy/fft/_pocketfft/setup.py\n+++ b/scipy/fft/_pocketfft/setup.py\n@@ -13,7 +13,7 @@\n             f.write(code)\n \n         try:\n-            compiler.compile([fname], extra_postargs=flags)\n+            compiler.compile([fname], output_dir=temp_dir, extra_postargs=flags)\n         except CompileError:\n             return False\n     return True\n", "issue": "Build adds the user folder inside the code base\nAfter building the SciPy on Windows 10, the base folder has a copy of the following folder\r\n\r\n```\r\nC:\\Users\\<user>\\Documents\\GitHub\\scipy\\Users\\<user>\\AppData\\Local\\Temp\\tmpuvtg6i4i\\main.obj\r\n```\r\nFrom the look of the structure, it seems like a relative folder is used instead of an absolute one hence it recreates the temp folder within the codebase. \r\n\r\n<strike>I think this might be related to the pocketfft development as I recently started to see it but might also be another C++ source change.</strike> Happens at the `cluster._optimal_leaf_ordering` compilation\r\n\r\n\n", "before_files": [{"content": "\ndef try_compile(compiler, code=None, flags=[], ext='.cpp'):\n    \"\"\"Returns True if the compiler is able to compile the given code\"\"\"\n    import tempfile\n    from distutils.errors import CompileError\n    import os\n\n    code = code or 'int main (int argc, char **argv) { return 0; }'\n\n    with tempfile.TemporaryDirectory() as temp_dir:\n        fname = os.path.join(temp_dir, 'main'+ext)\n        with open(fname, 'w') as f:\n            f.write(code)\n\n        try:\n            compiler.compile([fname], extra_postargs=flags)\n        except CompileError:\n            return False\n    return True\n\n\ndef has_flag(compiler, flag):\n    return try_compile(compiler, flags=[flag])\n\n\ndef get_std_flag(compiler):\n    # Test the compiler for the highest available c++ standard flag\n    gnu_flags = ['--std=c++14', '--std=c++11']\n    flags_by_cc = {\n        'msvc': ['/std:c++14', None],\n        'intelw': ['/Qstd=c++14', '/Qstd=c++11']\n    }\n    flags = flags_by_cc.get(compiler.compiler_type, gnu_flags)\n\n    for flag in flags:\n        if flag is None:\n            return None\n\n        if has_flag(compiler, flag):\n            return flag\n\n    from numpy.distutils import log\n    log.warn('Could not detect c++ standard flag')\n    return None\n\n\ndef try_add_flag(args, compiler, flag):\n    \"\"\"Appends flag to the list of arguments if supported by the compiler\"\"\"\n    if try_compile(compiler, flags=args+[flag]):\n        args.append(flag)\n\n\ndef pre_build_hook(build_ext, ext):\n    cc = build_ext._cxx_compiler\n    args = ext.extra_compile_args\n\n    std_flag = get_std_flag(build_ext._cxx_compiler)\n    if std_flag is not None:\n        args.append(std_flag)\n\n    if cc.compiler_type == 'msvc':\n        args.append('/EHsc')\n    else:\n        try_add_flag(args, cc, '-fvisibility=hidden')\n\n        import sys\n        if sys.platform == 'darwin':\n            args.append('-mmacosx-version-min=10.7')\n            try_add_flag(args, cc, '-stdlib=libc++')\n\n\ndef configuration(parent_package='', top_path=None):\n    from numpy.distutils.misc_util import Configuration\n    import pybind11\n    include_dirs = [pybind11.get_include(True), pybind11.get_include(False)]\n\n    config = Configuration('_pocketfft', parent_package, top_path)\n    ext = config.add_extension('pypocketfft',\n                               sources=['pypocketfft.cxx'],\n                               depends=['pocketfft_hdronly.h'],\n                               include_dirs=include_dirs,\n                               language='c++')\n    ext._pre_build_hook = pre_build_hook\n\n    config.add_data_files('LICENSE.md')\n    config.add_data_dir('tests')\n    return config\n\n\nif __name__ == '__main__':\n    from numpy.distutils.core import setup\n    setup(**configuration(top_path='').todict())\n", "path": "scipy/fft/_pocketfft/setup.py"}]}