Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.ip.draw
Commits
bbc6908b
Commit
bbc6908b
authored
May 21, 2015
by
Manuel Günther
Browse files
Applied new versioning system
parent
c3ac1ea2
Changes
3
Hide whitespace changes
Inline
Side-by-side
bob/ip/draw/include/bob.ip.draw/config.h
0 → 100644
View file @
bbc6908b
/**
* @author Manuel Guenther <manuel.guenther@idiap.ch>
* @date Wed Aug 20 12:52:04 CEST 2014
*
* @brief General directives for all modules in bob.ip.draw
*/
#ifndef BOB_IP_DRAW_CONFIG_H
#define BOB_IP_DRAW_CONFIG_H
/* Macros that define versions and important names */
#define BOB_IP_DRAW_API_VERSION 0x0200
#ifdef BOB_IMPORT_VERSION
/***************************************
* Here we define some functions that should be used to build version dictionaries in the version.cpp file
* There will be a compiler warning, when these functions are not used, so use them!
***************************************/
#include
<Python.h>
#include
<boost/preprocessor/stringize.hpp>
/**
* bob.ip.draw c/c++ api version
*/
static
PyObject
*
bob_ip_draw_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_IP_DRAW_API_VERSION
));
}
#endif // BOB_IMPORT_VERSION
#endif
/* BOB_IP_DRAW_CONFIG_H */
bob/ip/draw/version.cpp
View file @
bbc6908b
...
...
@@ -5,91 +5,12 @@
* @brief Binds configuration information available from bob
*/
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include
<bob.blitz/capi.h>
#include
<bob.blitz/cleanup.h>
#include
<string>
#include
<cstdlib>
#include
<blitz/blitz.h>
#include
<boost/preprocessor/stringize.hpp>
#include
<boost/version.hpp>
#include
<boost/format.hpp>
static
int
dict_set
(
PyObject
*
d
,
const
char
*
key
,
const
char
*
value
)
{
PyObject
*
v
=
Py_BuildValue
(
"s"
,
value
);
if
(
!
v
)
return
0
;
int
retval
=
PyDict_SetItemString
(
d
,
key
,
v
);
Py_DECREF
(
v
);
if
(
retval
==
0
)
return
1
;
//all good
return
0
;
//a problem occurred
}
static
int
dict_steal
(
PyObject
*
d
,
const
char
*
key
,
PyObject
*
value
)
{
if
(
!
value
)
return
0
;
int
retval
=
PyDict_SetItemString
(
d
,
key
,
value
);
Py_DECREF
(
value
);
if
(
retval
==
0
)
return
1
;
//all good
return
0
;
//a problem occurred
}
/**
* Describes the version of Boost libraries installed
*/
static
PyObject
*
boost_version
()
{
boost
::
format
f
(
"%d.%d.%d"
);
f
%
(
BOOST_VERSION
/
100000
);
f
%
(
BOOST_VERSION
/
100
%
1000
);
f
%
(
BOOST_VERSION
%
100
);
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
}
/**
* Describes the compiler version
*/
static
PyObject
*
compiler_version
()
{
# if defined(__GNUC__) && !defined(__llvm__)
boost
::
format
f
(
"%s.%s.%s"
);
f
%
BOOST_PP_STRINGIZE
(
__GNUC__
);
f
%
BOOST_PP_STRINGIZE
(
__GNUC_MINOR__
);
f
%
BOOST_PP_STRINGIZE
(
__GNUC_PATCHLEVEL__
);
return
Py_BuildValue
(
"ss"
,
"gcc"
,
f
.
str
().
c_str
());
# elif defined(__llvm__) && !defined(__clang__)
return
Py_BuildValue
(
"ss"
,
"llvm-gcc"
,
__VERSION__
);
# elif defined(__clang__)
return
Py_BuildValue
(
"ss"
,
"clang"
,
__clang_version__
);
# else
return
Py_BuildValue
(
"s"
,
"unsupported"
);
# endif
}
#include
<bob.ip.draw/config.h>
/**
* Python version with which we compiled the extensions
*/
static
PyObject
*
python_version
()
{
boost
::
format
f
(
"%s.%s.%s"
);
f
%
BOOST_PP_STRINGIZE
(
PY_MAJOR_VERSION
);
f
%
BOOST_PP_STRINGIZE
(
PY_MINOR_VERSION
);
f
%
BOOST_PP_STRINGIZE
(
PY_MICRO_VERSION
);
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
}
/**
* Numpy version
*/
static
PyObject
*
numpy_version
()
{
return
Py_BuildValue
(
"{ssss}"
,
"abi"
,
BOOST_PP_STRINGIZE
(
NPY_VERSION
),
"api"
,
BOOST_PP_STRINGIZE
(
NPY_API_VERSION
));
}
#define BOB_IMPORT_VERSION
#include
<bob.blitz/config.h>
#include
<bob.blitz/cleanup.h>
/**
* bob.blitz c/c++ api version
*/
static
PyObject
*
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_BLITZ_API_VERSION
));
}
static
PyObject
*
build_version_dictionary
()
{
...
...
@@ -97,15 +18,14 @@ static PyObject* build_version_dictionary() {
if
(
!
retval
)
return
0
;
auto
retval_
=
make_safe
(
retval
);
if
(
!
dict_s
e
t
(
retval
,
"Blitz++"
,
BZ_VERSION
))
return
0
;
if
(
!
dict_st
eal
(
retval
,
"Blitz++"
,
blitz_version
()
))
return
0
;
if
(
!
dict_steal
(
retval
,
"Boost"
,
boost_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Compiler"
,
compiler_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Python"
,
python_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"NumPy"
,
numpy_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"bob.blitz"
,
bob_blitz_version
()))
return
0
;
Py_INCREF
(
retval
);
return
retval
;
return
Py_BuildValue
(
"O"
,
retval
);
}
static
PyMethodDef
module_methods
[]
=
{
...
...
@@ -144,8 +64,6 @@ static PyObject* create_module (void) {
if
(
!
externals
)
return
0
;
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
if
(
import_bob_blitz
()
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
}
...
...
version.txt
View file @
bbc6908b
2.0.2b0
\ No newline at end of file
2.0.2b1
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment