summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-05-18 18:04:11 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-09 12:26:41 +0300
commitf45567c2da6abb4562d42907bf9f614174baa3ff (patch)
tree5f444815ae1ed47cfa614596c716a9baccfe3a68
parent987bd509c0686535e6fd80e813b22746e53abfa8 (diff)
downloadlibrpm-tizen-f45567c2da6abb4562d42907bf9f614174baa3ff.tar.gz
librpm-tizen-f45567c2da6abb4562d42907bf9f614174baa3ff.tar.bz2
librpm-tizen-f45567c2da6abb4562d42907bf9f614174baa3ff.zip
Make python module name configurable
-rw-r--r--configure.ac8
-rw-r--r--python/Makefile.am6
-rw-r--r--python/header-py.c6
-rw-r--r--python/rpm/__init__.py.in10
-rw-r--r--python/rpm/transaction.py.in4
-rw-r--r--python/rpmds-py.c2
-rw-r--r--python/rpmfd-py.c2
-rw-r--r--python/rpmfi-py.c2
-rw-r--r--python/rpmii-py.c2
-rw-r--r--python/rpmkeyring-py.c4
-rw-r--r--python/rpmmi-py.c2
-rw-r--r--python/rpmps-py.c2
-rw-r--r--python/rpmsystem-py.h2
-rw-r--r--python/rpmtd-py.c4
-rw-r--r--python/rpmte-py.c4
-rw-r--r--python/rpmts-py.c4
-rw-r--r--python/setup.py.in8
-rw-r--r--python/spec-py.c8
18 files changed, 46 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac
index 644683adc..536a115c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -896,6 +896,14 @@ AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
+AC_ARG_VAR([PYTHON_MODULENAME], [Name of the rpm python module. Defaults to 'rpm'])
+if test X"$PYTHON_MODULENAME" = X ; then
+ PYTHON_MODULENAME="$PACKAGE"
+fi
+AC_DEFINE_UNQUOTED(PYTHON_MODULENAME, ["$PYTHON_MODULENAME"],[python module name])
+AC_SUBST(PYTHON_MODULENAME)
+
+
AC_PATH_PROG(AUTOM4TE,autom4te,:)
AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
diff --git a/python/Makefile.am b/python/Makefile.am
index fff51ae04..914bf3dca 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -5,9 +5,11 @@ EXTRA_DIST = rpm/__init__.py rpm/transaction.py
AM_CPPFLAGS = -I$(top_builddir)/include/
AM_CPPFLAGS += -I$(top_srcdir)/python
AM_CPPFLAGS += -I@WITH_PYTHON_INCLUDE@
+AM_CPPFLAGS += -I$(top_srcdir)
-pkgpyexec_LTLIBRARIES = _rpmmodule.la _rpmbmodule.la _rpmsmodule.la
-pkgpyexec_DATA = rpm/__init__.py rpm/transaction.py
+rpmpyexec_LTLIBRARIES = _rpmmodule.la _rpmbmodule.la _rpmsmodule.la
+rpmpyexec_DATA = rpm/__init__.py rpm/transaction.py
+rpmpyexecdir = @pyexecdir@/@PYTHON_MODULENAME@
_rpmmodule_la_LDFLAGS = -module -avoid-version -shared
_rpmmodule_la_LIBADD = \
diff --git a/python/header-py.c b/python/header-py.c
index d194fdcf7..ff581f112 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -393,7 +393,7 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
if (obj == NULL) {
h = headerNew();
} else if (CAPSULE_CHECK(obj)) {
- h = CAPSULE_EXTRACT(obj, "rpm._C_Header");
+ h = CAPSULE_EXTRACT(obj, PYTHON_MODULENAME"._C_Header");
} else if (hdrObject_Check(obj)) {
h = headerCopy(((hdrObject*) obj)->h);
} else if (PyBytes_Check(obj)) {
@@ -404,7 +404,7 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
Py_END_ALLOW_THREADS;
Py_XDECREF(fdo);
} else {
- PyErr_SetString(PyExc_TypeError, "header, blob or file expected");
+ PyErr_SetString(PyExc_TypeError, "header, blob or file expected!!");
return NULL;
}
@@ -684,7 +684,7 @@ static char hdr_doc[] =
PyTypeObject hdr_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.hdr", /* tp_name */
+ PYTHON_MODULENAME".hdr", /* tp_name */
sizeof(hdrObject), /* tp_size */
0, /* tp_itemsize */
(destructor) hdr_dealloc, /* tp_dealloc */
diff --git a/python/rpm/__init__.py.in b/python/rpm/__init__.py.in
index d868d19fa..df1e3a282 100644
--- a/python/rpm/__init__.py.in
+++ b/python/rpm/__init__.py.in
@@ -6,9 +6,9 @@ This module enables you to manipulate rpms and the rpm database.
import warnings
import os
-from rpm._rpm import *
-from rpm.transaction import *
-import rpm._rpm as _rpm
+from @PYTHON_MODULENAME@._rpm import *
+from @PYTHON_MODULENAME@.transaction import *
+import @PYTHON_MODULENAME@._rpm as _rpm
_RPMVSF_NODIGESTS = _rpm._RPMVSF_NODIGESTS
_RPMVSF_NOHEADER = _rpm._RPMVSF_NOHEADER
_RPMVSF_NOPAYLOAD = _rpm._RPMVSF_NOPAYLOAD
@@ -19,13 +19,13 @@ __version_info__ = tuple(__version__.split('.'))
# try to import build bits but dont require it
try:
- from rpm._rpmb import *
+ from @PYTHON_MODULENAME@._rpmb import *
except ImportError:
pass
# try to import signing bits but dont require it
try:
- from rpm._rpms import *
+ from @PYTHON_MODULENAME@._rpms import *
except ImportError:
pass
diff --git a/python/rpm/transaction.py.in b/python/rpm/transaction.py.in
index 73e4b3c15..e73075923 100644
--- a/python/rpm/transaction.py.in
+++ b/python/rpm/transaction.py.in
@@ -1,7 +1,7 @@
#!/usr/bin/python
-import rpm
-from rpm._rpm import ts as TransactionSetCore
+import @PYTHON_MODULENAME@ as rpm
+from @PYTHON_MODULENAME@._rpm import ts as TransactionSetCore
# TODO: migrate relevant documentation from C-side
class TransactionSet(TransactionSetCore):
diff --git a/python/rpmds-py.c b/python/rpmds-py.c
index 30fb908fb..4b44220dc 100644
--- a/python/rpmds-py.c
+++ b/python/rpmds-py.c
@@ -341,7 +341,7 @@ static char rpmds_doc[] =
PyTypeObject rpmds_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.ds", /* tp_name */
+ PYTHON_MODULENAME".ds", /* tp_name */
sizeof(rpmdsObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c
index a266ad686..79eb5b6ee 100644
--- a/python/rpmfd-py.c
+++ b/python/rpmfd-py.c
@@ -310,7 +310,7 @@ static PyGetSetDef rpmfd_getseters[] = {
PyTypeObject rpmfd_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.fd", /* tp_name */
+ PYTHON_MODULENAME".fd", /* tp_name */
sizeof(rpmfdObject), /* tp_size */
0, /* tp_itemsize */
/* methods */
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index 458e721b7..14e89df1f 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -320,7 +320,7 @@ static char rpmfi_doc[] =
PyTypeObject rpmfi_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.fi", /* tp_name */
+ PYTHON_MODULENAME".fi", /* tp_name */
sizeof(rpmfiObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
diff --git a/python/rpmii-py.c b/python/rpmii-py.c
index d7713affd..17fe79e98 100644
--- a/python/rpmii-py.c
+++ b/python/rpmii-py.c
@@ -103,7 +103,7 @@ static char rpmii_doc[] =
PyTypeObject rpmii_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.ii", /* tp_name */
+ PYTHON_MODULENAME".ii", /* tp_name */
sizeof(rpmiiObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmii_dealloc, /* tp_dealloc */
diff --git a/python/rpmkeyring-py.c b/python/rpmkeyring-py.c
index d5f131e42..7df847db7 100644
--- a/python/rpmkeyring-py.c
+++ b/python/rpmkeyring-py.c
@@ -52,7 +52,7 @@ static char rpmPubkey_doc[] = "";
PyTypeObject rpmPubkey_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.pubkey", /* tp_name */
+ PYTHON_MODULENAME".pubkey", /* tp_name */
sizeof(rpmPubkeyObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmPubkey_dealloc,/* tp_dealloc */
@@ -133,7 +133,7 @@ static char rpmKeyring_doc[] =
PyTypeObject rpmKeyring_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.keyring", /* tp_name */
+ PYTHON_MODULENAME".keyring", /* tp_name */
sizeof(rpmKeyringObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmKeyring_dealloc,/* tp_dealloc */
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c
index 8e670ce02..6c34c9876 100644
--- a/python/rpmmi-py.c
+++ b/python/rpmmi-py.c
@@ -164,7 +164,7 @@ static char rpmmi_doc[] =
PyTypeObject rpmmi_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.mi", /* tp_name */
+ PYTHON_MODULENAME".mi", /* tp_name */
sizeof(rpmmiObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmmi_dealloc, /* tp_dealloc */
diff --git a/python/rpmps-py.c b/python/rpmps-py.c
index bdc899a60..3ee9d4a9a 100644
--- a/python/rpmps-py.c
+++ b/python/rpmps-py.c
@@ -72,7 +72,7 @@ static void rpmprob_dealloc(rpmProblemObject *s)
PyTypeObject rpmProblem_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.prob", /* tp_name */
+ PYTHON_MODULENAME".prob", /* tp_name */
sizeof(rpmProblemObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
diff --git a/python/rpmsystem-py.h b/python/rpmsystem-py.h
index 58ac1ba32..c7286a24e 100644
--- a/python/rpmsystem-py.h
+++ b/python/rpmsystem-py.h
@@ -8,6 +8,8 @@
#include <Python.h>
#include <structmember.h>
+#include "config.h"
+
#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0205
typedef ssize_t Py_ssize_t;
typedef Py_ssize_t (*lenfunc)(PyObject *);
diff --git a/python/rpmtd-py.c b/python/rpmtd-py.c
index 7655755f0..ed3a1455a 100644
--- a/python/rpmtd-py.c
+++ b/python/rpmtd-py.c
@@ -167,7 +167,7 @@ static PyGetSetDef rpmtd_getseters[] = {
PyTypeObject rpmtd_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.td", /* tp_name */
+ PYTHON_MODULENAME".td", /* tp_name */
sizeof(rpmtdObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmtd_dealloc, /* tp_dealloc */
@@ -214,7 +214,7 @@ int rpmtdFromPyObject(PyObject *obj, rpmtd *td)
*td = &(((rpmtdObject *)obj)->td);
return 1;
} else {
- PyErr_SetString(PyExc_TypeError, "rpm.td type expected");
+ PyErr_SetString(PyExc_TypeError, PYTHON_MODULENAME".td type expected");
return 0;
}
}
diff --git a/python/rpmte-py.c b/python/rpmte-py.c
index 2204a5281..6b338260f 100644
--- a/python/rpmte-py.c
+++ b/python/rpmte-py.c
@@ -192,7 +192,7 @@ rpmte_FI(rpmteObject * s, PyObject * args, PyObject * kwds)
static struct PyMethodDef rpmte_methods[] = {
{"Type", (PyCFunction)rpmte_TEType, METH_NOARGS,
"te.Type() -> Type\n\
-- Return element type (rpm.TR_ADDED | rpm.TR_REMOVED).\n" },
+- Return element type ("PYTHON_MODULENAME".TR_ADDED | "PYTHON_MODULENAME".TR_REMOVED).\n" },
{"N", (PyCFunction)rpmte_N, METH_NOARGS,
"te.N() -> N\n\
- Return element name.\n" },
@@ -250,7 +250,7 @@ static char rpmte_doc[] =
PyTypeObject rpmte_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.te", /* tp_name */
+ PYTHON_MODULENAME".te", /* tp_name */
sizeof(rpmteObject), /* tp_size */
0, /* tp_itemsize */
(destructor)0, /* tp_dealloc */
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 5c6e9baf3..1072f354e 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -440,7 +440,7 @@ static PyObject *rpmts_setKeyring(rpmtsObject *s, PyObject *arg)
if (arg == Py_None || rpmKeyringFromPyObject(arg, &keyring)) {
return PyBool_FromLong(rpmtsSetKeyring(s->ts, keyring) == 0);
} else {
- PyErr_SetString(PyExc_TypeError, "rpm.keyring or None expected");
+ PyErr_SetString(PyExc_TypeError, PYTHON_MODULENAME".keyring or None expected");
return NULL;
}
}
@@ -872,7 +872,7 @@ static PyGetSetDef rpmts_getseters[] = {
PyTypeObject rpmts_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.ts", /* tp_name */
+ PYTHON_MODULENAME".ts", /* tp_name */
sizeof(rpmtsObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmts_dealloc, /* tp_dealloc */
diff --git a/python/setup.py.in b/python/setup.py.in
index 619b0ac73..14be973a3 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -20,7 +20,7 @@ def mksources(names):
cflags = ['-std=c99']
-rpmmod = Extension('rpm._rpm',
+rpmmod = Extension('@PYTHON_MODULENAME@._rpm',
sources = mksources([
'header', 'rpmds', 'rpmfd', 'rpmfi', 'rpmii',
'rpmkeyring', 'rpmmacro', 'rpmmi', 'rpmps',
@@ -31,21 +31,21 @@ rpmmod = Extension('rpm._rpm',
extra_compile_args = cflags
)
-rpmbuild_mod = Extension('rpm._rpmb',
+rpmbuild_mod = Extension('@PYTHON_MODULENAME@._rpmb',
sources = mksources(['rpmbmodule', 'spec']),
include_dirs = pkgconfig('--cflags'),
libraries = pkgconfig('--libs') + ['rpmbuild'],
extra_compile_args = cflags
)
-rpmsign_mod = Extension('rpm._rpms',
+rpmsign_mod = Extension('@PYTHON_MODULENAME@._rpms',
sources = mksources(['rpmbmodule']),
include_dirs = pkgconfig('--cflags'),
libraries = pkgconfig('--libs') + ['rpmsign'],
extra_compile_args = cflags
)
-setup(name='@PACKAGE_NAME@-python',
+setup(name='@PACKAGE_NAME@',
version='@VERSION@',
description='Python bindings for @PACKAGE_NAME@',
maintainer_email='@PACKAGE_BUGREPORT@',
diff --git a/python/spec-py.c b/python/spec-py.c
index 1850a50ee..82245200e 100644
--- a/python/spec-py.c
+++ b/python/spec-py.c
@@ -31,10 +31,10 @@
/* Header objects are in another module, some hoop jumping required... */
static PyObject *makeHeader(Header h)
{
- PyObject *rpmmod = PyImport_ImportModuleNoBlock("rpm");
+ PyObject *rpmmod = PyImport_ImportModuleNoBlock(PYTHON_MODULENAME);
if (rpmmod == NULL) return NULL;
- PyObject *ptr = CAPSULE_BUILD(h, "rpm._C_Header");
+ PyObject *ptr = CAPSULE_BUILD(h, PYTHON_MODULENAME"._C_Header");
PyObject *hdr = PyObject_CallMethod(rpmmod, "hdr", "(O)", ptr);
Py_XDECREF(ptr);
Py_XDECREF(rpmmod);
@@ -62,7 +62,7 @@ static PyGetSetDef specpkg_getseters[] = {
PyTypeObject specPkg_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.specpkg", /* tp_name */
+ PYTHON_MODULENAME".specpkg", /* tp_name */
sizeof(specPkgObject), /* tp_size */
0, /* tp_itemsize */
0, /* tp_dealloc */
@@ -263,7 +263,7 @@ static struct PyMethodDef spec_methods[] = {
PyTypeObject spec_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "rpm.spec", /*tp_name*/
+ PYTHON_MODULENAME".spec", /*tp_name*/
sizeof(specObject), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor) spec_dealloc, /*tp_dealloc*/