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
a215c8cf
Commit
a215c8cf
authored
9 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
simplified version file format
Now we exec _kwant_version.py into a namespace and get the version from that.
parent
b6fcbd03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kwant/_common.py
+4
-7
4 additions, 7 deletions
kwant/_common.py
kwant/_kwant_version.py
+1
-1
1 addition, 1 deletion
kwant/_kwant_version.py
setup.py
+2
-2
2 additions, 2 deletions
setup.py
with
7 additions
and
10 deletions
kwant/_common.py
+
4
−
7
View file @
a215c8cf
...
@@ -68,14 +68,11 @@ def get_version_from_git():
...
@@ -68,14 +68,11 @@ def get_version_from_git():
#
version file contains comments (lines starting with '#')
#
populate the version_info dictionary with values stored in the version file
# followed by the version string on its own on a single line
version_info
=
{}
with
open
(
os
.
path
.
join
(
package_root
,
version_file
),
'
r
'
)
as
f
:
with
open
(
os
.
path
.
join
(
package_root
,
version_file
),
'
r
'
)
as
f
:
cruft
=
"
\"
'
\n\t\r
"
# strip whitespace and quotes
exec
(
f
.
read
(),
{},
version_info
)
line
=
next
(
f
).
strip
(
cruft
)
version
=
version_info
[
'
version
'
]
while
line
.
startswith
(
'
#
'
):
line
=
next
(
f
).
strip
(
cruft
)
version
=
line
version_is_from_git
=
(
version
==
"
__use_git__
"
)
version_is_from_git
=
(
version
==
"
__use_git__
"
)
if
version_is_from_git
:
if
version_is_from_git
:
version
=
get_version_from_git
()
version
=
get_version_from_git
()
...
...
This diff is collapsed.
Click to expand it.
kwant/_kwant_version.py
+
1
−
1
View file @
a215c8cf
# This file will be overwritten by setup.py when a source or binary
# This file will be overwritten by setup.py when a source or binary
# distribution is made. The magic value "__use_git__" is interpreted by
# distribution is made. The magic value "__use_git__" is interpreted by
# _common.py in this directory.
# _common.py in this directory.
"
__use_git__
"
version
=
"
__use_git__
"
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
2
View file @
a215c8cf
...
@@ -173,7 +173,7 @@ def git_lsfiles():
...
@@ -173,7 +173,7 @@ def git_lsfiles():
if
p
.
wait
()
!=
0
:
if
p
.
wait
()
!=
0
:
return
return
return
p
.
communicate
()[
0
].
split
(
'
\n
'
)[:
-
1
]
return
p
.
communicate
()[
0
].
decode
().
split
(
'
\n
'
)[:
-
1
]
# Make the command "sdist" depend on "build". This verifies that the
# Make the command "sdist" depend on "build". This verifies that the
...
@@ -235,7 +235,7 @@ def write_version(fname):
...
@@ -235,7 +235,7 @@ def write_version(fname):
pass
pass
with
open
(
fname
,
'
w
'
)
as
f
:
with
open
(
fname
,
'
w
'
)
as
f
:
f
.
write
(
"
# This file has been created by setup.py.
\n
"
)
f
.
write
(
"
# This file has been created by setup.py.
\n
"
)
f
.
write
(
version
)
f
.
write
(
"
version
=
'
{}
'"
.
format
(
version
)
)
def
long_description
():
def
long_description
():
...
...
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