Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/move toolcut into python api dso #367

Merged
merged 20 commits into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/VolumeTester/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ AC_CONFIG_SRCDIR([./DeviceReader.cpp])
AC_CONFIG_MACRO_DIR([../m4])
AC_CONFIG_AUX_DIR([..])
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
LT_INIT()
Expand Down
81 changes: 6 additions & 75 deletions src/backend-python/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "ConnectionErrors.h"
#include "ConnectionInterface.h"
#include "ConnectionManager.h"
#include "PythonBuildInfo.h"

#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
Expand All @@ -26,8 +25,8 @@
#include <youtils/Gcrypt.h>
#include <youtils/Logger.h>

#include <youtils/PythonLogging.h>
#include <youtils/PythonBuildInfo.h>
#include <youtils/python/BuildInfoAdapter.h>
#include <youtils/python/LoggingAdapter.h>

#include <backend/AlbaConfig.h>
#include <backend/BackendConfig.h>
Expand All @@ -40,6 +39,7 @@
.value("F", name::F) \
.value("T", name::T);

namespace ypy = youtils::python;
namespace yt = youtils;

BOOST_PYTHON_MODULE(Backend)
Expand Down Expand Up @@ -73,62 +73,12 @@ BOOST_PYTHON_MODULE(Backend)
EXN(backend::BackendNotImplementedException);

#undef EXN

youtils::Logger::disableLogging();
yt::Gcrypt::init_gcrypt();

using youtils::Severity;

enum_<Severity>("Severity",
"What should be logged, one of trace, debug, periodic, info, warning, error, fatal or notification")
.value("trace", Severity::trace)
.value("debug", Severity::debug)
.value("periodic", Severity::periodic)
.value("info", Severity::info)
.value("warning", Severity::warning)
.value("error", Severity::error)
.value("fatal", Severity::fatal)
.value("notification", Severity::notification);

using pythonyoutils::Logging;

class_<pythonyoutils::Logging, boost::noncopyable>("Logging",
"Configure the logging",
no_init)
.def("disableLogging",
&Logging::disableLogging,
"Disable the logging")
.staticmethod("disableLogging")
.def("enableLogging",
&Logging::enableLogging,
"Enable the logging")
.staticmethod("enableLogging")
.def("loggingEnabled",
&Logging::loggingEnabled,
"Check whether logging is enabled"
"@returns a bool")
.staticmethod("loggingEnabled")
.def("setupConsoleLogging",
&Logging::setupConsoleLogging,
(args("severity") = yt::Severity::info,
args("progname") = std::string("PythonLogger")),
"Setup logging to the console\n"
"@param severity, a Severity, what to log\n"
"param progname, String, program name to use for logging\n")
.staticmethod("setupConsoleLogging")
.def("setupFileLogging",
&Logging::setupFileLogging,
(args("path"),
args("severity") = yt::Severity::info,
args("progname") = std::string("PythonLogger")),
"Setup logging to a file\n",
"@param path, String, path to the output file\n"
"@param severity, a Severity, what to log\n"
"param progname, String, program name to use for logging\n")
.staticmethod("setupFileLogging");
ypy::register_once<ypy::LoggingAdapter>();
ypy::register_once<ypy::BuildInfoAdapter>();

MAKE_PYTHON_VD_BOOLEAN_ENUM(OverwriteObject,
"Whether to overwrite an existing object in the backend, values are T and F");
"Whether to overwrite an existing object in the backend, values are T and F");

enum_<backend::BackendType>("BackendType",
"Type of backend connection.\n"
Expand All @@ -146,23 +96,6 @@ BOOST_PYTHON_MODULE(Backend)
.value("WALRUS", backend::S3Flavour::WALRUS)
;

class_<PythonBuildInfo, boost::noncopyable>("BuildInfo",
"Holds information about this build",
no_init)
.def("revision", &PythonBuildInfo::revision,
"Get the revision of this build"
"@result the revision of this build, a string")
.staticmethod("revision")
.def("branch", &PythonBuildInfo::branch,
"Get the branch of this build"
"@result the branch of this build, a string")
.staticmethod("branch")
.def("buildTime", &PythonBuildInfo::buildTime,
"Get the build time version of this build"
"@result the build time version of this build, a string")
.staticmethod("buildTime")
;

class_<ConnectionManager,
boost::noncopyable>("ConnectionManager",
init<const boost::python::dict&>
Expand Down Expand Up @@ -239,8 +172,6 @@ BOOST_PYTHON_MODULE(Backend)
&ConnectionInterface::str)
.def("__repr__",
&ConnectionInterface::str);

youtils::python::BuildInfo::registerize();
}

