systemd / pystemd

A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.
GNU Lesser General Public License v2.1
409 stars 36 forks source link

add a LIBSYSTEMD_VERSION macro for gating new functions #58

Closed kfix closed 3 years ago

kfix commented 3 years ago

This allows gating of function-symbols based on the builder's own libsystemd version.

Unfortunately cython doesn't translate both branches of the IF-ELSE from .pyx into the intermediate .c files, so if you build source zips on a host with a newer libsystemd, that version's symbols will be expected to be available for the final compile.

I guess that users needing to support older systemd installations are most likely going to be starting from a clean .git checkout and using cython, not a dist .zip, so perhaps that's not a big deal?

I didn't make a note of it in the README since we only seem to have one sd_ function that's not totally in the field yet and eventually these older versions should die off...

Fixes #26

aleivag commented 3 years ago

Hello.... thanks @kfix for looking at this, this has been a long standing issue... i'll give a detailed look on Tuesday (after MLK day), but want to make sure you know we are looking into it!

kfix commented 3 years ago

Is there some kind of stub conf file I could use with buck to simulate an internal build?

building from the pre-generated c files should be fine, the macros are "inlined" out like I mentioned. I had it default to the version of libsystemd of the precompiled but you are saying it should just default to a new one.

Perhaps I should just add a custom option flag to the build.py to allow specification of the version for people on old 16.04 systemd's like me and rip out the pkg-config auto detection stuffs.

The normal builds will just behave as they are already.

I'll need some time, is a busy few weeks for me. Thanks @aleivag

aleivag commented 3 years ago

@kfix i think i landed a change on the way we (as in fb) compile our cython files internally that would allow to land this as is... i'm re running tests... if this works, then i'll just ship you change, and update the docs in a later commit...

Thanks!

facebook-github-bot commented 3 years ago

@aleivag merged this pull request in facebookincubator/pystemd@50e61b7b8db5898d113a881abf4dea0bb80fd02a.