← Back to team overview

kicad-developers team mailing list archive

Re: wxPython version check

 

There is a variable that is already in use in CMakeLists.txt, PYTHON_SITE_PACKAGE_PATH, that can be used to point to an alternate library path.  I don’t know where this variable came from but I believe it was being used by KicadOSXbuilder for this purpose at one point.

This (or something) just needs to be prepended to the path of the python performing the check.

-        set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
+        set( _py_cmd "import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )

This works for me but if anyones sees an issue with this please speak up.  If I got the quoting right then an unset PYTHON_SITE_PACKAGE_PATH would simply prepend an empty path and search the default sys.path as usual.

Garth


> On Feb 15, 2015, at 4:55 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
> 
> On 2/15/2015 7:42 PM, Garth Corral wrote:
>> I’m pretty sure you do not understand what I’m saying.
> 
> Perhaps you are right.  To better understand how you would use CMake to
> ensure the the correct version of wxPython is somewhere on you system
> and gets installed along with KiCad, please modify CMakeList.txt and
> send me a patch.  Maybe then I will understand how you would solve the
> problem.  Ignoring wxPython as a build dependency is not an option and
> neither is the download_foo ugliness that we currently have.  That
> should be moved to a higher level outside of the kicad source like
> kicad-winbuilder.
> 
>> 
>> 
>>> On Feb 15, 2015, at 4:41 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
>>> 
>>> On 2/15/2015 7:27 PM, Garth Corral wrote:
>>>> I think perhaps we’re having a miscommunication.  I don’t think it’s
>>>> thin ice at all to build a version of a dependency and then pointing my
>>>> kicad build at it.  I think it’s more of an issue to assume that
>>>> whatever is installed on your system is the right thing.  What if I
>>>> needed different versions of wxWidgets for other developement work and
>>>> also wanted to build kicad with a different version?  It seems perfectly
>>>> reasonable to build wxPython specifically for kicad.
>>> 
>>> It is.  I do it all the time.  I build and install the latest versions
>>> wxPython, wxWidgets, Boost, etc. and set up my build environment to
>>> build kicad against these custom builds without touching my default
>>> system configuration.  The key action is the install and configure part.
>>> Just building the correct version of a dependency is not enough.
>>> 
>>>> 
>>>> I also think that the build time and runtime behavior are being
>>>> conflated.  There is nothing other than the version check that requires
>>>> wxPython to ‘run’ at build time.  Prior to this it was enough to build
>>>> it and put everything int the right place and then tell the python
>>>> interpreter where to look a runtime.  At least that’s what’s been
>>>> happening all along on OS X.
>>> 
>>> This has been happening on all platform all along and it has bitten
>>> other devs because their wxWidgets and wxPythons version did not match
>>> causing pcbnew to crash.  There was even a bug report filed against it.
>>> That is why the change was made.
>>> 
>>>> 
>>>> This version check just assumes that it will be instaled on the system,
>>>> and I think that’s wrong.
>>> 
>>> That's exactly what build configuration tools like CMake and autotools
>>> are designed for not just creating Makefiles.  Why would you even
>>> attempt to build any software if the prerequisites cannot be found on
>>> your system?  How would you even know if the software was correctly
>>> built?  You have been doing this manually except in the wrong order.
>>> 
>>>> 
>>>> Garth
>>>> 
>>>> On Feb 15, 2015, at 4:16 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>> 
>>>>> On 2/15/2015 7:06 PM, Garth Corral wrote:
>>>>>> Well, yes, you’ve sort of explained the problem.  Unless wxPython is
>>>>>> on the library path or using PYTHONPATH it isn’t going to work, and I
>>>>>> don’t have wxPython installed on my system for any other purpose.
>>>>>> So, invoking the system python as is done in the version check isn’t
>>>>>> going to work without first pointing it to a path that contains the
>>>>>> wxPython library.
>>>>>> 
>>>>>> I’ve been building wxPython as part of my kicad builds and passing
>>>>>> -DPYTHON_SITE_PACKAGE_PATH to cmake with the built wxPython library.
>>>>>> Up to now this has worked for me.
>>>>> 
>>>>> This should have never worked in the first place.  Would you expect
>>>>> kicad to build if a valid version of wxWidgets or Boost could not be
>>>>> found?  The build configuration should have always checked for a valid
>>>>> install of wxPython before allowing you to build kicad with
>>>>> -DKICAD_SCRIPTING_WXPYTHON=ON.  You will have to tell the python
>>>>> interpreter where wxPython is installed before you configure the kicad
>>>>> build.  I'm sorry for the inconvenience but you've been skating on thin
>>>>> ice with the previous behavior.
>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Garth
>>>>>> 
>>>>>> 
>>>>>>> On Feb 15, 2015, at 3:54 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>>>> 
>>>>>>> I'm confused.  How else should this work?  If configure your kicad build
>>>>>>> to include wxPython, then one would expect the configuration to fail if
>>>>>>> wxPython is not installed or the correct version.  Irregardless of where
>>>>>>> wxPython is installed on your system, python still needs to know where
>>>>>>> it is installed before you can use it either by installing wxPython into
>>>>>>> your python library path, adding the path programmatically during python
>>>>>>> scripting initialization, or using PTYHONPATH.
>>>>>>> 
>>>>>>> On 2/15/2015 6:39 PM, Garth Corral wrote:
>>>>>>>> I build wxPython as part of my kicad build.  So if you just invoke
>>>>>>>> python and do, import wxversion, it will fail with an import error
>>>>>>>> because it can’t find the module.  I’d need to set the python path
>>>>>>>> to point to my built wxPython.  When all is compiled and installed,
>>>>>>>> everything works because the libraries are moved into the right places.
>>>>>>>> 
>>>>>>>> Garth
>>>>>>>> 
>>>>>>>>> On Feb 15, 2015, at 3:36 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx
>>>>>>>>> <mailto:stambaughw@xxxxxxxxx>> wrote:
>>>>>>>>> 
>>>>>>>>> If you don't have wxPython installed, how are you compiling with
>>>>>>>>> KICAD_SCRIPTING_WXPYTHON=ON?  The wxPython configuration check and the
>>>>>>>>> python scripting version selection initialization only happen when you
>>>>>>>>> configure your build with KICAD_SCRIPTING_WXPYTHON=ON.
>>>>>>>>> 
>>>>>>>>> On 2/15/2015 6:30 PM, Garth Corral wrote:
>>>>>>>>>> 
>>>>>>>>>> Hmm…  So, unless I’m missing something, the new wxPython version
>>>>>>>>>> check isn’t ever going to work for me.  I don’t have wxPython
>>>>>>>>>> installed as part of my system install so importing wxversion is
>>>>>>>>>> always going to fail unless I point it to my wxPython that I
>>>>>>>>>> build as part of my kicad builds.  Anyone else experiencing this?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Garth
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Follow ups

References