Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.math
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.math
Commits
3d1c75a7
Commit
3d1c75a7
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Included funcitonality for version handling in config.h; use new api for versioning
parent
7a0407e1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/math/include/bob.math/config.h
+19
-0
19 additions, 0 deletions
bob/math/include/bob.math/config.h
bob/math/version.cpp
+4
-91
4 additions, 91 deletions
bob/math/version.cpp
version.txt
+1
-1
1 addition, 1 deletion
version.txt
with
24 additions
and
92 deletions
bob/math/include/bob.math/config.h
+
19
−
0
View file @
3d1c75a7
...
...
@@ -11,4 +11,23 @@
/* Macros that define versions and important names */
#define BOB_MATH_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.math c/c++ api version
*/
static
PyObject
*
bob_math_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_MATH_API_VERSION
));
}
#endif // BOB_IMPORT_VERSION
#endif
/* BOB_MATH_CONFIG_H */
This diff is collapsed.
Click to expand it.
bob/math/version.cpp
+
4
−
91
View file @
3d1c75a7
...
...
@@ -5,102 +5,14 @@
* @brief Binds configuration information available from bob
*/
#include
<Python.h>
#include
<string>
#include
<cstdlib>
#include
<blitz/blitz.h>
#include
<boost/preprocessor/stringize.hpp>
#include
<boost/version.hpp>
#include
<boost/format.hpp>
#include
<bob.math/config.h>
#define BOB_IMPORT_VERSION
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include
<bob.blitz/capi.h>
#include
<bob.blitz/cleanup.h>
#include
<bob.core/config.h>
#include
<bob.math/config.h>
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
(
"{ssss}"
,
"name"
,
"gcc"
,
"version"
,
f
.
str
().
c_str
());
# elif defined(__llvm__) && !defined(__clang__)
return
Py_BuildValue
(
"{ssss}"
,
"name"
,
"llvm-gcc"
,
"version"
,
__VERSION__
);
# elif defined(__clang__)
return
Py_BuildValue
(
"{ssss}"
,
"name"
,
"clang"
,
"version"
,
__clang_version__
);
# else
return
Py_BuildValue
(
"{ssss}"
,
"name"
,
"unsupported"
,
"version"
,
"unknown"
);
# endif
}
/**
* 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
));
}
/**
* bob.blitz c/c++ api version
*/
static
PyObject
*
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_BLITZ_API_VERSION
));
}
/**
* bob.core c/c++ api version
*/
static
PyObject
*
bob_core_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_CORE_API_VERSION
));
}
#include
<bob.core/api.h>
static
PyObject
*
build_version_dictionary
()
{
...
...
@@ -157,6 +69,7 @@ static PyObject* create_module (void) {
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
if
(
import_bob_blitz
()
<
0
)
return
0
;
if
(
import_bob_core_logging
()
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
}
...
...
This diff is collapsed.
Click to expand it.
version.txt
+
1
−
1
View file @
3d1c75a7
2.0.2b0
\ No newline at end of file
2.0.2b1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment