tdnf/python
Shreenidhi Shedi a09a200162 tdnf-python: use newer apis for setting program name
Newer versions of python has deprecated Py_SetProgramName(...), and we
see this warning while building tdnf python. This patch addresses this
by using latest APIs for setting program name.

Build log snippet:
```
/root/tdnf.git/python/tdnfmodule.c:160:5: warning: ‘Py_SetProgramName’ is deprecated [-Wdeprecated-declarations]
  160 |     Py_SetProgramName(program);
      |     ^~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/Python.h:94,
                 from /root/tdnf.git/python/includes.h:11,
                 from /root/tdnf.git/python/tdnfmodule.c:9:
/usr/include/python3.11/pylifecycle.h:37:38: note: declared here
   37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
```

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2023-07-20 00:54:24 +05:30
..
tdnf tdnf python interface build tasks 2019-07-29 15:01:15 -07:00
CMakeLists.txt Added tdnf-automatic 2020-10-22 11:33:23 +05:30
README.md tdnf-python: various fixes 2021-08-02 07:30:56 +05:30
includes.h fix copyright years 2023-03-31 12:41:34 -07:00
prototypes.h Add alter commands 2019-08-02 00:08:15 +00:00
setup.py.in python: Fix linking to built libraries 2022-07-07 12:30:47 -04:00
structs.h fix copyright years 2022-02-04 18:20:19 -08:00
tdnfbase.c fix copyright years 2022-02-04 18:20:19 -08:00
tdnfbase.h tdnf python interface build tasks 2019-07-29 15:01:15 -07:00
tdnfmodule.c tdnf-python: use newer apis for setting program name 2023-07-20 00:54:24 +05:30
tdnfpycommands.c remove nAlterType arg from TDNFAlterCommand 2022-07-19 13:41:31 -07:00
tdnfpyrepodata.c fix copyright years 2023-03-31 12:41:34 -07:00
tdnfpyrepodata.h python interface: add repolist 2019-07-31 10:10:19 -07:00
utils.c Add alter commands 2019-08-02 00:08:15 +00:00

README.md

tdnf python interface

tdnf python interfaces will work for python2 and python3. details as follows.

api

repolist

returns a python list of repodata types.

parameter (optional): filter

    REPOLISTFILTER_ALL = 0
    REPOLISTFILTER_DISABLED = 2
    REPOLISTFILTER_ENABLED = 1

example:

root [ / ]# python3
Python 3.7.3 (default, Jun 20 2019, 03:44:05)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tdnf
>>> tdnf.repolist()
[{id: photon-updates, name: VMware Photon Linux 3.0(x86_64) Updates, baseurl: https://dl.bintray.com/vmware/photon_updates_3.0_x86_64, enabled: 1}, {id: photon, name: VMware Photon Linux 3.0(x86_64), baseurl: https://dl.bintray.com/vmware/photon_release_3.0_x86_64, enabled: 1}, {id: photon-extras, name: VMware Photon Extras 3.0(x86_64), baseurl: https://dl.bintray.com/vmware/photon_extras_3.0_x86_64, enabled: 1}]
>>> tdnf.repolist(filter=tdnf.REPOLISTFILTER_DISABLED)
[{id: photon-iso, name: VMWare Photon Linux ISO 3.0(x86_64), baseurl: file:///mnt/cdrom/RPMS, enabled: 0}, {id: photon-debuginfo, name: VMware Photon Linux debuginfo 3.0(x86_64), baseurl: https://dl.bintray.com/vmware/photon_debuginfo_$releasever_$basearch, enabled: 0}]

##install installs a list of packages and their depedencies. updates installed packages if there are updates available.

##parameter (required): pkgs

tdnf.install(pkgs=['curl','wget'])

##parameter (optional): quiet

tdnf.install(pkgs=['curl','wget'], quiet=True)

##parameter (optional): refresh

tdnf.install(pkgs=['curl','wget'], refresh=True)

##update updates specified packages or all packages that have updates.

##parameter (optional): pkgs

tdnf.update(pkgs=['curl','wget'])

##parameter (optional): quiet

tdnf.update(pkgs=['curl','wget'], quiet=True)

##parameter (optional): refresh

tdnf.update(pkgs=['curl','wget'], refresh=True)

##downgrade downgrades specified packages or all packages that have a downgrade path.

##parameter (optional): pkgs

tdnf.downgrade(pkgs=['curl','wget'])

##parameter (optional): quiet

tdnf.downgrade(pkgs=['curl','wget'], quiet=True)

##parameter (optional): refresh

tdnf.downgrade(pkgs=['curl','wget'], refresh=True)

##erase remove specified packages and their dependencies

##parameter (required): pkgs

tdnf.erase(pkgs=['wget'])

##parameter (optional): quiet

tdnf.erase(pkgs=['wget'], quiet=True)

##parameter (optional): refresh

tdnf.erase(pkgs=['wget'], refresh=True)

##erase synchronize installed packages to the latest available versions

##parameter (optional): quiet

tdnf.distro_sync(quiet=True)

##parameter (optional): refresh

tdnf.distro_sync(refresh=True)