summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-05-30 01:07:18 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-05-30 01:07:58 +0300
commit51726b4d431302d9db94ff55fa04372379f39750 (patch)
tree81c80197cc8438faabfcec0e0bfcb6bf5e622217
parentc02dc8b2c921d19b61d7f930850ea0ce2b5d2709 (diff)
downloadmicropython-51726b4d431302d9db94ff55fa04372379f39750.tar.gz
micropython-51726b4d431302d9db94ff55fa04372379f39750.zip
unix: Allow to override default sys.path value.
Using MICROPY_PY_SYS_PATH_DEFAULT macro define. A usecase is building a distribution package, which should not have user home path by default in sys.path. In such case, MICROPY_PY_SYS_PATH_DEFAULT can be defined on make command-line (using CFLAGS_EXTRA).
-rw-r--r--unix/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/unix/main.c b/unix/main.c
index 1cc174c269..2bdb39efa4 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -297,7 +297,11 @@ int main(int argc, char **argv) {
char *home = getenv("HOME");
char *path = getenv("MICROPYPATH");
if (path == NULL) {
+ #ifdef MICROPY_PY_SYS_PATH_DEFAULT
+ path = MICROPY_PY_SYS_PATH_DEFAULT;
+ #else
path = "~/.micropython/lib:/usr/lib/micropython";
+ #endif
}
mp_uint_t path_num = 1; // [0] is for current dir (or base dir of the script)
for (char *p = path; p != NULL; p = strchr(p, PATHLIST_SEP_CHAR)) {