a09a200162
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> |
||
---|---|---|
.. | ||
tdnf | ||
CMakeLists.txt | ||
README.md | ||
includes.h | ||
prototypes.h | ||
setup.py.in | ||
structs.h | ||
tdnfbase.c | ||
tdnfbase.h | ||
tdnfmodule.c | ||
tdnfpycommands.c | ||
tdnfpyrepodata.c | ||
tdnfpyrepodata.h | ||
utils.c |
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)