-
Notifications
You must be signed in to change notification settings - Fork 27
Add requirements.txt and fix PySNMP dependency versioning #48
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
Add requirements.txt and fix PySNMP dependency versioning #48
Conversation
PySNMP 4.x is now thoroughly obsolete. It cannot be used *at all* with Python 3.12, which removed from the standard library the `asyncore` module on which it depended. Additionally, pysnmp 6.2 [removed the "oneliner" interface](https://github.com/lextudio/pysnmp/compare/v6.1.4..v6.2) which this script currently [uses](https://github.com/CauldronDevelopmentLLC/oh-brother/blob/078f8baa8eabbe719ad75574a7b846478d1d07b4/oh-brother.py#L17). Therefore, in order to continue using this script: - with Python 3.12: PySNMP >= 6 and < 6.2 is required - with older Python 3.x: PySNMP >= 4 and < 6.2 is required
|
Another way to deal with this and make things work with recent 6.2+ versions of pysnmp is to bring in |
It appears that If I'm mistaken, can you show exactly how you're installing and using |
|
Sure, so this on nixos (but works anywhere nix does) with the following: {
lib,
fetchFromGitHub,
python3Packages,
}:
let
pypkgs = python3Packages;
in
pypkgs.buildPythonApplication rec {
pname = "oh-brother";
version = "0-unstable-2025-06-01";
pyproject = false;
src = fetchFromGitHub {
owner = "CauldronDevelopmentLLC";
repo = "oh-brother";
rev = "d7cd5b06beb12e60d178791d84fa0512861a2694";
hash = "sha256-nD7OO6yrjTFpIdzm/cQHctRk/IKZbyDAkrfnzY1VIVw=";
};
postPatch = ''
sed -i '16i import importlib.util' oh-brother.py
sed -i '17i import importlib.machinery' oh-brother.py
'';
dependencies = with pypkgs; [
pyasyncore
pysnmplib # *MUST* come before pysnmp as it shares the pysnmp python namespace
# https://github.com/CauldronDevelopmentLLC/oh-brother/blob/d7cd5b06beb12e60d178791d84fa0512861a2694/requirements.txt
pysnmp
pysnmp-pyasn1
];
installPhase = ''
runHook preInstall
install -Dm555 oh-brother.py $out/bin/${meta.mainProgram}
install -Dm444 -t $out/share/doc/${pname} *.md
runHook postInstall
'';
# no tests
doCheck = true;
meta = with lib; {
description = "Update Brother Printer Firmware";
license = licenses.gpl2Only;
mainProgram = "oh-brother";
};
}And here are the full closure details which shows all the versions: Details/nix/store/1jj2lq1kzys105rqq5n1a2r4v59arz43-mailcap-2.1.54 /nix/store/6hqzbvz50bm87hcj4qfn51gh7arxj8a6-gcc-14.2.1.20250322-libgcc /nix/store/yypqcvqhnv8y4zpicgxdigp3giq81gzb-libunistring-1.3 /nix/store/6nkqdqzpa75514lhglgnjs5k4dklw4sb-libidn2-2.3.8 /nix/store/za53jjhjl1xajv3y1zpjvr9mh4w0c1ay-xgcc-14.2.1.20250322-libgcc /nix/store/cg9s562sa33k78m63njfn1rw47dp9z0i-glibc-2.40-66 /nix/store/7c0v0kbrrdc2cqgisi78jdqxn73n3401-gcc-14.2.1.20250322-lib /nix/store/8pviily4fgsl02ijm65binz236717wfs-openssl-3.4.1 /nix/store/90c412b9wqhfny300rg5s2gpsbrqb31q-libffi-3.4.8 /nix/store/vfmnmqsnfiiqmphy7ffh2zqynsxfck1q-ncurses-6.5 /nix/store/971mpk4nqhqcxggx0yi60w9y1ya570bj-readline-8.2p13 /nix/store/j0bzxly2rvcym1zkhn393adiqcwn8np6-expat-2.7.1 /nix/store/pa60s415p92gnhv5ffz1bmfgzzfvhvd8-xz-5.8.1 /nix/store/qizipyz9y17nr4w4gmxvwd3x4k0bp2rh-libxcrypt-4.4.38 /nix/store/qkzkz12l4q06lzbji0ifgynzrd44bpjs-gdbm-1.25-lib /nix/store/qyihkwbhd70ynz380whj3bsxk1d2lyc4-tzdata-2025b /nix/store/srby6wmvg7dp454pwb6qvaxdiri38sc1-zlib-1.3.1 /nix/store/yfjzkkkyxcalyj7l1n4d4y6s81i65hmy-sqlite-3.48.0 /nix/store/r03ly1w54924k8fag1dhjl3yrllj6czd-util-linux-minimal-2.41-lib /nix/store/wyf93cvh25b2xg82mkjcpmwgcspk0ggr-mpdecimal-4.0.0 /nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37 /nix/store/zrnqzhcvlpiycqbswl0w172y4bpn0lb4-bzip2-1.0.8 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10 /nix/store/azbbrwb8glahagaqqsaa4akv20903lm3-python3.12-charset-normalizer-3.4.1 /nix/store/lf8ilk72n59c1yg7zbwvqd5mimlqzpqk-python3.12-urllib3-2.3.0 /nix/store/n0v27hx3n5sc51z833jbmkgi4sm086qg-python3.12-idna-3.10 /nix/store/6fv8ayzjvgyl3rdhxp924zdhwvhz2iq6-nss-cacert-3.111 /nix/store/y85rrr4sx62x27fka04sncbbd7g8g59j-python3.12-certifi-2025.01.31 /nix/store/0lln9m37mw7cjdf02krfpiwd4clwdlwl-python3.12-requests-2.32.3 /nix/store/kyxcsmk6m1j5czlsyq038xpnpfa55j6r-python3.12-pycryptodomex-3.21.0 /nix/store/zrqxiwpi62smy5pvdpl4w5kax50gc3ii-python3.12-ply-3.11 /nix/store/w148pnnhbif3maplqx34izwdr8w255f1-python3.12-pysnmp-pysmi-1.1.12 /nix/store/wk9pdhgxvyn2xp110qnqz03vvch07n1i-python3.12-pysnmp-pyasn1-1.1.3 /nix/store/0rs75zbmrkh8mhlfhwpj4i3l72v7g9ry-python3.12-pysnmplib-5.0.24 /nix/store/2w6vn2qlffkc386lfkb2324kk4vvw53f-python3.12-pyasyncore-1.0.4 /nix/store/8rgbflgzd942wdq9p2iijzy0g32dazhb-python3.12-pyasn1-0.6.1 /nix/store/x7nyn4jv80amafdya2xgm1a07m0hinap-python3.12-markupsafe-3.0.2 /nix/store/kn0svpfjpbx8zl1rp0f0rzh2ray0c2xs-python3.12-jinja2-3.1.6 /nix/store/mhscxvpf98amzkih54jyhqpw7xx6i5lc-python3.12-pycparser-2.22 /nix/store/w56z2iwqp4c3k0bx1rnh2kkmh8jysk48-python3.12-cffi-1.17.1 /nix/store/vg7494b4p4if8a126w3ickkphc559idb-python3.12-cryptography-44.0.2 /nix/store/qs0p3bnryd8z7ipmq271lqg49w79g36l-python3.12-pysnmpcrypto-0.1.0 /nix/store/sqzwcwn5gfs7kh5z2ljx4l30z1ikw7iw-python3.12-pysmi-1.5.9 /nix/store/qfjjlmhmqfd0dawpgm8lx3na0w9mx8ff-python3.12-pysnmp-7.1.16 /nix/store/k5592hf58ljd6935361d325yfs86lkhs-oh-brother-0-unstable-2025-06-01 |
Ahhh. You've got |
Use pysnmplib and pyasyncore, patch usage of `imp` by using `importlib`. Refer to upstream discussion here: CauldronDevelopmentLLC/oh-brother#48 (comment)
PySNMP 4.x is now thoroughly obsolete. It cannot be used at all with Python 3.12, which removed from the standard library the
asyncoremodule on which it depended.Additionally, pysnmp 6.2 removed the "oneliner" interface which this script currently uses.
Therefore, in order to continue using this script: