Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
526f61ae
Commit
526f61ae
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
improve cython error messages; don't continue if cython must be run but it is too old
parent
7ee7b487
No related branches found
Branches containing commit
Tags
v0.1.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+22
-21
22 additions, 21 deletions
setup.py
with
22 additions
and
21 deletions
setup.py
+
22
−
21
View file @
526f61ae
...
...
@@ -367,11 +367,23 @@ def extensions():
return
result
def
complain_cython_unavailable
():
assert
not
cythonize
or
cython_version
<
REQUIRED_CYTHON_VERSION
if
cythonize
:
msg
=
"
Install Cython {0} or newer so it can be made or use a source
"
\
"
distribution of Kwant.
"
ver
=
'
.
'
.
join
(
str
(
e
)
for
e
in
REQUIRED_CYTHON_VERSION
)
print
>>
sys
.
stderr
,
msg
.
format
(
ver
)
else
:
print
>>
sys
.
stderr
,
"
Run setup.py without
"
,
\
NO_CYTHON_OPTION
def
ext_modules
(
extensions
):
"""
Prepare the ext_modules argument for distutils
'
setup.
"""
result
=
[]
for
args
,
kwrds
in
extensions
:
if
not
cythonize
or
not
cython_version
:
if
not
cythonize
or
cython_version
<
REQUIRED_CYTHON_VERSION
:
if
'
language
'
in
kwrds
:
if
kwrds
[
'
language
'
]
==
'
c
'
:
ext
=
'
.c
'
...
...
@@ -399,21 +411,20 @@ def ext_modules(extensions):
except
OSError
:
print
>>
sys
.
stderr
,
\
"
error: Cython-generated file {0} is missing.
"
.
format
(
f
)
if
cythonize
:
print
>>
sys
.
stderr
,
"
Install Cython so it can be made
"
\
"
or use a source distribution of Kwant.
"
else
:
print
>>
sys
.
stderr
,
"
Run setup.py without
"
,
\
NO_CYTHON_OPTION
complain_cython_unavailable
()
exit
(
1
)
for
f
in
pyx_files
+
kwrds
.
get
(
'
depends
'
,
[]):
if
os
.
stat
(
f
).
st_mtime
>
cythonized_oldest
:
msg
=
"
Warning: {0} is newer than its source file,
"
if
cythonize
:
msg
+=
"
but Cython is not installed.
"
msg
=
"
error: {0} is newer than its source file, but
"
if
cythonize
and
not
cython_version
:
msg
+=
"
Cython is not installed.
"
elif
cythonize
:
msg
+=
"
the installed Cython is too old.
"
else
:
msg
+=
"
but
Cython is not to be run.
"
msg
+=
"
Cython is not to be run.
"
print
>>
sys
.
stderr
,
msg
.
format
(
f
)
complain_cython_unavailable
()
exit
(
1
)
result
.
append
(
Extension
(
*
args
,
**
kwrds
))
...
...
@@ -421,16 +432,6 @@ def ext_modules(extensions):
def
main
():
if
cythonize
and
cython_version
<
REQUIRED_CYTHON_VERSION
:
msg
=
'
Warning: Cython {0} is required but
'
if
cython_version
:
msg
+=
'
only {1} is present.
'
else
:
msg
+=
'
it is not installed.
'
print
>>
sys
.
stderr
,
msg
.
format
(
'
.
'
.
join
(
str
(
e
)
for
e
in
REQUIRED_CYTHON_VERSION
),
'
.
'
.
join
(
str
(
e
)
for
e
in
cython_version
))
setup
(
name
=
'
kwant
'
,
version
=
version
(),
author
=
'
C. W. Groth, M. Wimmer, A. R. Akhmerov, X. Waintal, et al.
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment