Post Ac8WSWUYbTptyTPC08 by decathorpe@mastodon.social
 (DIR) More posts by decathorpe@mastodon.social
 (DIR) Post #Ac8WSTwS5JMo47QvZ2 by hroncok@floss.social
       2023-11-23T22:35:16Z
       
       0 likes, 0 repeats
       
       When writing command line tools in Python, always assume people will need to use them from their own Python scripts. Don't force them call subprocess or use complex APIs. Please, provide a high-level CLI-like Python function and create the CLI by wrapping that in argparse/click/etc.I wish I could just call fedpkg.build(), spectool.get("foo.spec"), or dnf.repoquery(whatrequires="bar", repo="rawhide") instead of copy-pasting boring wrappers from script to stript.
       
 (DIR) Post #Ac8WSUgtIeVuO9A0wq by decathorpe@mastodon.social
       2023-11-24T11:26:55Z
       
       0 likes, 0 repeats
       
       @hroncok as for spectool - I can probably make this happen ;)
       
 (DIR) Post #Ac8WSVYm4JcD5GN2w4 by hroncok@floss.social
       2023-11-24T11:36:07Z
       
       0 likes, 0 repeats
       
       @decathorpe I can make it happen as well, but it's a single-file script installed in /usr/bin so it requires changes to how the thing is installed on disk.
       
 (DIR) Post #Ac8WSWUYbTptyTPC08 by decathorpe@mastodon.social
       2023-11-24T14:52:48Z
       
       0 likes, 0 repeats
       
       @hroncok alternatively - the code in spectool is really really gnarly because I wrote it to be 1:1 CLI-compatible with the old Perl implementation ... rewriting it in a better way is on my to-do list, and offering a Python API in addition to the CLI (no longer 1:1 compatible with the old Perl CLI) would be a nice addon :)
       
 (DIR) Post #Ac8WSXJFZ0NyVh7g12 by mirek@rodina-sucha.cz
       2023-11-24T16:03:55Z
       
       0 likes, 0 repeats
       
       @decathorpe @hroncok If you are gonna refactor spectool I want to point you to https://github.com/packit/specfile getting sources and patches is trivial with this library https://github.com/packit/specfile#sources-and-patches
       
 (DIR) Post #Ac8bF3WhU6b096o0Js by decathorpe@mastodon.social
       2023-11-24T16:57:34Z
       
       0 likes, 0 repeats
       
       @mirek @hroncok Parsing is zero problem - we use rpm itself for that. Also - is specfile in RHEL? I can't add any dependencies that are not in RHEL, since rpmdevtools is used there as well.Unless the new tool will be a non-replacement replacement and will be distributed separately from rpmdevtools, then that would be fine. But still, spectool does no spec parsing, so using specfile for that is kind of redundant with using the librpm Python bindings.