summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Chaplin <stevech1097@yahoo.com.au>2009-08-26 14:12:05 +0800
committerSteve Chaplin <stevech1097@yahoo.com.au>2009-08-26 14:12:05 +0800
commitce4812e74d101ad9c7dc096aa9467d142c00d081 (patch)
treeeec91c4ee5da27dc068ac98380be4e009677125a
parentc6d000b7082546aeb3b964a89465e72bf52f9809 (diff)
downloadpy2cairo-ce4812e74d101ad9c7dc096aa9467d142c00d081.tar.gz
define PYCAIRO_VERSION_MAJOR/MICRO/MINOR in config.h and use in cairomodule.c
-rw-r--r--configure.ac8
-rw-r--r--src/cairomodule.c16
-rw-r--r--src/matrix.c2
-rw-r--r--src/path.c2
-rw-r--r--src/pattern.c2
-rw-r--r--src/surface.c2
-rw-r--r--src/wscript2
-rw-r--r--wscript9
8 files changed, 24 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index d3e0759..aac6ec2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,11 +14,9 @@ AC_INIT([pycairo],
[pycairo_version],
[http://bugs.freedesktop.org/enter_bug.cgi?product=pycairo])
-AC_SUBST(PYCAIRO_VERSION_MAJOR, [pycairo_version_major])
-AC_SUBST(PYCAIRO_VERSION_MINOR, [pycairo_version_minor])
-AC_SUBST(PYCAIRO_VERSION_MICRO, [pycairo_version_micro])
-AC_SUBST(VERSION_INFO,
- [pycairo_version_major,pycairo_version_minor,pycairo_version_micro])
+AC_DEFINE(PYCAIRO_VERSION_MAJOR, pycairo_version_major, [pycairo major version])
+AC_DEFINE(PYCAIRO_VERSION_MINOR, pycairo_version_minor, [pycairo minor version])
+AC_DEFINE(PYCAIRO_VERSION_MICRO, pycairo_version_micro, [pycairo macro version])
AC_CONFIG_SRCDIR([src/pycairo.h])
AC_CONFIG_HEADERS(config.h)
diff --git a/src/cairomodule.c b/src/cairomodule.c
index 9cc506b..4b5fc04 100644
--- a/src/cairomodule.c
+++ b/src/cairomodule.c
@@ -32,7 +32,7 @@
#include <Python.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "private.h"
@@ -41,11 +41,6 @@
# include <cairo-ps.h>
#endif
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 8
-#define VERSION_MICRO 7
-static char pycairo_version_string[] = "1.8.7";
-
/* A module specific exception */
PyObject *CairoError = NULL;
@@ -231,10 +226,13 @@ init_cairo(void)
m = Py_InitModule("cairo._cairo", cairo_functions);
- PyModule_AddStringConstant(m, "version", pycairo_version_string);
+ PyModule_AddStringConstant(m, "version", VERSION);
PyModule_AddObject(m, "version_info",
- Py_BuildValue("(iii)", VERSION_MAJOR, VERSION_MINOR,
- VERSION_MICRO));
+ Py_BuildValue("(iii)",
+ PYCAIRO_VERSION_MAJOR,
+ PYCAIRO_VERSION_MINOR,
+ PYCAIRO_VERSION_MICRO
+ ));
Py_INCREF(&PycairoContext_Type);
PyModule_AddObject(m, "Context", (PyObject *)&PycairoContext_Type);
diff --git a/src/matrix.c b/src/matrix.c
index b404525..b4a5bf1 100644
--- a/src/matrix.c
+++ b/src/matrix.c
@@ -32,7 +32,7 @@
#include <Python.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "private.h"
diff --git a/src/path.c b/src/path.c
index 1ab47ec..bd22152 100644
--- a/src/path.c
+++ b/src/path.c
@@ -32,7 +32,7 @@
#include <Python.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "private.h"
diff --git a/src/pattern.c b/src/pattern.c
index ba9bf94..204d300 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -32,7 +32,7 @@
#include <Python.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "private.h"
diff --git a/src/surface.c b/src/surface.c
index f2f05b8..25ad126 100644
--- a/src/surface.c
+++ b/src/surface.c
@@ -32,7 +32,7 @@
#include <Python.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "private.h"
diff --git a/src/wscript b/src/wscript
index 0680c1c..7822407 100644
--- a/src/wscript
+++ b/src/wscript
@@ -20,7 +20,7 @@ def build(bld):
features = 'cc cshlib pyext',
source = 'cairomodule.c context.c font.c path.c pattern.c matrix.c surface.c',
target = '_cairo',
- includes = '.',
+ includes = '. ..', # '..' for config.h
uselib = 'CAIRO',
install_path = '${PYTHONDIR}/cairo',
)
diff --git a/wscript b/wscript
index 9e4c2dc..7b048b8 100644
--- a/wscript
+++ b/wscript
@@ -39,6 +39,15 @@ def configure(conf):
if opt not in env['CCFLAGS']:
env.append_value('CCFLAGS', opt)
+ version = [int(s) for s in VERSION.split('.')]
+ conf.define('VERSION', VERSION)
+ conf.define('PYCAIRO_VERSION_MAJOR', version[0])
+ conf.define('PYCAIRO_VERSION_MINOR', version[1])
+ conf.define('PYCAIRO_VERSION_MICRO', version[2])
+
+ conf.env.append_value('CCDEFINES', 'HAVE_CONFIG_H') # remove later - always have_config
+ conf.write_config_header('config.h')
+
def build(bld):
print(' %s/build' %d)