mirror of https://github.com/KLayout/klayout.git
Bugfix: strmrun issues
- strmrun did not support x[rb] notation for file type - x.y.py was rejected because y.py was taken as the suffix - reason was extension() function for which there is an extension_last() now - but this function is no longer used as the lym::Macro object is used now
This commit is contained in:
parent
56f6143e4f
commit
252b1551dc
|
|
@ -31,9 +31,9 @@ HEADERS = \
|
|||
|
||||
RESOURCES = \
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$VERSION_INC $$DB_INC $$LIB_INC $$RDB_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$VERSION_INC $$DB_INC $$LIB_INC $$RDB_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_lib -lklayout_rdb
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$VERSION_INC $$DB_INC $$LIB_INC $$RDB_INC $$LYM_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$VERSION_INC $$DB_INC $$LIB_INC $$RDB_INC $$LYM_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_lib -lklayout_rdb -lklayout_lym
|
||||
|
||||
INCLUDEPATH += $$RBA_INC
|
||||
DEPENDPATH += $$RBA_INC
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "gsiExpression.h"
|
||||
#include "libForceLink.h"
|
||||
#include "rdbForceLink.h"
|
||||
#include "lymMacro.h"
|
||||
|
||||
struct RunnerData
|
||||
{
|
||||
|
|
@ -92,14 +93,7 @@ BD_PUBLIC int strmrun (int argc, char *argv[])
|
|||
|
||||
std::string script = tl::absolute_file_path (data.script);
|
||||
|
||||
std::string ext = tl::extension (data.script);
|
||||
if (ext == "py") {
|
||||
python.load_file (script);
|
||||
} else if (ext == "rb") {
|
||||
ruby.load_file (script);
|
||||
} else {
|
||||
throw tl::Exception (tl::to_string (tr ("Unknown suffix \"%s\" - must be either .rb or .py")), ext);
|
||||
}
|
||||
|
||||
return 0;
|
||||
lym::Macro macro;
|
||||
macro.load_from (script);
|
||||
return macro.run ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,6 +308,16 @@ std::string extension (const std::string &s)
|
|||
return tl::join (fnp, ".");
|
||||
}
|
||||
|
||||
std::string extension_last (const std::string &s)
|
||||
{
|
||||
std::vector<std::string> fnp = split_filename (filename (s));
|
||||
if (fnp.size () > 1) {
|
||||
return fnp.back ();
|
||||
} else {
|
||||
return std::string ();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
is_parent_path (const std::string &parent, const std::string &path)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@ std::string TL_PUBLIC basename (const std::string &s);
|
|||
*/
|
||||
std::string TL_PUBLIC extension (const std::string &s);
|
||||
|
||||
/**
|
||||
* @brief Gets the last extension for a given file path
|
||||
*/
|
||||
std::string TL_PUBLIC extension_last (const std::string &s);
|
||||
|
||||
/**
|
||||
* @brief Returns true, if the given path exists
|
||||
* If the path is a directory, file_exists will return true, if the directory exists.
|
||||
|
|
|
|||
|
|
@ -391,6 +391,13 @@ TEST (10)
|
|||
EXPECT_EQ (tl::extension ("\\hello\\.world.gz"), "gz");
|
||||
EXPECT_EQ (tl::extension ("/hello//world/"), "");
|
||||
|
||||
EXPECT_EQ (tl::extension_last ("/hello/world"), "");
|
||||
EXPECT_EQ (tl::extension_last ("/hello/world.tar"), "tar");
|
||||
EXPECT_EQ (tl::extension_last ("/hello/world.tar.gz"), "gz");
|
||||
EXPECT_EQ (tl::extension_last ("\\hello\\.world"), "");
|
||||
EXPECT_EQ (tl::extension_last ("\\hello\\.world.gz"), "gz");
|
||||
EXPECT_EQ (tl::extension_last ("/hello//world/"), "");
|
||||
|
||||
EXPECT_EQ (tl::is_absolute ("world"), false);
|
||||
EXPECT_EQ (tl::is_absolute ("world/"), false);
|
||||
EXPECT_EQ (tl::is_absolute ("hello//world/"), false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue