summaryrefslogtreecommitdiff
path: root/py/lexerunix.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-05 21:27:05 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-05 21:27:05 +0000
commitcdcb4906d41f42789f6610047e8ae6aa79a61e47 (patch)
tree099453009838e4ba11de4a32cda89f076dc20256 /py/lexerunix.c
parentb8ec17c2d16407dd186d1f8f76c1e7c420bb7729 (diff)
parent911089606376e60bd9451a85eb9558a23cde9039 (diff)
Merge pull request #262 from pfalcon/sys-path
Implement sys.path support
Diffstat (limited to 'py/lexerunix.c')
-rw-r--r--py/lexerunix.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/py/lexerunix.c b/py/lexerunix.c
index 5d96c468f..fb62d3d72 100644
--- a/py/lexerunix.c
+++ b/py/lexerunix.c
@@ -14,7 +14,6 @@
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
int fd = open(filename, O_RDONLY);
if (fd < 0) {
- printf("cannot open file %s\n", filename);
return NULL;
}
uint size = lseek(fd, 0, SEEK_END);
@@ -31,24 +30,4 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
return mp_lexer_new_from_str_len(qstr_from_str(filename), data, size, size);
}
-/******************************************************************************/
-/* unix implementation of import */
-
-// TODO properly!
-
-static const char *import_base_dir = NULL;
-
-void mp_import_set_directory(const char *dir) {
- import_base_dir = dir;
-}
-
-mp_lexer_t *mp_import_open_file(qstr mod_name) {
- vstr_t *vstr = vstr_new();
- if (import_base_dir != NULL) {
- vstr_printf(vstr, "%s/", import_base_dir);
- }
- vstr_printf(vstr, "%s.py", qstr_str(mod_name));
- return mp_lexer_new_from_file(vstr_str(vstr)); // TODO does lexer need to copy the string? can we free it here?
-}
-
#endif // MICROPY_ENABLE_LEXER_UNIX