77 lines
2.5 KiB
Diff
77 lines
2.5 KiB
Diff
From f054f908e13e1d2c84e8d1b6443629e20500c2c4 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Rohel <jrohel@redhat.com>
|
|
Date: Thu, 2 May 2019 14:43:22 +0200
|
|
Subject: [PATCH] hawkey.Repo: add deprecation message
|
|
|
|
---
|
|
python/hawkey/__init__.py | 11 ++++++++++-
|
|
python/hawkey/repo-py.cpp | 5 ++---
|
|
python/hawkey/repo-py.hpp | 2 --
|
|
3 files changed, 12 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/python/hawkey/__init__.py b/python/hawkey/__init__.py
|
|
index f5f0816..597fbbb 100644
|
|
--- a/python/hawkey/__init__.py
|
|
+++ b/python/hawkey/__init__.py
|
|
@@ -131,7 +131,6 @@ REFERENCE_VENDOR = _hawkey.REFERENCE_VENDOR
|
|
|
|
Package = _hawkey.Package
|
|
Reldep = _hawkey.Reldep
|
|
-Repo = _hawkey.Repo
|
|
Sack = _hawkey.Sack
|
|
|
|
Exception = _hawkey.Exception
|
|
@@ -334,3 +333,13 @@ class Subject(_hawkey.Subject):
|
|
def _list_or_query_to_selector(sack, list_or_query):
|
|
sltr = Selector(sack)
|
|
return sltr.set(pkg=list_or_query)
|
|
+
|
|
+
|
|
+class Repo(_hawkey.Repo):
|
|
+
|
|
+ def __init__(self, name):
|
|
+ warnings.simplefilter('always', DeprecationWarning)
|
|
+ msg = "The class hawkey.Repo is deprecated. " \
|
|
+ "Please use dnf.repo.Repo instead. The class will be removed on 2019-12-31."
|
|
+ warnings.warn(msg, DeprecationWarning)
|
|
+ super(Repo, self).__init__(name)
|
|
diff --git a/python/hawkey/repo-py.cpp b/python/hawkey/repo-py.cpp
|
|
index eff32be..4e4c045 100644
|
|
--- a/python/hawkey/repo-py.cpp
|
|
+++ b/python/hawkey/repo-py.cpp
|
|
@@ -42,8 +42,7 @@ typedef struct {
|
|
|
|
HyRepo repoFromPyObject(PyObject *o)
|
|
{
|
|
- if (!repoObject_Check(o)) {
|
|
- //PyErr_SetString(PyExc_TypeError, "Expected a Repo object.");
|
|
+ if (!PyObject_TypeCheck(o, &repo_Type)) {
|
|
return NULL;
|
|
}
|
|
return ((_RepoObject *)o)->repo;
|
|
@@ -189,7 +188,7 @@ PyTypeObject repo_Type = {
|
|
0, /*tp_getattro*/
|
|
0, /*tp_setattro*/
|
|
0, /*tp_as_buffer*/
|
|
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
|
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
|
"Repo object", /* tp_doc */
|
|
0, /* tp_traverse */
|
|
0, /* tp_clear */
|
|
diff --git a/python/hawkey/repo-py.hpp b/python/hawkey/repo-py.hpp
|
|
index cb3f014..f7a449a 100644
|
|
--- a/python/hawkey/repo-py.hpp
|
|
+++ b/python/hawkey/repo-py.hpp
|
|
@@ -25,8 +25,6 @@
|
|
|
|
extern PyTypeObject repo_Type;
|
|
|
|
-#define repoObject_Check(v) ((v)->ob_type == &repo_Type)
|
|
-
|
|
HyRepo repoFromPyObject(PyObject *o);
|
|
PyObject *repoToPyObject(HyRepo repo);
|
|
|
|
--
|
|
libgit2 0.27.7
|
|
|