mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 12:12:15 +00:00
Merge remote-tracking branch 'origin/v0.7.0' into v0.8.0
This commit is contained in:
+18
-14
@@ -67,20 +67,24 @@ endif()
|
||||
# Try to find the Python interpreter to get the site-packages
|
||||
# directory in which the wrapper can be installed.
|
||||
FIND_PACKAGE(PythonInterp)
|
||||
IF(PYTHONINTERP_FOUND AND NOT "${PYTHON_EXECUTABLE}" STREQUAL "")
|
||||
IF (USERSPACE_PYTHON_PREFIX)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import site; sys.stdout.write(site.USER_SITE)"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ELSE ()
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ENDIF()
|
||||
if (BUILD_PACKAGE)
|
||||
set(python_package_dir ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}/dist-packages/)
|
||||
IF((PYTHONINTERP_FOUND AND NOT "${PYTHON_EXECUTABLE}" STREQUAL "") OR PYTHON_MODULE_INSTALL_DIR)
|
||||
if (PYTHON_MODULE_INSTALL_DIR)
|
||||
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")
|
||||
else()
|
||||
IF (USERSPACE_PYTHON_PREFIX)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import site; sys.stdout.write(site.USER_SITE)"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ELSE ()
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ENDIF()
|
||||
if (BUILD_PACKAGE)
|
||||
set(python_package_dir ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}/dist-packages/)
|
||||
endif()
|
||||
endif()
|
||||
IF("${python_package_dir}" STREQUAL "")
|
||||
MESSAGE(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")
|
||||
|
||||
+631
-622
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,41 @@ private:
|
||||
%rename("add") addEntity;
|
||||
%rename("remove") removeEntity;
|
||||
|
||||
class attribute_value_derived {};
|
||||
%{
|
||||
class attribute_value_derived {};
|
||||
%}
|
||||
|
||||
%extend attribute_value_derived {
|
||||
%pythoncode %{
|
||||
def __bool__(self): return False
|
||||
def __repr__(self): return '*'
|
||||
%}
|
||||
}
|
||||
|
||||
%inline %{
|
||||
static bool feature_use_attribute_value_derived = false;
|
||||
|
||||
void set_feature(const std::string& x, PyObject* v) {
|
||||
if (PyBool_Check(v) && x == "use_attribute_value_derived") {
|
||||
feature_use_attribute_value_derived = v == Py_True;
|
||||
} else {
|
||||
throw std::runtime_error("Invalid feature specification");
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* get_feature(const std::string& x) {
|
||||
if (x == "use_attribute_value_derived") {
|
||||
return PyBool_FromLong(feature_use_attribute_value_derived);
|
||||
} else {
|
||||
throw std::runtime_error("Invalid feature specification");
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%{
|
||||
|
||||
static const std::string& helper_fn_declaration_get_name(const IfcParse::declaration* decl) {
|
||||
return decl->name();
|
||||
}
|
||||
|
||||
@@ -117,6 +117,12 @@
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3
|
||||
#include "../ifcparse/Ifc4x3.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_tc1
|
||||
#include "../ifcparse/Ifc4x3_tc1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add1
|
||||
#include "../ifcparse/Ifc4x3_add1.h"
|
||||
#endif
|
||||
|
||||
#include "../ifcparse/IfcBaseClass.h"
|
||||
@@ -180,6 +186,12 @@
|
||||
#ifdef HAS_SCHEMA_4x3
|
||||
#include "../ifcparse/Ifc4x3.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_tc1
|
||||
#include "../ifcparse/Ifc4x3_tc1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add1
|
||||
#include "../ifcparse/Ifc4x3_add1.h"
|
||||
#endif
|
||||
|
||||
#include "../ifcparse/IfcBaseClass.h"
|
||||
#include "../ifcparse/IfcFile.h"
|
||||
|
||||
@@ -38,9 +38,16 @@
|
||||
try {
|
||||
const Argument& arg = *($1.second);
|
||||
const IfcUtil::ArgumentType type = $1.first;
|
||||
if (arg.isNull() || type == IfcUtil::Argument_DERIVED) {
|
||||
if (arg.isNull()) {
|
||||
Py_INCREF(Py_None);
|
||||
$result = Py_None;
|
||||
} else if (type == IfcUtil::Argument_DERIVED) {
|
||||
if (feature_use_attribute_value_derived) {
|
||||
$result = SWIG_NewPointerObj(new attribute_value_derived, SWIGTYPE_p_attribute_value_derived, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
$result = Py_None;
|
||||
}
|
||||
} else {
|
||||
switch(type) {
|
||||
case IfcUtil::Argument_INT: {
|
||||
|
||||
Reference in New Issue
Block a user