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
aa7fcf46
Commit
aa7fcf46
authored
9 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
setup.py: make warning and error messages easier to recognize
parent
91a16c18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+17
-11
17 additions, 11 deletions
setup.py
with
17 additions
and
11 deletions
setup.py
+
17
−
11
View file @
aa7fcf46
...
@@ -69,18 +69,21 @@ else:
...
@@ -69,18 +69,21 @@ else:
distr_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
distr_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
def
header
(
title
=
''
):
def
banner
(
title
=
''
):
return
title
.
center
(
79
,
'
*
'
)
starred
=
title
.
center
(
79
,
'
*
'
)
return
'
\n
'
+
starred
if
title
else
starred
error_msg
=
"""
{
sep
}
error_msg
=
"""
{
header
}
The compilation of Kwant has failed. Please examine the error message
The compilation of Kwant has failed. Please examine the error message
above and consult the installation instructions in README.rst.
above and consult the installation instructions in README.rst.
You might have to customize {{file}}.
You might have to customize {{file}}.
{sep}
Build configuration was:
Build configuration was:
{{summary}}
{{summary}}
{sep}
"""
{sep}
error_msg
=
error_msg
.
format
(
sep
=
header
())
"""
error_msg
=
error_msg
.
format
(
header
=
banner
(
'
Error
'
),
sep
=
banner
())
class
kwant_build_ext
(
build_ext
):
class
kwant_build_ext
(
build_ext
):
def
run
(
self
):
def
run
(
self
):
...
@@ -98,8 +101,9 @@ class kwant_build_ext(build_ext):
...
@@ -98,8 +101,9 @@ class kwant_build_ext(build_ext):
print
(
error_msg
.
format
(
file
=
CONFIG_FILE
,
summary
=
build_summary
),
print
(
error_msg
.
format
(
file
=
CONFIG_FILE
,
summary
=
build_summary
),
file
=
sys
.
stderr
)
file
=
sys
.
stderr
)
raise
raise
print
(
head
er
(
'
Build summary
'
))
print
(
bann
er
(
'
Build summary
'
))
print
(
build_summary
)
print
(
build_summary
)
print
(
banner
())
class
build_tut
(
Command
):
class
build_tut
(
Command
):
...
@@ -151,7 +155,7 @@ class test(Command):
...
@@ -151,7 +155,7 @@ class test(Command):
self
.
run_command
(
'
build
'
)
self
.
run_command
(
'
build
'
)
major
,
minor
=
sys
.
version_info
[:
2
]
major
,
minor
=
sys
.
version_info
[:
2
]
lib_dir
=
"
build/lib.{0}-{1}.{2}
"
.
format
(
get_platform
(),
major
,
minor
)
lib_dir
=
"
build/lib.{0}-{1}.{2}
"
.
format
(
get_platform
(),
major
,
minor
)
print
(
header
(
'
Tests
'
)
)
print
()
if
not
run
(
argv
=
[
__file__
,
'
-v
'
,
lib_dir
]):
if
not
run
(
argv
=
[
__file__
,
'
-v
'
,
lib_dir
]):
raise
DistutilsError
(
'
at least one of the tests failed
'
)
raise
DistutilsError
(
'
at least one of the tests failed
'
)
...
@@ -188,7 +192,7 @@ class kwant_sdist(distutils_sdist):
...
@@ -188,7 +192,7 @@ class kwant_sdist(distutils_sdist):
with
open
(
distr_root
+
'
/MANIFEST
'
,
'
r
'
)
as
f
:
with
open
(
distr_root
+
'
/MANIFEST
'
,
'
r
'
)
as
f
:
line
=
f
.
read
()
line
=
f
.
read
()
except
IOError
:
except
IOError
:
print
(
"
e
rror: MANIFEST file is missing and Git is not
"
print
(
"
E
rror: MANIFEST file is missing and Git is not
"
"
available to regenerate it.
"
,
file
=
sys
.
stderr
)
"
available to regenerate it.
"
,
file
=
sys
.
stderr
)
exit
(
1
)
exit
(
1
)
trustworthy
=
not
line
.
strip
().
startswith
(
'
#
'
)
trustworthy
=
not
line
.
strip
().
startswith
(
'
#
'
)
...
@@ -209,15 +213,17 @@ class kwant_sdist(distutils_sdist):
...
@@ -209,15 +213,17 @@ class kwant_sdist(distutils_sdist):
distutils_sdist
.
run
(
self
)
distutils_sdist
.
run
(
self
)
if
names
is
None
:
if
names
is
None
:
print
(
head
er
(
'
Warning
'
),
print
(
bann
er
(
'
Warning
'
),
"""
Git was not available for re-generating the MANIFEST file (the list of file
"""
Git was not available for re-generating the MANIFEST file (the list of file
names to be included in the source distribution). The old MANIFEST was used.
"""
,
names to be included in the source distribution). The old MANIFEST was used.
"""
,
banner
(),
sep
=
'
\n
'
,
file
=
sys
.
stderr
)
sep
=
'
\n
'
,
file
=
sys
.
stderr
)
if
not
trustworthy
:
if
not
trustworthy
:
print
(
head
er
(
'
Warning
'
),
print
(
bann
er
(
'
Warning
'
),
"""
The existing MANIFEST file seems to have been generated by distutils (it begins
"""
The existing MANIFEST file seems to have been generated by distutils (it begins
with a comment). It may well be incomplete.
"""
,
with a comment). It may well be incomplete.
"""
,
banner
(),
sep
=
'
\n
'
,
file
=
sys
.
stderr
)
sep
=
'
\n
'
,
file
=
sys
.
stderr
)
# Other than the "if not use_git" clause in the beginning, this is an exact copy
# Other than the "if not use_git" clause in the beginning, this is an exact copy
...
...
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