Show More
@@ -107,6 +107,18 b' class CythonMagics(Magics):' | |||
|
107 | 107 | |
|
108 | 108 | @magic_arguments() |
|
109 | 109 | @argument( |
|
110 | '-c', '--compile-args', action='append', default=[], | |
|
111 | help="Extra flag to pass to compiler via the `extra_compile_args` Extension flag (can be called multiple times)." | |
|
112 | ) | |
|
113 | @argument( | |
|
114 | '-l', '--lib', action='append', default=[], | |
|
115 | help="Add a library to link the extension against (can be called multiple times)." | |
|
116 | ) | |
|
117 | @argument( | |
|
118 | '-i', '--include', action='append', default=[], | |
|
119 | help="Add a path to the list of include directories (can be called multiple times)." | |
|
120 | ) | |
|
121 | @argument( | |
|
110 | 122 | '-f', '--force', action='store_true', default=False, |
|
111 | 123 | help="Force the compilation of the pyx module even if it hasn't changed" |
|
112 | 124 | ) |
@@ -127,10 +139,10 b' class CythonMagics(Magics):' | |||
|
127 | 139 | """ |
|
128 | 140 | args = parse_argstring(self.cython, line) |
|
129 | 141 | code = cell if cell.endswith('\n') else cell+'\n' |
|
130 | lib_dir=os.path.join(self.shell.ipython_dir, 'cython') | |
|
131 | cython_include_dirs=['.'] | |
|
132 | force=args.force | |
|
133 | quiet=True | |
|
142 | lib_dir = os.path.join(self.shell.ipython_dir, 'cython') | |
|
143 | cython_include_dirs = ['.'] | |
|
144 | force = args.force | |
|
145 | quiet = True | |
|
134 | 146 | ctx = Context(cython_include_dirs, default_options) |
|
135 | 147 | key = code, sys.version_info, sys.executable, Cython.__version__ |
|
136 | 148 | module_name = "_cython_magic_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() |
@@ -141,8 +153,7 b' class CythonMagics(Magics):' | |||
|
141 | 153 | os.makedirs(lib_dir) |
|
142 | 154 | |
|
143 | 155 | if force or not os.path.isfile(module_path): |
|
144 | cflags = [] | |
|
145 | c_include_dirs = [] | |
|
156 | c_include_dirs = args.include | |
|
146 | 157 | if 'numpy' in code: |
|
147 | 158 | import numpy |
|
148 | 159 | c_include_dirs.append(numpy.get_include()) |
@@ -154,7 +165,8 b' class CythonMagics(Magics):' | |||
|
154 | 165 | name = module_name, |
|
155 | 166 | sources = [pyx_file], |
|
156 | 167 | include_dirs = c_include_dirs, |
|
157 |
extra_compile_args = |
|
|
168 | extra_compile_args = args.compile_args, | |
|
169 | libraries = args.lib, | |
|
158 | 170 | ) |
|
159 | 171 | dist = Distribution() |
|
160 | 172 | config_files = dist.find_config_files() |
General Comments 0
You need to be logged in to leave comments.
Login now