Skip to content
  • Leo P. Singer's avatar
    Copy python scripts from source to build directory · 007f17b2
    Leo P. Singer authored
    This is necessary to run Python programs from pybin_scripts during
    an out-of-srcdir build. We need to be able to run programs from
    pybin_scripts during the build *before* we install them in order to
    do unit tests and in order to generate manpages using help2man.
    The reason is that whenever you run a Python script, "the directory
    containing that file is added to the start of sys.path, and the file
    is executed as the __main__ module" (see
    https://docs.python.org/2/using/cmdline.html). It turns out that if
    the script is a symbolic link, then the symbolic link is *followed*
    before modifying sys.path. As a result, during an out-of-srcdir
    build, the first element of the Python path is the source directory
    that contains the script, which does *not* contain the SWIG
    Python C extension module.
    An alternative workaround would be to make sure that the sources of
    the pybin_scripts files are not in the same source directory as the
    modules.
    Original: 42c80fcd911ad5206f2a085d217bd5c79acee826
    007f17b2