Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
2a204e57
Commit
2a204e57
authored
Jun 10, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction to checkWIP
parent
6ef0d143
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
+49
-2
dream/simulation/readWip.py
dream/simulation/readWip.py
+49
-2
No files found.
dream/simulation/readWip.py
View file @
2a204e57
...
...
@@ -40,7 +40,8 @@ def checkWIP():
nodes
=
json_data
[
'nodes'
]
# read from the dictionary the dicts with key 'nodes'
for
(
element_id
,
element
)
in
nodes
.
iteritems
():
wip
=
element
.
get
(
'wip'
,
[])
totalWip
.
append
(
wip
)
if
wip
:
totalWip
.
append
(
wip
)
return
len
(
totalWip
)
>
0
...
...
@@ -48,7 +49,53 @@ class WIPreadError(Exception):
"""Exception raised for errors in the WIP.
"""
def
__init__
(
self
,
msg
):
Exception
.
__init__
(
self
,
msg
)
Exception
.
__init__
(
self
,
msg
)
def
findFile
(
seekName
,
path
,
implicitExt
=
''
):
""" Given a pathsep-delimited path string, find seekName.
Returns path to seekName if found, otherwise None.
Also allows for files with implicit extensions (eg, .exe), but
always returning seekName as was provided
>>> findFile('ls', '/usr/bin:/bin', implicit='.exe')
'bin/ls'
"""
if
(
os
.
path
.
isfile
(
seekName
)
or
implicitExt
and
os
.
path
.
isfile
(
seekName
+
implicitExt
)):
# alrady absolut path.
return
seekname
for
p
in
path
.
split
(
os
.
pathsep
):
candidate
=
os
.
path
.
join
(
p
,
seekName
)
if
(
os
.
path
.
isfile
(
candidate
)
or
implicitExt
and
os
.
path
.
isfile
(
candidate
+
implicitExt
)):
return
candidate
return
None
def
SearchPath
(
name
,
path
=
None
,
exts
=
(
''
,)):
"""Search PATH for a binary.
Args:
name: the filename to search for
path: the optional path string (default: os.environ['PATH')
exts: optional list/tuple of extensions to try (default: ('',))
Returns:
The abspath to the binary or None if not found.
"""
path
=
path
or
os
.
environ
[
'PATH'
]
for
dir
in
path
.
split
(
os
.
pathsep
):
for
ext
in
exts
:
binpath
=
os
.
path
.
join
(
dir
,
name
)
+
os
.
extsep
+
ext
if
os
.
path
.
exists
(
binpath
):
return
os
.
abspath
(
binpath
)
return
None
def
GetOSPath
():
immediate
=
os
.
curdir
+
os
.
pathsep
+
os
.
pardir
+
os
.
pathsep
ospath
=
os
.
getenv
(
'PATH'
,
os
.
defpath
)
path
=
immediate
+
ospath
return
path
.
split
(
os
.
pathsep
)
def
requestJSON
():
file
=
findFile
(
'testJSON'
,
'usr/workspace/DreamGit/dream/dream/simulation'
,
'json'
)
print
file
return
file
def
getOrders
():
''' run the method from KEtool to read the orders'''
...
...
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