Generate PYTHONPATH from CMake information

The CMake scripts calculate the install path for python scripts by
  distutils.sysconfig.get_python_lib(
    plat_specific=0,
    standard_lib=0,
    prefix=''
  )
which generates a string in line with
  lib/python2.7/site-packages

This string ends up in the CMake variable PYTHON_DEST and is used by the
install step as destination directory for pcbnew.py.

There has been a hard-coded assumption on the content of that string in
PcbNew which is not compatible with FreeBSD 11.1.

This commit eliminates the hard-coded assumption in PcbNew and reuses
the install path as known by CMake.

Fixes: lp:1777921
* https://bugs.launchpad.net/kicad/+bug/1777921
This commit is contained in:
Martin Aberg 2018-06-20 19:57:18 +02:00 committed by Seth Hillbrand
parent 0a9aedda8b
commit dd3c24faf8
2 changed files with 5 additions and 2 deletions

View File

@ -72,4 +72,7 @@
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
#define KIFACE_PREFIX "@KIFACE_PREFIX@"
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
#endif // CONFIG_H_

View File

@ -263,10 +263,10 @@ static bool scriptingSetup()
wxSetEnv( "PYTHONPATH", pypath );
#else
// Linux-specific setup
wxString pypath;
pypath = Pgm().GetExecutablePath() + wxT( "../lib/python2.7/dist-packages" );
// PYTHON_DEST is the scripts install dir as determined by the build system.
pypath = Pgm().GetExecutablePath() + wxT( "../" PYTHON_DEST );
if( !wxIsEmpty( wxGetenv( wxT( "PYTHONPATH" ) ) ) )
pypath = wxString( wxGetenv( wxT( "PYTHONPATH" ) ) ) + wxT( ":" ) + pypath;