Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kicad: python2 -> python3 #72813

Closed
wants to merge 4 commits into from
Closed

kicad: python2 -> python3 #72813

wants to merge 4 commits into from

Conversation

@matthuszagh
Copy link
Contributor

@matthuszagh matthuszagh commented Nov 5, 2019

Motivation for this change

Python2 is EOL and KiCad supports Python 3.

Things done

Bump python version to 3, wx_python to Phoenix and gtk2 to gtk3.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@evils
Copy link
Contributor

@evils evils commented Nov 5, 2019

Built it via nix-review, kicad crashes on "open project" with

(kicad:13351): GLib-GIO-ERROR **: 05:06:23.908: No GSettings schemas are installed on the system
Trace/breakpoint trap (core dumped)

Also, you're aware pkgs/top-level/all-packages.nix calls kicad with wxGTK = wxGTK30;?

@matthuszagh
Copy link
Contributor Author

@matthuszagh matthuszagh commented Nov 5, 2019

@Evils-Devils are you referring to the (wxGTK.override { withGtk2 = false; }) part? I am aware of the wxGTK = wxGTK30; call, but if you look in its build expression it uses gtk2 unless you set that to false. And if I remember correctly the build fails otherwise.

I'm not familiar with nix-review, I'll look into it. However, this builds fine for me (i.e. nix-build -A kicad). Not sure why we would get different results.

@evils
Copy link
Contributor

@evils evils commented Nov 5, 2019

FYI, checked out your branch, ran nix-shell -I nixpkgs=. --pure -p kicad same issue
are you saying you cannot reproduce the crash on "create new project" (or "open existing project")?

Additionally, it seems to build and fail identically with wxGTK31

@matthuszagh
Copy link
Contributor Author

@matthuszagh matthuszagh commented Nov 5, 2019

Ah ok yes I am seeing that issue. Only see it when I add --pure. Thanks for bringing this to my attention. I'll look into it.

@evils
Copy link
Contributor

@evils evils commented Nov 9, 2019

FWIW, i've had a go at fixing this here.

@matthuszagh
Copy link
Contributor Author

@matthuszagh matthuszagh commented Nov 9, 2019

I'll take a look more closely when I have time tomorrow. However, does this work without the -DKICAD_SCRIPTING_WXPYTHON=ON flag? I believe that's required for Phoenix support.

@matthuszagh matthuszagh force-pushed the matthuszagh:kicad branch from 4a8acf1 to d9184ed Nov 9, 2019
@matthuszagh
Copy link
Contributor Author

@matthuszagh matthuszagh commented Nov 9, 2019

@Evils-Devils those changes look good to me. My comment above on the kicad scripting flag isn't an issue since cmake sets this automatically if phoenix and scripting are set. I've also added a dependency on the six python package which is needed in order to get python scripting to work. The new commit reflects all changes.

@ofborg ofborg bot removed the 6.topic: python label Nov 9, 2019
@evils
Copy link
Contributor

@evils evils commented Nov 10, 2019

i'm not sure it's a great idea for you to commit my changes as your own...

@matthuszagh
Copy link
Contributor Author

@matthuszagh matthuszagh commented Nov 10, 2019

@Evils-Devils, sorry about that, I haven't encountered this situation before so I'm not familiar with the normal process. What do you think is the best way to handle it? From the few previous PRs I've done here it seems like this would normally be 1 commit. I guess given our combined contributions to this package we could make it 3? My original change, your change and then my addition of the six python package. Let me know your thoughts.

@evils
Copy link
Contributor

@evils evils commented Nov 10, 2019

that sounds fine to me

This is needed for python scripting support.
@matthuszagh matthuszagh force-pushed the matthuszagh:kicad branch from d9184ed to 981564d Nov 10, 2019
@@ -103,11 +94,17 @@ in stdenv.mkDerivation rec {
done
'';

# GSETTINGS_SCHEMAS_PATH includes gtk twice, so wrapProgram with ${wxGTK.gtk} is used instead of wrapGApp
# since wrapGApp needs most of these set explicitly anyway (with dontWrapGApps = true;), lets not depend on it
preFixup = ''
buildPythonPath "$out $pythonPath"
gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")

This comment has been minimized.

@evils

evils Nov 10, 2019
Contributor

doh, this line (101) isn't used anymore, the --set should either be added to wrapProgram
or it's not needed, you found scripting to work?

This comment has been minimized.

@matthuszagh

matthuszagh Nov 10, 2019
Author Contributor

I haven't given it thorough testing, but yes it appears to work.

This comment has been minimized.

@evils

evils Nov 10, 2019
Contributor

i can't launch the python shell from pcbnew, got something working, just cleaning up the commit

This comment has been minimized.

@evils

evils Nov 10, 2019
Contributor

ok, fixed here
also had to wrap pcbnew, otherwise python doesn't work if you run it directly

This comment has been minimized.

@matthuszagh

matthuszagh Nov 14, 2019
Author Contributor

looks good to me. i've included it in the pr

@@ -23817,8 +23817,10 @@ in
fped = callPackage ../applications/science/electronics/fped { };

kicad = callPackage ../applications/science/electronics/kicad {
wxGTK = wxGTK30;
boost = boost160;
wxGTK = wxGTK30.override { withGtk2 = false; };

This comment has been minimized.

@evils

evils Nov 11, 2019
Contributor

If #73145 gets merged before this, the override part of this can be removed.

@evils evils mentioned this pull request Nov 26, 2019
18 of 26 tasks complete
@gebner gebner closed this in #74259 Jan 3, 2020
Python 2 deprecation automation moved this from WIP to Done Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.