// Local Variables: **
Expand Down
3 changes: 1 addition & 2 deletions src/backend-python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Backend_la_SOURCES = \
Backend.cpp \
ConnectionErrors.cpp \
ConnectionInterface.cpp \
ConnectionManager.cpp \
PythonBuildInfo.cpp
ConnectionManager.cpp

Backend_la_LDFLAGS = -module -shared

Expand Down
62 changes: 0 additions & 62 deletions src/backend-python/PythonBuildInfo.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/backend-python/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ AC_CONFIG_SRCDIR([./Backend.cpp])
AC_CONFIG_MACRO_DIR([../m4])
AC_CONFIG_AUX_DIR([../])
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
LT_INIT(disable-static)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ AC_CONFIG_SRCDIR([./BackendConfig.cpp])
AC_CONFIG_MACRO_DIR([../m4])
AC_CONFIG_AUX_DIR([..])
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
LT_INIT()
Expand Down
4 changes: 2 additions & 2 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/vd_macros.m4])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
AC_ARG_VAR(BUILDTOOLS, [set the location of buildtools])
Expand Down
4 changes: 2 additions & 2 deletions src/fawltyfs/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ VD_BUILDTOOLS()
OMNIIDL()
VD_SCRIPT_DIR()
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
LT_INIT()
Expand Down
16 changes: 7 additions & 9 deletions src/fawltyfs/pyfawltyfs/PyFawltyFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@

#include <youtils/Assert.h>
#include <youtils/Logger.h>
#include <youtils/LoggerToolCut.h>
#include <youtils/LoggingToolCut.h>
#include <youtils/PythonBuildInfo.h>
#include <youtils/python/BuildInfoAdapter.h>
#include <youtils/python/LoggingAdapter.h>


namespace bpy = boost::python;
namespace yt = youtils;
namespace ypy = youtils::python;

namespace pyfawltyfs
{
Expand Down Expand Up @@ -283,9 +285,8 @@ class PyFawltyFS
// XXX: document params
BOOST_PYTHON_MODULE(PyFawltyFS)
{

youtils::Logger::disableLogging();
#include <youtils/LoggerToolCut.incl>
ypy::register_once<ypy::LoggingAdapter>();
ypy::register_once<ypy::BuildInfoAdapter>();

bpy::enum_<fawltyfs::FileSystemCall>("FileSystemCall",
"Type of calls on the filesystem.")
Expand Down Expand Up @@ -415,11 +416,8 @@ BOOST_PYTHON_MODULE(PyFawltyFS)
.def("__exit__",
&pyfawltyfs::PyFawltyFS::exit,
"with-stmt context management - exit\n");

youtils::python::BuildInfo::registerize();
}

// Local Variables: **
// compile-command: "scons -D -j 4" **
// mode: c++ **
// End: **
4 changes: 2 additions & 2 deletions src/filedriver/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ AC_CONFIG_SRCDIR([./ContainerManager.h])
AC_CONFIG_MACRO_DIR([../m4])
AC_CONFIG_AUX_DIR([..])
AM_INIT_AUTOMAKE(m4_esyscmd([case `automake --version | head -n 1` in
*1.11*) echo foreign;;
*) echo "foreign serial-tests";;
*1.11*) echo "subdir-objects foreign";;
*) echo "subdir-objects foreign serial-tests";;
esac]))
dnl AM_INIT_AUTOMAKE([foreign])
LT_INIT()
Expand Down
4 changes: 2 additions & 2 deletions src/filesystem-python-client/FileSystemMetaDataClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// but WITHOUT ANY WARRANTY of any kind.

#include "FileSystemMetaDataClient.h"
#include "IntegerConverter.h"
#include "StringyConverter.h"

#include <boost/make_shared.hpp>
#include <boost/python/class.hpp>
Expand All @@ -27,6 +25,8 @@

#include <youtils/LockedArakoon.h>
#include <youtils/Logger.h>
#include <youtils/python/IntegerConverter.h>
#include <youtils/python/StringyConverter.h>

#include <filesystem/DirectoryEntry.h>
#include <filesystem/FrontendPath.h>
Expand Down
8 changes: 4 additions & 4 deletions src/filesystem-python-client/LocalClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
// Open vStorage is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY of any kind.

#include "IterableConverter.h"
#include "LocalClient.h"
#include "OptionalConverter.h"
#include "PairConverter.h"
#include "Piccalilli.h"
#include "StrongArithmeticTypedefConverter.h"

#include <boost/python/class.hpp>
#include <boost/python/enum.hpp>

#include <youtils/Logger.h>
#include <youtils/python/IterableConverter.h>
#include <youtils/python/OptionalConverter.h>
#include <youtils/python/PairConverter.h>
#include <youtils/python/StrongArithmeticTypedefConverter.h>

#include <volumedriver/ClusterCount.h>

Expand Down
Loading