~ubuntu-branches/ubuntu/precise/glom/precise-updates

« back to all changes in this revision

Viewing changes to tests/test_python_module.cc

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-10-09 16:50:36 UTC
  • mfrom: (1.1.42 upstream)
  • Revision ID: james.westby@ubuntu.com-20091009165036-orinvwmohk838xxl
Tags: 1.12.2-0ubuntu1
* New upstream version:
  - FFE LP: #391664
* debian/control:
  - Bump python-gnome2-extras-dev build-dep to >= 2.25.3.
  - Bump libgdamm3.0-dev build-dep to libgdamm4.0-dev >= 3.99.14.
  - Change libgda3-dev build-dep to libgda-4.0-dev.
  - Change libgda3-postgres dependency to libgda-4.0-postgres.
  - Bump libgtkmm-2.4-dev build-dep to >= 2.14.
  - Add build-dep on libgconfmm-2.6-dev.
  - Bump libgoocanvasmm-dev build-dep to >= 0.14.0.
  - Remove build-dep on libbakery-2.6-dev.
  - Bump postgresql-8.3 dependency to postgresql-8.4.
  - Change scrollkeeper build-dep to rarian-compat.
  - Rename libglom{0,-dev} -> libglom-1.12-{0,dev}. Upstream include
    APIVER in the library name now.
* debian/rules:
  - Update --with-postgres-utils configure flag to point to the new
    path.
  - Drop deprecated --disable-scrollkeeper configure flag.
  - Update DEB_SHLIBDEPS_INCLUDE with new libglom-1.12-0 package name.
  - Don't include /usr/share/cdbs/1/rules/simple-patchsys.mk - there
    are currently no patches.
* debian/libglom-1.12-0.install:
  - Updated for new version.
* debian/libglom-1.12-dev.install:
  - Install pc and header files.
* debian/glom-doc.install:
  - Updated for new version.
* debian/glom.install:
  - Updated for new version.
* Fix debian/watch.
* Dropped obsolete 10-distro-install-postgres-change.patch.
* Built against latest libgoocanvasmm (LP: #428445).
* Also closes LP: #230007, LP: #393229, LP: #393231, LP: #394507,
  LP: #394887, LP: #394894, LP: #397409, LP: #381563.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <Python.h>
 
2
#include <cstdio>
 
3
#include <libglom/init.h>
 
4
 
 
5
#include "config.h"
 
6
#include "glom/python_embed/glom_python.h"
 
7
 
 
8
#ifndef G_OS_WIN32
 
9
extern "C" void __libc_freeres(void);
 
10
#endif
 
11
 
 
12
namespace Glom
 
13
{
 
14
bool glom_python_module_is_available()
 
15
{
 
16
  const gchar* name = "glom_" GLOM_ABI_VERSION_UNDERLINED;
 
17
  PyObject* module_glom = PyImport_ImportModule((char*)name); //TODO: unref this?
 
18
 
 
19
  if(!module_glom)
 
20
  {
 
21
    g_warning("Glom: A python import of %s failed.\n", name);
 
22
  }
 
23
 
 
24
  return module_glom != 0;
 
25
}
 
26
 
 
27
bool gda_python_module_is_available()
 
28
{
 
29
  const gchar* name = "gda";
 
30
  PyObject* module_glom = PyImport_ImportModule((char*)name); //TODO: unref this?
 
31
 
 
32
  if(!module_glom)
 
33
  {
 
34
    g_warning("Glom: A python import of %s failed.\n", name);
 
35
  }
 
36
 
 
37
  return module_glom != 0;
 
38
}
 
39
 
 
40
}
 
41
 
 
42
int main ()
 
43
{
 
44
#ifndef G_OS_WIN32
 
45
  atexit(__libc_freeres);
 
46
#endif
 
47
  Glom::libglom_init();  // Calls PyInitialize()
 
48
  
 
49
  if (!Glom::gda_python_module_is_available())
 
50
    return EXIT_FAILURE;
 
51
  if (!Glom::glom_python_module_is_available())
 
52
    return EXIT_FAILURE;
 
53
  
 
54
  Glom::libglom_deinit(); // Calls Py_Finalize();
 
55
  
 
56
  return EXIT_SUCCESS;
 
57
}