mirror of https://github.com/KLayout/klayout.git
Merge pull request #149 from lightwave-lab/pymod-pr
Extending db and improving setup.py & travis
This commit is contained in:
commit
521b197285
107
.travis.yml
107
.travis.yml
|
|
@ -1,40 +1,43 @@
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
# python 3 osx
|
||||||
dist: trusty # Ubuntu 14.04
|
- os: osx
|
||||||
sudo: false
|
osx_image: xcode9.4 # macOS 10.13
|
||||||
language: python
|
|
||||||
python: '2.6'
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
- os: linux
|
- ARCHFLAGS="-std=c++11"
|
||||||
dist: trusty # Ubuntu 14.04
|
- PIP_UPDATE="1"
|
||||||
sudo: false
|
- os: osx
|
||||||
language: python
|
osx_image: xcode8.3 # macOS 10.12
|
||||||
python: '2.7'
|
env:
|
||||||
|
- MATRIX_EVAL="brew install python2 || brew link --overwrite python@2" # deficient python2 in travis's xcode8.3 (no ssl)
|
||||||
|
- ARCHFLAGS="-std=c++11"
|
||||||
|
- PIP_UPDATE="1"
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8 # macOS 10.11
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
- os: linux
|
- ARCHFLAGS="-std=c++11"
|
||||||
dist: trusty # Ubuntu 14.04
|
- PIP_UPDATE="1"
|
||||||
sudo: false
|
# python 2 osx
|
||||||
language: python
|
- os: osx
|
||||||
python: '3.3'
|
osx_image: xcode9.4 # macOS 10.13
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL="brew update; brew bundle; shopt -s expand_aliases; alias python='python3'; alias pip='pip3';"
|
||||||
- os: linux
|
- ARCHFLAGS="-std=c++11"
|
||||||
dist: trusty # Ubuntu 14.04
|
- PIP_UPDATE="1"
|
||||||
sudo: false
|
- os: osx
|
||||||
language: python
|
osx_image: xcode8.3 # macOS 10.12
|
||||||
python: '3.4'
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL="brew update; brew bundle; shopt -s expand_aliases; alias python='python3'; alias pip='pip3';"
|
||||||
- os: linux
|
- ARCHFLAGS="-std=c++11"
|
||||||
dist: trusty # Ubuntu 14.04
|
- PIP_UPDATE="1"
|
||||||
sudo: false
|
- os: osx
|
||||||
language: python
|
osx_image: xcode8 # macOS 10.11
|
||||||
python: '3.5'
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL="brew update; brew bundle; shopt -s expand_aliases; alias python='python3'; alias pip='pip3';"
|
||||||
|
- ARCHFLAGS="-std=c++11"
|
||||||
|
- PIP_UPDATE="1"
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: trusty # Ubuntu 14.04
|
dist: trusty # Ubuntu 14.04
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
@ -42,25 +45,59 @@ matrix:
|
||||||
python: '3.6'
|
python: '3.6'
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
- os: osx
|
- PIP_UPDATE="1"
|
||||||
osx_image: xcode9.3 # macOS 10.13
|
- os: linux
|
||||||
|
dist: trusty # Ubuntu 14.04
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python: '2.7'
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
- os: osx
|
- PIP_UPDATE="1"
|
||||||
osx_image: xcode8.3 # macOS 10.12
|
- os: linux
|
||||||
|
dist: trusty # Ubuntu 14.04
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python: '2.6'
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
- os: osx
|
- PIP_UPDATE="0" # setuptools installed from last pip has syntax error on py 2.6
|
||||||
osx_image: xcode8 # macOS 10.11
|
- os: linux
|
||||||
|
dist: trusty # Ubuntu 14.04
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python: '3.3'
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL=""
|
- MATRIX_EVAL=""
|
||||||
|
- PIP_UPDATE="1"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty # Ubuntu 14.04
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python: '3.4'
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL=""
|
||||||
|
- PIP_UPDATE="1"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty # Ubuntu 14.04
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python: '3.5'
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL=""
|
||||||
|
- PIP_UPDATE="1"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- env
|
- env
|
||||||
- rvm install ruby --latest
|
- rvm install ruby --latest
|
||||||
- gem install dropbox-deployment
|
- gem install dropbox-deployment
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew bundle; shopt -s expand_aliases; alias python='python3'; fi
|
|
||||||
- eval "${MATRIX_EVAL}"
|
- eval "${MATRIX_EVAL}"
|
||||||
|
- if [ "${PIP_UPDATE}" == "1" ]; then
|
||||||
|
pip --version;
|
||||||
|
pip install --upgrade pip || sudo pip install --upgrade pip;
|
||||||
|
pip --version;
|
||||||
|
pip install --upgrade setuptools wheel || sudo pip install --upgrade setuptools wheel;
|
||||||
|
fi
|
||||||
- python -c "import distutils.sysconfig as sysconfig; print(sysconfig.__file__)"
|
- python -c "import distutils.sysconfig as sysconfig; print(sysconfig.__file__)"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
|
||||||
44
setup.py
44
setup.py
|
|
@ -59,6 +59,49 @@ import glob
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import distutils.sysconfig as sysconfig
|
import distutils.sysconfig as sysconfig
|
||||||
|
from distutils.errors import CompileError
|
||||||
|
import multiprocessing
|
||||||
|
N_cores = multiprocessing.cpu_count()
|
||||||
|
|
||||||
|
|
||||||
|
# monkey-patch for parallel compilation
|
||||||
|
# from https://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils
|
||||||
|
def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None):
|
||||||
|
# those lines are copied from distutils.ccompiler.CCompiler directly
|
||||||
|
macros, objects, extra_postargs, pp_opts, build = self._setup_compile(
|
||||||
|
output_dir, macros, include_dirs, sources, depends, extra_postargs)
|
||||||
|
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
||||||
|
# parallel code
|
||||||
|
|
||||||
|
N = min(N_cores, len(objects) // 2, 8) # number of parallel compilations
|
||||||
|
N = max(N, 1)
|
||||||
|
print("Compiling with", N, "threads.")
|
||||||
|
import multiprocessing.pool
|
||||||
|
|
||||||
|
def _single_compile(obj):
|
||||||
|
try:
|
||||||
|
src, ext = build[obj]
|
||||||
|
except KeyError:
|
||||||
|
return
|
||||||
|
n_tries = 2
|
||||||
|
while n_tries > 0:
|
||||||
|
try:
|
||||||
|
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
|
||||||
|
except CompileError:
|
||||||
|
n_tries -= 1
|
||||||
|
print("Building", obj, "has failed. Trying again.")
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
# convert to list, imap is evaluated on-demand
|
||||||
|
list(multiprocessing.pool.ThreadPool(N).imap(_single_compile, objects))
|
||||||
|
return objects
|
||||||
|
|
||||||
|
|
||||||
|
# only if python version > 2.6, somehow the travis compiler hangs in 2.6
|
||||||
|
import sys
|
||||||
|
if sys.version_info[0] * 10 + sys.version_info[1] > 26:
|
||||||
|
import distutils.ccompiler
|
||||||
|
distutils.ccompiler.CCompiler.compile = parallelCCompile
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -298,6 +341,7 @@ rdb = Extension(config.root + '.rdb',
|
||||||
# Core setup function
|
# Core setup function
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
print("Number of cores", N_cores)
|
||||||
setup(name=config.root,
|
setup(name=config.root,
|
||||||
version=config.version(),
|
version=config.version(),
|
||||||
description='KLayout standalone Python package',
|
description='KLayout standalone Python package',
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,24 @@
|
||||||
#ifndef HDR_dbHash
|
#ifndef HDR_dbHash
|
||||||
#define HDR_dbHash
|
#define HDR_dbHash
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__APPLE__)
|
||||||
# include <ext/hash_map>
|
#define __EXT_HASH_DEPRECATED
|
||||||
# include <ext/hash_set>
|
#endif
|
||||||
namespace std_ext = __gnu_cxx;
|
#if defined(__EXT_HASH_DEPRECATED) // clang compiler complains about deprecation warning on ext/hash_map and ext/hash_set
|
||||||
# define DB_HASH_NAMESPACE __gnu_cxx
|
# include <unordered_map>
|
||||||
#else
|
# include <unordered_set>
|
||||||
# include <hash_map>
|
# define DB_HASH_NAMESPACE std
|
||||||
# include <hash_set>
|
|
||||||
namespace std_ext = std;
|
namespace std_ext = std;
|
||||||
# define DB_HASH_NAMESPACE std
|
#elif defined(__GNUC__)
|
||||||
|
# include <ext/hash_map>
|
||||||
|
# include <ext/hash_set>
|
||||||
|
namespace std_ext = __gnu_cxx;
|
||||||
|
# define DB_HASH_NAMESPACE __gnu_cxx
|
||||||
|
#else
|
||||||
|
# include <hash_map>
|
||||||
|
# include <hash_set>
|
||||||
|
namespace std_ext = std;
|
||||||
|
# define DB_HASH_NAMESPACE std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dbPoint.h"
|
#include "dbPoint.h"
|
||||||
|
|
@ -74,7 +82,7 @@ namespace DB_HASH_NAMESPACE
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN64) || defined(__APPLE__)
|
#if defined(_WIN64)
|
||||||
/**
|
/**
|
||||||
* @brief Specialization missing for long long on WIN64
|
* @brief Specialization missing for long long on WIN64
|
||||||
*/
|
*/
|
||||||
|
|
@ -100,6 +108,13 @@ namespace DB_HASH_NAMESPACE
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__EXT_HASH_DEPRECATED)
|
||||||
|
template<typename _Key, typename _Tp>
|
||||||
|
using hash_map = unordered_map<_Key, _Tp>;
|
||||||
|
template<typename _Value>
|
||||||
|
using hash_set = unordered_set<_Value>;
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline size_t hfunc (const T &t)
|
inline size_t hfunc (const T &t)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,20 @@ public:
|
||||||
*/
|
*/
|
||||||
point<C> &operator*= (long s);
|
point<C> &operator*= (long s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Division by some divisor.
|
||||||
|
*
|
||||||
|
* Scaline involves rounding which in our case is simply handled
|
||||||
|
* with the coord_traits scheme.
|
||||||
|
*/
|
||||||
|
|
||||||
|
point<C> &operator/= (double s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dividing self by some integer divisor
|
||||||
|
*/
|
||||||
|
point<C> &operator/= (long s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The euclidian distance to another point
|
* @brief The euclidian distance to another point
|
||||||
*
|
*
|
||||||
|
|
@ -452,6 +466,32 @@ operator* (const db::point<C> &p, unsigned int s)
|
||||||
return point<C> (p.x () * s, p.y () * s);
|
return point<C> (p.x () * s, p.y () * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class C, typename Number>
|
||||||
|
inline point<C>
|
||||||
|
operator/ (const db::point<C> &p, Number s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
return point<C> (p.x () * mult, p.y () * mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
inline point<C> &
|
||||||
|
point<C>::operator/= (double s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
*this *= mult;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
inline point<C> &
|
||||||
|
point<C>::operator/= (long s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
*this *= mult;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <class C>
|
template <class C>
|
||||||
inline point<C> &
|
inline point<C> &
|
||||||
point<C>::operator*= (double s)
|
point<C>::operator*= (double s)
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,20 @@ public:
|
||||||
*/
|
*/
|
||||||
vector<C> operator*= (long s);
|
vector<C> operator*= (long s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Division by some divisor.
|
||||||
|
*
|
||||||
|
* Scaline involves rounding which in our case is simply handled
|
||||||
|
* with the coord_traits scheme.
|
||||||
|
*/
|
||||||
|
|
||||||
|
vector<C> &operator/= (double s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dividing self by some integer divisor
|
||||||
|
*/
|
||||||
|
vector<C> &operator/= (long s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The euclidian length
|
* @brief The euclidian length
|
||||||
*/
|
*/
|
||||||
|
|
@ -450,6 +464,32 @@ vector<C>::operator* (long s) const
|
||||||
return vector<C> (m_x * s, m_y * s);
|
return vector<C> (m_x * s, m_y * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class C, typename Number>
|
||||||
|
inline vector<C>
|
||||||
|
operator/ (const db::vector<C> &p, Number s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
return vector<C> (p.x () * mult, p.y () * mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
inline vector<C> &
|
||||||
|
vector<C>::operator/= (double s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
*this *= mult;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
inline vector<C> &
|
||||||
|
vector<C>::operator/= (long s)
|
||||||
|
{
|
||||||
|
double mult = 1.0 / static_cast<double>(s);
|
||||||
|
*this *= mult;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <class C>
|
template <class C>
|
||||||
inline vector<C>
|
inline vector<C>
|
||||||
vector<C>::operator*= (double s)
|
vector<C>::operator*= (double s)
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,23 @@ struct point_defs
|
||||||
return C (*p * s);
|
return C (*p * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static C divide (const C *p, double s)
|
||||||
|
{
|
||||||
|
return C (*p / s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static C iscale (C *p, double s)
|
||||||
|
{
|
||||||
|
*p *= s;
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static C idiv (C *p, double s)
|
||||||
|
{
|
||||||
|
*p /= s;
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
static C negate (const C *p)
|
static C negate (const C *p)
|
||||||
{
|
{
|
||||||
return -*p;
|
return -*p;
|
||||||
|
|
@ -175,6 +192,30 @@ struct point_defs
|
||||||
"Returns the scaled object. All coordinates are multiplied with the given factor and if "
|
"Returns the scaled object. All coordinates are multiplied with the given factor and if "
|
||||||
"necessary rounded."
|
"necessary rounded."
|
||||||
) +
|
) +
|
||||||
|
method_ext ("*=", &iscale,
|
||||||
|
"@brief Scaling by some factor\n"
|
||||||
|
"\n"
|
||||||
|
"@args f\n"
|
||||||
|
"\n"
|
||||||
|
"Scales object in place. All coordinates are multiplied with the given factor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
|
method_ext ("/", ÷,
|
||||||
|
"@brief Division by some divisor\n"
|
||||||
|
"\n"
|
||||||
|
"@args d\n"
|
||||||
|
"\n"
|
||||||
|
"Returns the scaled object. All coordinates are divided with the given divisor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
|
method_ext ("/=", &idiv,
|
||||||
|
"@brief Division by some divisor\n"
|
||||||
|
"\n"
|
||||||
|
"@args d\n"
|
||||||
|
"\n"
|
||||||
|
"Divides the object in place. All coordinates are divided with the given divisor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
method ("distance", (double (C::*) (const C &) const) &C::double_distance,
|
method ("distance", (double (C::*) (const C &) const) &C::double_distance,
|
||||||
"@brief The Euclidian distance to another point\n"
|
"@brief The Euclidian distance to another point\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,23 @@ struct vector_defs
|
||||||
return C (*p * s);
|
return C (*p * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static C divide (const C *p, double s)
|
||||||
|
{
|
||||||
|
return C (*p / s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static C iscale (C *p, double s)
|
||||||
|
{
|
||||||
|
*p *= s;
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static C idiv (C *p, double s)
|
||||||
|
{
|
||||||
|
*p /= s;
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
static C negate (const C *p)
|
static C negate (const C *p)
|
||||||
{
|
{
|
||||||
return -*p;
|
return -*p;
|
||||||
|
|
@ -202,6 +219,30 @@ struct vector_defs
|
||||||
"Returns the scaled object. All coordinates are multiplied with the given factor and if "
|
"Returns the scaled object. All coordinates are multiplied with the given factor and if "
|
||||||
"necessary rounded."
|
"necessary rounded."
|
||||||
) +
|
) +
|
||||||
|
method_ext ("*=", &iscale,
|
||||||
|
"@brief Scaling by some factor\n"
|
||||||
|
"\n"
|
||||||
|
"@args f\n"
|
||||||
|
"\n"
|
||||||
|
"Scales object in place. All coordinates are multiplied with the given factor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
|
method_ext ("/", ÷,
|
||||||
|
"@brief Division by some divisor\n"
|
||||||
|
"\n"
|
||||||
|
"@args d\n"
|
||||||
|
"\n"
|
||||||
|
"Returns the scaled object. All coordinates are divided with the given divisor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
|
method_ext ("/=", &idiv,
|
||||||
|
"@brief Division by some divisor\n"
|
||||||
|
"\n"
|
||||||
|
"@args d\n"
|
||||||
|
"\n"
|
||||||
|
"Divides the object in place. All coordinates are divided with the given divisor and if "
|
||||||
|
"necessary rounded."
|
||||||
|
) +
|
||||||
method_ext ("vprod", &vprod,
|
method_ext ("vprod", &vprod,
|
||||||
"@brief Computes the vector product between self and the given vector\n"
|
"@brief Computes the vector product between self and the given vector\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,11 @@ static std::string extract_python_name (const std::string &name)
|
||||||
} else if (name == "-@") {
|
} else if (name == "-@") {
|
||||||
return "__neg__";
|
return "__neg__";
|
||||||
} else if (name == "/") {
|
} else if (name == "/") {
|
||||||
|
#if PY_MAJOR_VERSION < 3
|
||||||
return "__div__";
|
return "__div__";
|
||||||
|
#else
|
||||||
|
return "__truediv__";
|
||||||
|
#endif
|
||||||
} else if (name == "*") {
|
} else if (name == "*") {
|
||||||
return "__mul__";
|
return "__mul__";
|
||||||
} else if (name == "%") {
|
} else if (name == "%") {
|
||||||
|
|
@ -515,7 +519,11 @@ static std::string extract_python_name (const std::string &name)
|
||||||
} else if (name == "-=") {
|
} else if (name == "-=") {
|
||||||
return "__isub__";
|
return "__isub__";
|
||||||
} else if (name == "/=") {
|
} else if (name == "/=") {
|
||||||
|
#if PY_MAJOR_VERSION < 3
|
||||||
return "__idiv__";
|
return "__idiv__";
|
||||||
|
#else
|
||||||
|
return "__itruediv__";
|
||||||
|
#endif
|
||||||
} else if (name == "*=") {
|
} else if (name == "*=") {
|
||||||
return "__imul__";
|
return "__imul__";
|
||||||
} else if (name == "%=") {
|
} else if (name == "%=") {
|
||||||
|
|
@ -2698,6 +2706,11 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
add_python_doc (*c, mt, mid, tl::to_string (tr ("This method enables iteration of the object")));
|
add_python_doc (*c, mt, mid, tl::to_string (tr ("This method enables iteration of the object")));
|
||||||
alt_names.push_back ("__iter__");
|
alt_names.push_back ("__iter__");
|
||||||
|
|
||||||
|
} else if (name == "__mul__") {
|
||||||
|
// Adding right multiplication
|
||||||
|
// Rationale: if pyaObj * x works, so should x * pyaObj
|
||||||
|
add_python_doc (*c, mt, mid, tl::to_string (tr ("This method is also available as '__mul__'")));
|
||||||
|
alt_names.push_back ("__rmul__");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector <std::string>::const_iterator an = alt_names.begin (); an != alt_names.end (); ++an) {
|
for (std::vector <std::string>::const_iterator an = alt_names.begin (); an != alt_names.end (); ++an) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "tlThreads.h"
|
#include "tlThreads.h"
|
||||||
#include "tlUtils.h"
|
#include "tlUtils.h"
|
||||||
|
#include "tlTimer.h"
|
||||||
#include "tlLog.h"
|
#include "tlLog.h"
|
||||||
#include "tlInternational.h"
|
#include "tlInternational.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "tlTimer.h"
|
#include "tlTimer.h"
|
||||||
#include "tlUtils.h"
|
|
||||||
#include "tlLog.h"
|
#include "tlLog.h"
|
||||||
#include "tlString.h"
|
#include "tlString.h"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue