mirror of https://github.com/KLayout/klayout.git
Simplify pymod test for better CI integration
This commit is contained in:
parent
2166437480
commit
0fd052baa6
|
|
@ -20,6 +20,11 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "tlUnitTest.h"
|
||||
#include "tlStream.h"
|
||||
#include "tlFileUtils.h"
|
||||
#include "tlEnv.h"
|
||||
|
||||
// Oh my god ... STRINGIFY(s) will get the argument with MACROS REPLACED.
|
||||
// So if the PYTHONPATH is something like build.linux-released, the "linux" macro
|
||||
// set to 1 will make this "build.1-release". So STRINGIFY isn't a real solution.
|
||||
|
|
@ -30,22 +35,11 @@
|
|||
#define STRINGIFY(s) _STRINGIFY(s)
|
||||
#define _STRINGIFY(s) #s
|
||||
|
||||
#include "tlUnitTest.h"
|
||||
#include "tlStream.h"
|
||||
|
||||
int run_pymodtest (tl::TestBase *_this, const std::string &fn)
|
||||
{
|
||||
static std::string pypath;
|
||||
if (pypath.empty ()) {
|
||||
pypath = "PYTHONPATH=";
|
||||
pypath += STRINGIFY (PYTHONPATH);
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
_putenv (const_cast<char *> (pypath.c_str ()));
|
||||
#else
|
||||
putenv (const_cast<char *> (pypath.c_str ()));
|
||||
#endif
|
||||
tl::info << pypath;
|
||||
static std::string pypath = tl::combine_path (tl::get_inst_path (), "pymod");
|
||||
tl::info << "PYTHONPATH=" << pypath;
|
||||
tl::set_env ("PYTHONPATH", pypath);
|
||||
|
||||
std::string fp (tl::testdata ());
|
||||
fp += "/pymod/";
|
||||
|
|
|
|||
|
|
@ -14,20 +14,14 @@ msvc {
|
|||
# "\\\\" is actually *one* backslash for replacement string and *two* backslashes in the
|
||||
# substitution string in qmake ... so we replace \ by \\ here:
|
||||
PYTHON_ESCAPED = $$replace(PYTHON, "\\\\", "\\\\")
|
||||
PYTHONPATH = $$shell_path($$DESTDIR_UT/pymod)
|
||||
PYTHONPATH_ESCAPED = $$replace(PYTHONPATH, "\\\\", "\\\\")
|
||||
|
||||
QMAKE_CXXFLAGS += \
|
||||
"-DPYTHON=\"$$PYTHON_ESCAPED\"" \
|
||||
"-DPYTHONPATH=\"$$PYTHONPATH_ESCAPED\""
|
||||
"-DPYTHON=\"$$PYTHON_ESCAPED\""
|
||||
|
||||
} else {
|
||||
|
||||
PYTHONPATH = $$DESTDIR_UT/pymod
|
||||
|
||||
DEFINES += \
|
||||
PYTHON=$$PYTHON \
|
||||
PYTHONPATH=$$PYTHONPATH
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -908,11 +908,11 @@ get_inst_path ()
|
|||
std::string
|
||||
get_exe_file ()
|
||||
{
|
||||
static std::string s_inst_path;
|
||||
if (s_inst_path.empty ()) {
|
||||
s_inst_path = tl::absolute_file_path (get_inst_path_internal ());
|
||||
static std::string s_exe_file;
|
||||
if (s_exe_file.empty ()) {
|
||||
s_exe_file = tl::absolute_file_path (get_inst_path_internal ());
|
||||
}
|
||||
return s_inst_path;
|
||||
return s_exe_file;
|
||||
}
|
||||
|
||||
std::string
|
||||
|
|
|
|||
Loading…
Reference in New Issue