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

scons: Switch to Python 3 #75877

Merged
merged 3 commits into from Mar 27, 2020
Merged

scons: Switch to Python 3 #75877

merged 3 commits into from Mar 27, 2020

Conversation

primeos
Copy link
Member

@primeos primeos commented Dec 18, 2019

This should be merged after #75875 and many build failures have to be resolved first.

Build logs

Results from nix-review: Gist (incomplete).

Old logs:

Current status

Done (:heavy_check_mark:):

WIP (:hourglass_flowing_sand:):

  • gringo: @hakuch (no longer required for opam -> probably safe to mark it as broken and remove it if no-one want's to maintain it)
  • nsis: @pedropombeiro (nsis: 3.04 -> 3.05 #79083, version 3.05 should support Python 3 but additional changes are required (debug))

Unresolved (:negative_squared_cross_mark:):

  • btanks: @viric (no meta.maintainers)
  • globulation2 (glob2): @7c6f434c
  • gpsd: @bjornfor @rasendubi
  • jackmix: @kampfschlaefer
  • lprof: @marcweber
  • mongodb: @bluescreen303 @offlinehacker @cstrahan
  • rhvoice: @berce
  • serf: @orivej @7c6f434c
  • swift-im: @orivej
  • tdm: @cizra
  • vdrift: @viric
  • xboxdrv: @fuuzetsu (no meta)
  • ffado: @cillianderoiste (AttributeError: module 'posixpath' has no attribute 'walk')
  • toluapp: @vrthra (AttributeError: '_io.TextIOWrapper' object has no attribute 'xreadlines')

Marked as broken:

  • mesos: @cstrahan @offlinehacker
  • pingus: @7c6f434c
  • swiften: @twey

Unrelated:

  • mixxx
  • descent12

Proposed resolution

CC the maintainers of all packages that fail due to Python 3.x and ask them if they could have a look. I.e.:

  • Check if a new version is available that supports Python 3
  • Check if an upstream PR/issue already exits
    • If there is a stale PR/issue it would probably make sense to add a comment
  • Optional: Check if a trivial patch can be written to support Python 3
  • Open an upstream issue (https://pythonclock.org/)

TODO: If it's not possible to support Python 3 the packages should override scons to use Python 2.7.

Things done
  • 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

@leahneukirchen
Copy link
Contributor

Not sure why I was pinged here?

@primeos
Copy link
Member Author

primeos commented Dec 18, 2019

@leahneukirchen Oh, sorry, I probably added you on accident due to the GH auto-completion without noticing it... :o (IMO that feature can be quite a bit annoying as the suggestions only disappear via escape or de-focusing)
(Note: I've edited the description and removed that part.)

@jonringer
Copy link
Contributor

the other PR got merged, do you mind rebasing?

@primeos
Copy link
Member Author

primeos commented Dec 21, 2019

@jonringer did a rebase but unfortunately this is far from being ready to merge anyway :o

@FRidh @jonringer: What do you think of my proposal to resolve this? Currently the switch to Python 3 causes ~22 builds to fail (there could be more failures in transient dependencies later). IMO it would be best to notify the maintainers of these packages as they're the most familiar with it (e.g. also with testing if it still works correctly with Python 3 at runtime). Do you have any suggestions, changes, etc. regarding this proposal (before I ping the maintainers)?

@jonringer
Copy link
Contributor

I'll have to look more into this later, will be pretty busy the next week

@jtojnar jtojnar mentioned this pull request Dec 25, 2019
17 tasks
@FRidh
Copy link
Member

FRidh commented Dec 29, 2019

@primeos I think that's a good approach. Otherwise, maybe adding a Python2 version of scons as well. E.g. in its passthru so it won't show up in the top-level package set.

@primeos
Copy link
Member Author

primeos commented Jan 27, 2020

Dear maintainers,
you're cc'd in this issue because at least one of the packages you maintain (s.
list below) will fail to build after switching SCons to Python 3.

If you're still actively using/maintaining your package it would be nice if you
could try to make the build work e.g. by following these steps:

  • Check if a new version is available that supports Python 3
  • Check if an upstream patch/PR/issue already exits
    • If there is a stale PR/issue it would most likely make sense to add a
      comment (triage)
  • Optional: Check if a trivial patch can be written to support Python 3 (e.g. if
    it only fails due to a few "print" statements)
  • Open an upstream issue (https://pythonclock.org/)
  • Report the results back to this PR
    • Feel free to reply very briefly, but a link to the PR/commit would be nice
    • If e.g. the new version / patch doesn't work with Python 2 anymore you can
      either provide a link to the commit and I'll cherry-pick it into this PR or
      we can already merge a version of SCons that uses Python 3 into Nixpks.

Please also reply here if you're not maintaining your package anymore or if
there isn't an easy solution to make it work with Python 3.

Thanks in advance ❤️ :)

List of packages that don't build with Python 3

Link to the build log

@jtojnar
Copy link
Contributor

jtojnar commented Jan 28, 2020

MyPaint 2 is scheduled to release soon #54677

@pedropombeiro
Copy link
Contributor

nsis seems to still be using Python 2: https://github.com/kichik/nsis/blob/master/INSTALL#L8

If this is a blocker, I suggest removing the NSIS expression from all-packages.

@primeos
Copy link
Member Author

primeos commented Jan 29, 2020

@pedropombeiro I've had a look and it seems like a patch already exists: kichik/nsis@9ee3275

By looking at the dates this patch should already be in version 3.05: https://sourceforge.net/projects/nsis/files/NSIS%203/

Could you try updating to version 3.05?

@scubed2 scubed2 mentioned this pull request Jan 31, 2020
10 tasks
@scubed2
Copy link
Contributor

scubed2 commented Jan 31, 2020

Sent #78943 for fceux.

@pedropombeiro
Copy link
Contributor

Could you try updating to version 3.05?

That's what I tried with but I got some weird error.

@hakuch
Copy link
Contributor

hakuch commented Feb 1, 2020

Hello, and thank you for the clear message and instructions. I'm no longer actively maintaining the gringo package: as of version 2, opam no longer requires an external solver and so the dependency on gringo is not necessary.

@primeos
Copy link
Member Author

primeos commented Feb 1, 2020

@pedropombeiro what does "weird error" mean? It didn't build or there where errors at run-time? And what would you recommend to do regarding this PR? (fix the build, mark it as broken, use Python 2 for now, etc.)

@hakuch ok, thanks for the information :)

I'll collect all information in the PR description (current status). Thanks @everyone for the updates.

@pedropombeiro
Copy link
Contributor

pedropombeiro commented Feb 2, 2020

@primeos I've fixed this permissions error:

Checking for C library z... (cached) yes
Checking for C++ library cppunit... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [/nix/store/lkcib3zdqd1q4n250ny5wl4vpz5z4zl1-nsis-3.05/share/nsis/Stubs/uninst] /nix/store/lkcib3zdqd1q4n250ny5wl4vpz5z4zl1-nsis-3.05/share/nsis/Stubs/uninst: Permission denied
scons: building terminated because of errors.
builder for '/nix/store/563ygbxywfmh3yxpssd2bl2dmzbrk9mp-nsis-3.05.drv' failed with exit code 2
error: build of '/nix/store/563ygbxywfmh3yxpssd2bl2dmzbrk9mp-nsis-3.05.drv' failed
nix-build default.nix -A nsis  21.48s user 2.16s system 99% cpu 23.652 total

I've created a PR to upgrade to 3.05 and it works in master, however on your branch SCons is now complaining that it doesn't know the install-compiler even though that's still part of the documentation:

Checking for C++ library cppunit... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
scons: *** Do not know how to make File target `install-compiler' (/build/nsis-3.05-src/install-compiler).  Stop.
scons: building terminated because of errors.

I'd say we either use Python 2 for this package for now or mark it as broken.

@symphorien
Copy link
Member

A commit to fix bombono: 431094f

@jonringer
Copy link
Contributor

diff LGTM, let me know when you feel comfortable enough for me to test

@ofborg ofborg bot requested a review from symphorien February 2, 2020 17:55
primeos and others added 3 commits March 27, 2020 15:20
Reasons:

Python 2.7 will EOL very soon [0]:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 won't be maintained after
that date. A future version of pip will drop support for Python 2.7.
More details about Python 2 support in pip, can be found at
https://pip.pypa.io/en/latest/development/release-process/#python-2-support

SCons 4.0.0 will drop Python 2.7 Support [1]:
https://raw.githubusercontent.com/SConsProject/scons/rel_3.1.2/src/CHANGES.txt

[0]: From the SCons build output previous to this commit (i.e. with Python 2.7).
[1]: https://raw.githubusercontent.com/SConsProject/scons/rel_3.1.2/src/CHANGES.txt
Not all packages build with Python 3, see NixOS#75877. The goal is to get rid
of Python 2 but this approach ensures a smoother transition.
@primeos
Copy link
Member Author

primeos commented Mar 27, 2020

Unfortunately this didn't work as well as I hoped.

My new approach is to switch SCons to Python 3 but continue to build all failing packages with Python 2 for now. Then we can use subsequent PRs to either mark deprecated/unmaintained packages as broken or fix the build with Python 3 if the package is still relevant.

I used the suggestion of @FRidh:

Otherwise, maybe adding a Python2 version of scons as well. E.g. in its passthru so it won't show up in the top-level package set.

Though my implementation is a bit hacky :o

@jonringer @FRidh: Is the current approach still ok? If so I could run nixpkgs-review again to verify this doesn't cause any additional build regressions and run a few manual tests and then it should basically be ready to be merged.

@jonringer if your testing offer still stands that'd be welcome :)

@primeos primeos marked this pull request as ready for review March 27, 2020 14:35
@jonringer
Copy link
Contributor

I don't have enough context to know what ramifications moving to python3 will do. However, I think it's a good idea to move away from python2 anyway.

@jonringer
Copy link
Contributor

I don't have enough context to know what ramifications moving to python3 will do. However, I think it's a good idea to move away from python2 anyway.

I'm okay with this

@jonringer jonringer merged commit 0950324 into NixOS:staging Mar 27, 2020
Python 2 deprecation automation moved this from WIP to Done Mar 27, 2020
primeos added a commit that referenced this pull request Mar 29, 2020
Those packages are broken for >4 months, which is why it seems best to
mark them as broken for now. I noticed these while testing #75877.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

9 participants