mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-19 16:32:13 +00:00
Compare commits
2 Commits
boost-1.78
...
boost-1.80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c82f2ec688 | ||
|
|
9780d8338f |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -253,7 +253,7 @@ jobs:
|
||||
if [ -f "/etc/debian_version" ]
|
||||
then
|
||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 libpython-dev libpython3-dev perl git cmake
|
||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 perl git cmake
|
||||
fi
|
||||
fi
|
||||
git config --global pack.threads 0
|
||||
|
||||
15
appveyor.yml
15
appveyor.yml
@@ -1,6 +1,6 @@
|
||||
# Copyright 2017 Edward Diener
|
||||
# Copyright 2017 Cromwell D. Enage
|
||||
# Copyright 2021 Andrey Semashev
|
||||
# Copyright 2021-2022 Andrey Semashev
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://boost.org/LICENSE_1_0.txt)
|
||||
@@ -23,17 +23,17 @@ environment:
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- ARGS: toolset=msvc-14.1 address-model=32,64 cxxstd=14,17,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
- ARGS: toolset=msvc-14.2 address-model=32,64 cxxstd=14,17,latest
|
||||
- ARGS: toolset=msvc-14.2 address-model=32,64 cxxstd=14,17,20,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- ARGS: toolset=msvc-14.3 address-model=32,64 cxxstd=14,17,20,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
||||
- ARGS: toolset=clang-win address-model=32,64 cxxstd=14,17,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
- ARGS: toolset=gcc address-model=32 cxxstd=03,11,14,1z
|
||||
PATH: C:\cygwin\bin;%PATH%
|
||||
# Cygwin does not have python headers installed, the compiler picks up Win32 headers in C:\Python27\Include and fails
|
||||
BOOST_PARAMETER_TEST_WITHOUT_PYTHON_TESTS: 1
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- ARGS: toolset=gcc address-model=64 cxxstd=03,11,14,1z
|
||||
PATH: C:\cygwin64\bin;%PATH%
|
||||
# Cygwin64 does not have python headers installed, the compiler picks up Win32 headers in C:\Python27\Include and fails
|
||||
BOOST_PARAMETER_TEST_WITHOUT_PYTHON_TESTS: 1
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- ARGS: toolset=gcc address-model=32 cxxstd=03,11 linkflags=-Wl,-allow-multiple-definition
|
||||
PATH: C:\MinGW\bin;%PATH%
|
||||
@@ -60,12 +60,11 @@ install:
|
||||
- git submodule init tools/boost_install
|
||||
- git submodule init libs/headers
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/parameter_python
|
||||
- git submodule update --jobs %GIT_FETCH_JOBS%
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\parameter
|
||||
- python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" parameter
|
||||
- cmd /c bootstrap
|
||||
- b2 headers
|
||||
- b2 -d0 headers
|
||||
|
||||
build: off
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ file(GLOB test_files *.cpp)
|
||||
# special requirements
|
||||
# TODO: enable more tests
|
||||
list(FILTER test_files EXCLUDE REGEX
|
||||
efficiency|deduced_unmatched_arg|python_test|duplicates)
|
||||
efficiency|deduced_unmatched_arg|duplicates)
|
||||
|
||||
# Attach all our tests to the `tests` target, to enable
|
||||
# `cmake --build . --target tests`
|
||||
|
||||
@@ -15,8 +15,6 @@ project boost/parameter
|
||||
<warnings>off
|
||||
;
|
||||
|
||||
import python ;
|
||||
|
||||
alias parameter_standard_tests
|
||||
:
|
||||
[ run maybe.cpp : : : : : <preserve-target-tests>off ]
|
||||
@@ -493,76 +491,6 @@ alias parameter_literate_tests
|
||||
]
|
||||
;
|
||||
|
||||
if ! [ os.environ BOOST_PARAMETER_TEST_WITHOUT_PYTHON_TESTS ]
|
||||
{
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for clang on linux with cxxstd set to 14
|
||||
<target-os>linux
|
||||
<toolset>clang
|
||||
<cxxstd>14
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for clang on linux with cxxstd set to 1z
|
||||
<target-os>linux
|
||||
<toolset>clang
|
||||
<cxxstd>1z
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for xcode 8.3.0 on osx
|
||||
# so we turn off this test for this compiler completely for now
|
||||
<target-os>darwin
|
||||
# TODO: Differentiate by xcode version or by clang version
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for mingw compilers with cxxstd set to 11 or higher
|
||||
# because of a Python header problem
|
||||
# so we turn off this test for this compiler completely
|
||||
<target-os>windows
|
||||
<toolset>gcc
|
||||
<address-model>32
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for clang-linux compilers with cxxstd set to 11 or higher
|
||||
# because of a Python header problem
|
||||
# so we turn off this test for this compiler completely
|
||||
<target-os>windows
|
||||
<toolset>clang-linux
|
||||
<address-model>32
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
:
|
||||
# Python fails for windows compilers with 64-bit addressing set
|
||||
# because of a Python header problem
|
||||
<target-os>windows
|
||||
<address-model>64
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
:
|
||||
[ bpl-test python_test ]
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
alias parameter_python_test ;
|
||||
}
|
||||
|
||||
alias parameter_macros_eval_category
|
||||
:
|
||||
:
|
||||
@@ -950,6 +878,5 @@ test-suite "parameter"
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
parameter_standard_tests
|
||||
parameter_literate_tests
|
||||
parameter_python_test
|
||||
parameter_vendor_specific_fail_tests
|
||||
;
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
// Copyright Daniel Wallin 2006. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <math.h>
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
#include <boost/parameter/python.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_KEYWORD(tags, x)
|
||||
BOOST_PARAMETER_KEYWORD(tags, y)
|
||||
BOOST_PARAMETER_KEYWORD(tags, z)
|
||||
|
||||
struct Xbase
|
||||
{
|
||||
// We need the disable_if part for VC7.1/8.0.
|
||||
template <class Args>
|
||||
Xbase(
|
||||
Args const& args
|
||||
, typename boost::disable_if<
|
||||
boost::is_base_and_derived<Xbase, Args>
|
||||
>::type* = 0
|
||||
)
|
||||
: value(std::string(args[x | "foo"]) + args[y | "bar"])
|
||||
{}
|
||||
|
||||
std::string value;
|
||||
};
|
||||
|
||||
struct X : Xbase
|
||||
{
|
||||
BOOST_PARAMETER_CONSTRUCTOR(X, (Xbase), tags,
|
||||
(optional
|
||||
(x, *)
|
||||
(y, *)
|
||||
)
|
||||
)
|
||||
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((int), f, tags,
|
||||
(required
|
||||
(x, *)
|
||||
(y, *)
|
||||
)
|
||||
(optional
|
||||
(z, *)
|
||||
)
|
||||
)
|
||||
{
|
||||
return args[x] + args[y] + args[z | 0];
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((std::string), g, tags,
|
||||
(optional
|
||||
(x, *)
|
||||
(y, *)
|
||||
)
|
||||
)
|
||||
{
|
||||
return std::string(args[x | "foo"]) + args[y | "bar"];
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION((X&), h, tags,
|
||||
(optional (x, *, "") (y, *, ""))
|
||||
)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class A0>
|
||||
X& operator()(A0 const& a0)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
struct f_fwd
|
||||
{
|
||||
template <class R, class T, class A0, class A1, class A2>
|
||||
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1, A2 const& a2)
|
||||
{
|
||||
return self.f(a0,a1,a2);
|
||||
}
|
||||
};
|
||||
|
||||
struct g_fwd
|
||||
{
|
||||
template <class R, class T, class A0, class A1>
|
||||
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
|
||||
{
|
||||
return self.g(a0,a1);
|
||||
}
|
||||
};
|
||||
|
||||
struct h_fwd
|
||||
{
|
||||
template <class R, class T>
|
||||
R operator()(boost::type<R>, T& self)
|
||||
{
|
||||
return self.h();
|
||||
}
|
||||
|
||||
template <class R, class T, class A0>
|
||||
R operator()(boost::type<R>, T& self, A0 const& a0)
|
||||
{
|
||||
return self.h(a0);
|
||||
}
|
||||
|
||||
template <class R, class T, class A0, class A1>
|
||||
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
|
||||
{
|
||||
return self.h(a0,a1);
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE(python_test_ext)
|
||||
{
|
||||
namespace mpl = boost::mpl;
|
||||
using namespace test;
|
||||
using namespace boost::python;
|
||||
|
||||
class_<X>("X")
|
||||
.def(
|
||||
boost::parameter::python::init<
|
||||
mpl::vector<
|
||||
tags::x*(std::string), tags::y*(std::string)
|
||||
>
|
||||
>()
|
||||
)
|
||||
.def(
|
||||
"f"
|
||||
, boost::parameter::python::function<
|
||||
f_fwd
|
||||
, mpl::vector<
|
||||
int, tags::x(int), tags::y(int), tags::z*(int)
|
||||
>
|
||||
>()
|
||||
)
|
||||
.def(
|
||||
"g"
|
||||
, boost::parameter::python::function<
|
||||
g_fwd
|
||||
, mpl::vector<
|
||||
std::string, tags::x*(std::string), tags::y*(std::string)
|
||||
>
|
||||
>()
|
||||
)
|
||||
.def(
|
||||
"h"
|
||||
, boost::parameter::python::function<
|
||||
h_fwd
|
||||
, mpl::vector<
|
||||
X&, tags::x**(std::string), tags::y**(std::string)
|
||||
>
|
||||
>()
|
||||
, return_arg<>()
|
||||
)
|
||||
.def(
|
||||
boost::parameter::python::call<
|
||||
mpl::vector<
|
||||
X&, tags::x(int)
|
||||
>
|
||||
>() [ return_arg<>() ]
|
||||
)
|
||||
.def_readonly("value", &X::value);
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Copyright Daniel Wallin 2006. Distributed under the
|
||||
# Boost Software License, Version 1.0. (See accompanying file
|
||||
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
'''
|
||||
>>> from python_test_ext import X
|
||||
>>> x = X(y = 'baz')
|
||||
>>> x.value
|
||||
'foobaz'
|
||||
>>> x.f(1,2)
|
||||
3
|
||||
>>> x.f(1,2,3)
|
||||
6
|
||||
>>> x.f(1,2, z = 3)
|
||||
6
|
||||
>>> x.f(z = 3, y = 2, x = 1)
|
||||
6
|
||||
>>> x.g()
|
||||
'foobar'
|
||||
>>> x.g(y = "baz")
|
||||
'foobaz'
|
||||
>>> x.g(x = "baz")
|
||||
'bazbar'
|
||||
>>> x.g(y = "foo", x = "bar")
|
||||
'barfoo'
|
||||
>>> y = x.h(x = "bar", y = "foo")
|
||||
>>> assert x == y
|
||||
>>> y = x(0)
|
||||
>>> assert x == y
|
||||
'''
|
||||
|
||||
def run(args = None):
|
||||
if args is not None:
|
||||
import sys
|
||||
sys.argv = args
|
||||
import doctest, python_test
|
||||
return doctest.testmod(python_test)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
sys.exit(run()[0])
|
||||
Reference in New Issue
Block a user