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
e4830940
Commit
e4830940
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
generate MANIFEST from the output of "git ls-files" (less error-prone)
parent
d504d5d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MANIFEST.in
+0
-23
0 additions, 23 deletions
MANIFEST.in
setup.py
+57
-4
57 additions, 4 deletions
setup.py
with
57 additions
and
27 deletions
MANIFEST.in
deleted
100644 → 0
+
0
−
23
View file @
d504d5d8
# This file specifies the files to be included in the source distribution
# in addition to the default ones.
include MANIFEST.in
include INSTALL LICENSE AUTHORS ACKNOWLEDGEMENTS TODO README_WINDOWS.txt
# We explicitly include both pyx and c files, so that both are shipped in
# source tarballs independently of whether "setup.py sdist" is run with
# --no-cython or not.
recursive-include kwant *.pyx
recursive-include kwant *.pxd
recursive-include kwant *.c
recursive-include kwant *.h
recursive-include examples *.py
include doc/other/*[a-zA-Z]
include doc/Makefile
recursive-include doc/source *.rst *.py *.svg *.sh *.diff
recursive-include doc/source/_static *[a-zA-Z]
recursive-exclude doc/source/images [a-zA-Z]*.py
recursive-include doc/templates *[a-zA-Z]
prune doc/source/reference/generated
recursive-include doc/sphinxext *.py *.txt *.in
This diff is collapsed.
Click to expand it.
setup.py
+
57
−
4
View file @
e4830940
...
...
@@ -48,6 +48,8 @@ if cythonize and cython_version:
else
:
from
distutils.command.build_ext
import
build_ext
kwant_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
class
kwant_build_ext
(
build_ext
):
def
run
(
self
):
...
...
@@ -96,7 +98,18 @@ class build_tut(Command):
# that the tutorial is present.
class
kwant_build
(
distutils_build
):
sub_commands
=
[(
'
build_tut
'
,
None
)]
+
distutils_build
.
sub_commands
pass
def
git_lsfiles
():
try
:
p
=
subprocess
.
Popen
([
'
git
'
,
'
ls-files
'
],
cwd
=
kwant_dir
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
except
OSError
:
return
if
p
.
wait
()
!=
0
:
return
return
p
.
communicate
()[
0
].
split
(
'
\n
'
)[:
-
1
]
# Make the command "sdist" depend on "build". This verifies that the
...
...
@@ -105,14 +118,54 @@ class kwant_build(distutils_build):
# distribution and that they will be up-to-date.
class
kwant_sdist
(
distutils_sdist
):
sub_commands
=
[(
'
build
'
,
None
)]
+
distutils_sdist
.
sub_commands
pass
def
run
(
self
):
names
=
git_lsfiles
()
trustworthy
=
True
if
names
is
None
:
# Check that MANIFEST exists and has not been generated by
# distutils.
try
:
with
open
(
kwant_dir
+
'
/MANIFEST
'
,
'
r
'
)
as
f
:
line
=
f
.
read
()
except
IOError
:
print
>>
sys
.
stderr
,
"
error: MANIFEST file is missing and
"
\
"
Git is not available to regenerate it.
"
exit
(
1
)
trustworthy
=
not
line
.
strip
().
startswith
(
'
#
'
)
else
:
# Generate MANIFEST file.
with
open
(
kwant_dir
+
'
/MANIFEST
'
,
'
w
'
)
as
f
:
for
name
in
names
:
a
,
sep
,
b
=
name
.
rpartition
(
'
/
'
)
if
b
==
'
.gitignore
'
:
continue
stem
,
dot
,
extension
=
b
.
rpartition
(
'
.
'
)
if
extension
==
'
pyx
'
:
f
.
write
(
''
.
join
([
a
,
sep
,
stem
,
dot
,
'
c
'
,
'
\n
'
]))
f
.
write
(
name
+
'
\n
'
)
f
.
write
(
STATIC_VERSION_FILE
+
'
\n
'
)
f
.
write
(
'
MANIFEST
'
)
distutils_sdist
.
run
(
self
)
if
names
is
None
:
print
>>
sys
.
stderr
,
\
"""
**************** Warning ****************
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.
"""
if
not
trustworthy
:
print
>>
sys
.
stderr
,
\
"""
**************** Warning ****************
The existing MANIFEST file seems to have been generated by distutils (it begins
with a comment). It may well be incomplete.
"""
# This is an exact copy of the function from kwant/version.py. We can't import
# it here (because kwant is not yet built when this scipt is run), so we just
# include a copy.
def
get_version_from_git
():
kwant_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
try
:
p
=
subprocess
.
Popen
([
'
git
'
,
'
describe
'
],
cwd
=
kwant_dir
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
...
...
@@ -297,7 +350,7 @@ def ext_modules(extensions):
for
f
in
cythonized_files
)
except
OSError
:
print
>>
sys
.
stderr
,
\
"
E
rror: Cython-generated file {0} is missing.
"
.
format
(
f
)
"
e
rror: 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.
"
...
...
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