Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
b96728fc
Commit
b96728fc
authored
Apr 11, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support passing options to the compiler in cythonrun
parent
cfbae1d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
10 deletions
+31
-10
bin/cythonrun
bin/cythonrun
+31
-10
No files found.
bin/cythonrun
View file @
b96728fc
...
...
@@ -28,10 +28,21 @@ LINKFORSHARED = sysconfig.get_config_var('LINKFORSHARED')
LIBS
=
sysconfig
.
get_config_var
(
'LIBS'
)
SYSLIBS
=
sysconfig
.
get_config_var
(
'SYSLIBS'
)
if
DEBUG
:
print
(
'INCDIR: %s'
%
INCDIR
)
print
(
'LIBDIR1: %s'
%
LIBDIR1
)
print
(
'LIBDIR2: %s'
%
LIBDIR2
)
print
(
'PYLIB: %s'
%
PYLIB
)
def
runcmd
(
cmd
,
shell
=
True
):
if
shell
:
cmd
=
' '
.
join
(
cmd
)
if
DEBUG
:
print
(
cmd
)
else
:
if
DEBUG
:
print
(
' '
.
join
(
cmd
))
returncode
=
subprocess
.
call
(
cmd
,
shell
=
shell
)
if
returncode
:
sys
.
exit
(
returncode
)
...
...
@@ -43,24 +54,34 @@ def clink(basename):
def
ccompile
(
basename
):
runcmd
([
CC
,
'-c'
,
'-o'
,
basename
+
'.o'
,
basename
+
'.c'
,
'-I'
+
INCDIR
]
+
CFLAGS
.
split
())
def
cycompile
(
input_file
):
def
cycompile
(
input_file
,
options
=
()
):
from
Cython.Compiler
import
Version
,
CmdLine
,
Main
options
,
sources
=
CmdLine
.
parse_command_line
([
'--embed'
,
input_file
])
options
,
sources
=
CmdLine
.
parse_command_line
(
list
(
options
or
())
+
[
'--embed'
,
input_file
])
if
DEBUG
:
print
(
'Using Cython %s to compile %s'
%
(
Version
.
version
,
input_file
))
result
=
Main
.
compile
(
sources
,
options
)
if
result
.
num_errors
>
0
:
sys
.
exit
(
1
)
def
exec_file
(
basename
,
*
args
):
def
exec_file
(
basename
,
args
=
()
):
runcmd
([
os
.
path
.
abspath
(
basename
)]
+
list
(
args
),
shell
=
False
)
def
main
(
input_file
,
*
args
):
def
main
(
args
):
cy_args
=
[]
for
i
,
arg
in
enumerate
(
args
):
if
arg
.
startswith
(
'-'
):
cy_args
.
append
(
arg
)
else
:
input_file
=
arg
args
=
args
[
i
+
1
:]
break
else
:
raise
ValueError
(
'no input file provided'
)
basename
=
os
.
path
.
splitext
(
input_file
)[
0
]
cycompile
(
input_file
)
cycompile
(
input_file
,
cy_args
)
ccompile
(
basename
)
clink
(
basename
)
exec_file
(
basename
)
exec_file
(
basename
,
args
)
if
__name__
==
'__main__'
:
main
(
*
sys
.
argv
[
1
:])
main
(
sys
.
argv
[
1
:])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment