-
Notifications
You must be signed in to change notification settings - Fork 259
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
Use GioUnix for GNOME 46 #1782
Use GioUnix for GNOME 46 #1782
Conversation
I suspect our CI image needs to be updated to include the Test log file
|
Hmmm. Unfortunately, even in Fedora 39, GioUnix isn't available. ( |
Hm! Shows what I know, the fedora/fedora repo on quay.io even has So in theory we could switch to using a Fedora 40 beta image (which includes GNOME 46) for the CI. |
Ah right, I forgot about this. It's purely a namespace change in terms of API, so if necessary I think polyfill/alias can be used. // Adapter for compatibility with pre-GLib-2.80
let GioUnix;
if (imports.gi.versions.GioUnix === '2.0') {
GioUnix = imports.gi.GioUnix;
} else {
GioUnix = {
InputStream: Gio.UnixInputStream,
};
} |
@andyholmes That should work, plus It's weird, though, that running under the new CI image didn't fix this — I even see in the Meson logs that it's GLib 2.80, so that should have Maybe I'll pull the new CI image locally and take a look. |
Yeah, my local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I'm glad I did that, because I discovered that the image is missing dbus-devel
, oddly enough — guess it's not pulled in as a dependency anymore. So I'll have to fix the Dockerfile over there.
But the extension is broken, specifically, because of this boneheaded code.
Un-marking this as WIP because it could be merged now, though for the record I am planning on updating the But if anyone's getting impatient and doesn't feel like waiting for that change, this is now mergeable as-is, since the CI image is updated to GNOME 46 and builds are once again in the green. |
Either way is fine, it's not critical either way. Merge when ready :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I didn't have time to test locally and didn't quite follow the logic of the hesitation discussion but let's get this in before the release if there's no pressing reason not to.
Ooh, actually, I don't see how this would work:
My code is setting Would a try/catch be a safer approach? Testing in the let GioUnix;
try {
GioUnix = imports.gi.GioUnix;
} catch (e) {
GioUnix = {
InputStream: Gio.UnixInputStream,
OutputStream: Gio.UnixOutputStream,
};
} |
Actually, it might be good to have @retrixe weigh in here, since a polyfill/alias might need another approach for ESModules. |
Hmm, actually for old-school imports I bet this would work: let GioUnix = null;
try {
GioUnix = imports.gi.GioUnix;
} catch {
GioUnix = imports.gi.Gio;
} The versioning probably isn't necessary; I think it's questionable whether there will ever be a another major revision of the GLib/GObject/Gio and there certainly isn't now. |
Alas, nope. The member names are |
Ah, disappointing :( |
For ESM, we would need to use dynamic imports with top level await in a try/catch For specifying the version, we could either specify the version every time we import it, or use dynamic import in try/catch where we currently set the version |
Don't ask me how I copy-pasted a block of code to three files, yet managed to leave out a space in only one of them. |
That part I certainly agree with. (Doubly so for GJS, where versions are forced to 2.0 for things like GLib and Gio "since we depend on them internally".) I'd been given the impression that setting explicit versions kept the import code from doing lots of extra work to figure out the available versions and picking which one to load. But now that I'm reading the code, I'm questioning that. Seems like it does lots of work regardless, calling |
This looks good to merge from my side, whenever you're ready. I'd suggest we merge this before #1683, so there's a commit to branch/release off of if necessary. |
Sorry, was asleep at the wheel. Trigger pulled. |
Seems
Gio
has been fragmented, its platform-specific classes are now part of a separateGioUnix
library.Fixes #1781