from distutils.core import Extension
from os.path import dirname, join


def get_extensions():
    ROOT = dirname(__file__)

    return [
        Extension('astropy.utils._compiler',
                  [join(ROOT, 'src', 'compiler.c')])
        ]

from distutils.core import Extension
from os.path import dirname, join, relpath


def get_extensions():
    ROOT = dirname(__file__)

    return [
        Extension('astropy.utils._compiler',
                  [relpath(join(ROOT, 'src', 'compiler.c'))])
        ]

Make sure to use the relative path for all C extension source files. Otherwise distuils' MSVC compiler generates some potentially long (too long for Windows) pathnames in the build\temp dir for various compiler artifacts. (This was particularly problematic in Jenkins, where having multiple configuration matrix axes can make for long path names.)
Make sure to use the relative path for all C extension source files.  Otherwise distuils' MSVC compiler generates some potentially long (too long for Windows) pathnames in the build\temp dir for various compiler artifacts.  (This was particularly problematic in Jenkins, where having multiple configuration matrix axes can make for long path names.)

  from distutils.core import Extension
- from os.path import dirname, join
+ from os.path import dirname, join, relpath
  
  
  def get_extensions():
      ROOT = dirname(__file__)
  
      return [
          Extension('astropy.utils._compiler',
-                   [join(ROOT, 'src', 'compiler.c')])
+                   [relpath(join(ROOT, 'src', 'compiler.c'))])
          ]
  
Make sure to use the relative path for all C extension source files. Otherwise distuils' MSVC compiler generates some potentially long (too long for Windows) pathnames in the build\temp dir for various compiler artifacts. (This was particularly problematic in Jenkins, where having multiple configuration matrix axes can make for long path names.)
## Code Before:
from distutils.core import Extension
from os.path import dirname, join


def get_extensions():
    ROOT = dirname(__file__)

    return [
        Extension('astropy.utils._compiler',
                  [join(ROOT, 'src', 'compiler.c')])
        ]

## Instruction:
Make sure to use the relative path for all C extension source files. Otherwise distuils' MSVC compiler generates some potentially long (too long for Windows) pathnames in the build\temp dir for various compiler artifacts. (This was particularly problematic in Jenkins, where having multiple configuration matrix axes can make for long path names.)
## Code After:
from distutils.core import Extension
from os.path import dirname, join, relpath


def get_extensions():
    ROOT = dirname(__file__)

    return [
        Extension('astropy.utils._compiler',
                  [relpath(join(ROOT, 'src', 'compiler.c'))])
        ]
