[arch-projects] [pyalpm] [PATCH] Rename function to match renamed name in pacman master

Morgan Adamiec morganamilo at gmail.com
Fri Jan 18 15:16:51 UTC 2019


On Fri, 18 Jan 2019 at 14:53, Eli Schwartz via arch-projects
<arch-projects at archlinux.org> wrote:
>
> alpm_sync_newversion becomes alpm_sync_get_new_version and changes
> behavior slightly. See for details:
> https://git.archlinux.org/pacman.git/commit/?id=e9d91a688d1a2ebe58e8a895853debf745a529cf
> ---
>
> DO NOT MERGE THIS until after pacman 5.2 or 6 is released.
>
> pacman does not have any good preprocessor check for this -- the only
> way to handle both methods would be to implement some sort of test in
> setup.py and create a DEFINE based on that.
>
> Posted here in order to be prepared, though I wouldn't mind having it
> exist in the pyalpm repo in a "pacman-git" branch. ;)
>
>  src/db.c     | 4 ++--
>  src/db.h     | 2 +-
>  src/pyalpm.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/db.c b/src/db.c
> index 3015d61..f6c5da4 100644
> --- a/src/db.c
> +++ b/src/db.c
> @@ -304,7 +304,7 @@ PyObject* pyalpm_find_grp_pkgs(PyObject* self, PyObject *args) {
>  }
>
>  /** Finds an available upgrade for a package in a list of databases */
> -PyObject* pyalpm_sync_newversion(PyObject *self, PyObject* args) {
> +PyObject* pyalpm_sync_get_new_version(PyObject *self, PyObject* args) {
>    PyObject *pkg;
>    PyObject *dbs;
>    alpm_list_t *db_list;
> @@ -320,7 +320,7 @@ PyObject* pyalpm_sync_newversion(PyObject *self, PyObject* args) {
>    {
>      alpm_pkg_t *rawpkg = pmpkg_from_pyalpm_pkg(pkg);
>      if (rawpkg) {
> -      result = alpm_sync_newversion(rawpkg, db_list);
> +      result = alpm_sync_get_new_version(rawpkg, db_list);
>      }
>      alpm_list_free(db_list);
>    }
> diff --git a/src/db.h b/src/db.h
> index 4ed02e6..be35b78 100644
> --- a/src/db.h
> +++ b/src/db.h
> @@ -29,6 +29,6 @@ PyObject *pyalpm_db_from_pmdb(void* data);
>  int pylist_db_to_alpmlist(PyObject *list, alpm_list_t **result);
>
>  PyObject* pyalpm_find_grp_pkgs(PyObject* self, PyObject* args);
> -PyObject* pyalpm_sync_newversion(PyObject *self, PyObject* args);
> +PyObject* pyalpm_sync_get_new_version(PyObject *self, PyObject* args);
>
>  #endif
> diff --git a/src/pyalpm.c b/src/pyalpm.c
> index 56c9639..7391191 100644
> --- a/src/pyalpm.c
> +++ b/src/pyalpm.c
> @@ -87,7 +87,7 @@ static PyMethodDef methods[] = {
>      "args: a list of packages, a dependency string\n"
>      "returns: a Package object or None" },
>
> -  {"sync_newversion", pyalpm_sync_newversion, METH_VARARGS,
> +  {"sync_newversion", pyalpm_sync_get_new_version, METH_VARARGS,
>      "finds an available upgrade for a package in a list of databases\n"
>      "args: a package, a list of databases\n"
>      "returns: an upgrade candidate or None" },
> --
> 2.20.1

The function name changed to highlight a breaking change in behaviour.
Would it therefore make sense to also rename the function on the python side?


More information about the arch-projects mailing list