Skip to content

Commit a075d4c

Browse files
committed
Add patch field to libobjcryst_version_info.
Also require libobjcryst >= 1.3 to compile this extension.
1 parent 8a20036 commit a075d4c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

extensions/general_ext.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
#include <ObjCryst/version.h>
2525
#include <ObjCryst/ObjCryst/General.h>
2626

27+
// Explain compilation failure when build with old libobjcryst.
28+
#ifndef LIBOBJCRYST_VERSION_MICRO
29+
#error "pyobjcryst requires libobjcryst 2015.1 or later."
30+
#endif
31+
2732
using namespace boost::python;
2833
using namespace ObjCryst;
2934

@@ -45,6 +50,11 @@ dict get_libobjcryst_version_info_dict()
4550
rv["micro"] = libobjcryst_version_info::micro;
4651
rv["date"] = libobjcryst_version_info::date;
4752
rv["git_sha"] = libobjcryst_version_info::git_sha;
53+
#if LIBOBJCRYST_VERSION >= 2015001000003
54+
rv["patch"] = libobjcryst_version_info::patch;
55+
#else
56+
rv["patch"] = 0;
57+
#endif
4858
return rv;
4959
}
5060

pyobjcryst/version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@
3838
from pyobjcryst._pyobjcryst import _get_libobjcryst_version_info_dict
3939

4040
libobjcryst_version_info = namedtuple('libobjcryst_version_info',
41-
"version version_number major minor micro date git_sha")
41+
"version version_number major minor micro patch date git_sha")
4242
vd = _get_libobjcryst_version_info_dict()
4343
libobjcryst_version_info = libobjcryst_version_info(
4444
version = vd['version_str'],
4545
version_number = vd['version'],
4646
major = vd['major'],
4747
minor = vd['minor'],
4848
micro = vd['micro'],
49+
patch = vd['patch'],
4950
date = vd['date'],
5051
git_sha = vd['git_sha'])
5152
del vd

0 commit comments

Comments
 (0)