Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. 4abe3c7796da4c96ccb24d3c31f849cfa86e4e79 Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/c63584817f594e40e02bb31452906ab676456a36..4abe3c7796da4c96ccb24d3c31f849cfa86e4e79 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. c63584817f594e40e02bb31452906ab676456a36 Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/75f8d5dbeef1f95e9a069092945fbc4c6fc01a0f..c63584817f594e40e02bb31452906ab676456a36 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. 75f8d5dbeef1f95e9a069092945fbc4c6fc01a0f Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/b6d604758b295ef8cb6b8c18c44f1d4bd7be1654..75f8d5dbeef1f95e9a069092945fbc4c6fc01a0f ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. 702e756046855d51541c0cf59541cd0a02120e3e Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/ab8a88455919c191ab85bf5a4a3ab8261679185b..702e756046855d51541c0cf59541cd0a02120e3e ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
So we can't declutter and eliminate the duplication. IMHO it makes no sense to make the cluttered enums into python enums because they are a bit faster, so the dev can decide what he needs more, convenience to debug or performance and can switch between them by using the appropriate ctors if needed. That's why I haven't converted the APIs implemented in python and returning the ints belonging to the enums. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-669029978___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
Um, what? We can't de-clutter what's there because it would break every single python-rpm user. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-669014570___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
1 Is there any reason to define the enums in C code instead of Python? 2 Should I move them into a python file and replace by pythonic enums then, breaking the compatibility in order to declutter the namespace? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-669007632___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
Eh, there's no swig involved, this is all hand-written C. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-668996401___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
1. What clutters the namespace is the enums values generated by swig, because they are not really python enums and they are not namespaced. IDK if we can just break compatibility and get rid of them. The proposed solution is to setup swig to place them into a separate module (is it possible?), and then import that module and convert it, and not explicitly expose it. 2. in some places, where we don't directly interface the cext, we can, by just wrapping the returned values into the enum ctor -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-668671569___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@pmatilai requested changes on this pull request. NAK for cluttering the already cluttered rpm namespace with 100+ effective duplicate symbols under slightly different name, that will only confuse the living daylights of anybody trying to actually use this stuff instead of being helpful. If we can reasonably turn the actual RPMFOO* symbols into actual Python enums, that'd be fine. If we could actually return those from the places where we return bitfields from the API (lots of them), that'd be awesome. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#pullrequestreview-460718659___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@pmatilai commented on this pull request. > @@ -0,0 +1,74 @@ +from __future__ import absolute_import + +from . import _rpm + +__all__ = [] + +_enumClass = None +_flagEnumClass = None +try: + from enum import IntEnum as _enumClass +except ImportError: + try: + from enum import Enum as _enumClass + except ImportError: We don't support Python 2 at all, you can drop all this compat foobar. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#pullrequestreview-460715498___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. ab8a88455919c191ab85bf5a4a3ab8261679185b Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/ce5514692e86b1f556e96494882189405f8a5581..ab8a88455919c191ab85bf5a4a3ab8261679185b ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
Looks like the new Python file was not added to `EXTRA_DIST = rpm/__init__.py rpm/transaction.py` in `python/Makefile.am` and though failing the CI. The "Modification of dictionary returned by locals()" warning can be avoided by just using globals() which always returns the module name space. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-661750550___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
This pull request **introduces 1 alert** when merging ce5514692e86b1f556e96494882189405f8a5581 into 16d9074e1a3020f8844ed4a213fb92e844d8f9ad - [view on LGTM.com](https://lgtm.com/projects/g/rpm-software-management/rpm/rev/pr-c82bc2501b0f2dd9d33aa330ec1e1449275633a3) **new alerts:** * 1 for Modification of dictionary returned by locals\(\) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-656793037___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
@KOLANICH pushed 1 commit. ce5514692e86b1f556e96494882189405f8a5581 Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309/files/41310c6ffda99386b1e7f8354ebb542ffc310317..ce5514692e86b1f556e96494882189405f8a5581 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
This pull request **introduces 1 alert** when merging 41310c6ffda99386b1e7f8354ebb542ffc310317 into ae163b56468e5e83cbba192dab02ebdb9cf3df5d - [view on LGTM.com](https://lgtm.com/projects/g/rpm-software-management/rpm/rev/pr-ada2169273c889f9f6fe1cafe2bcc19672203382) **new alerts:** * 1 for Modification of dictionary returned by locals\(\) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309#issuecomment-656681753___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)
Can usually be available using CamelCased prefix, class members have the prefix stripped. ```python import rpm print(rpm.RPMBuild.CHECK | rpm.RPMBuild.CLEAN) # RPMBuild.CLEAN|CHECK: 24 print(rpm.RPMBuild(24)) # RPMBuild.CLEAN|CHECK: 24 ``` You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1309 -- Commit Summary -- * Improved python support: enums are now enums with all additional goodies. Can usually be available using CamelCased prefix, class members have the prefix stripped. -- File Changes -- M python/rpm/__init__.py (2) A python/rpm/rpmEnum.py (77) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/1309.patch https://github.com/rpm-software-management/rpm/pull/1309.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/1309 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint