diff options
author | Thomas Krennwallner <tk+github@postsubmeta.net> | 2019-04-13 15:16:54 +0200 |
---|---|---|
committer | Eli Bendersky <eliben@users.noreply.github.com> | 2019-04-13 06:16:54 -0700 |
commit | 1c6fbab46ef9ef1397a66391d5e5af0487fcaebd (patch) | |
tree | 4195306cf6a8c9791216d022c40571a58fc2580c | |
parent | e1a1d737be66308b633215fa26ac5ed30e890103 (diff) | |
download | pycparser-1c6fbab46ef9ef1397a66391d5e5af0487fcaebd.tar.gz |
Insert '.' and '..' to sys.path before import statements (#321)
Restricted environments like embeddable python do not include the
current working directory on startup.
-rw-r--r-- | pycparser/_build_tables.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pycparser/_build_tables.py b/pycparser/_build_tables.py index 94a3891..958381a 100644 --- a/pycparser/_build_tables.py +++ b/pycparser/_build_tables.py @@ -10,13 +10,17 @@ # License: BSD #----------------------------------------------------------------- +# Insert '.' and '..' as first entries to the search path for modules. +# Restricted environments like embeddable python do not include the +# current working directory on startup. +import sys +sys.path[0:0] = ['.', '..'] + # Generate c_ast.py from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) -import sys -sys.path[0:0] = ['.', '..'] from pycparser import c_parser # Generates the tables |