Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Managetests
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Managetests
Commits
1c3a6d1a
Commit
1c3a6d1a
authored
Mar 02, 2019
by
Mattia Rizzolo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make possible to start without version file
Signed-off-by:
Mattia Rizzolo
<
mattia@debian.org
>
parent
cd25203c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
managetests/utils.py
managetests/utils.py
+22
-6
No files found.
managetests/utils.py
View file @
1c3a6d1a
...
...
@@ -29,9 +29,27 @@ def is_root_valid(path):
print
(
")he specified root directory doesn't exist, please create it."
)
return
False
required_files
=
[
"config.json"
,
"details.json"
,
"version"
]
# version file
file
=
path
/
'version'
if
not
file
.
exists
():
if
not
(
path
/
'branches'
).
exists
()
and
not
(
path
/
'details.json'
).
exists
():
print
(
'No version file found, and this seems an empty root, creating'
)
with
open
(
file
,
'w'
)
as
f
:
f
.
write
(
ROOT_DIR_VERSION
)
else
:
print
(
'Non-empty root missing version file.'
)
return
False
elif
not
file
.
is_file
():
print
(
'There is a version non-file conflicting with the expectations.'
)
return
False
else
:
with
open
(
file
)
as
f
:
ver
=
f
.
read
().
strip
()
if
ver
!=
ROOT_DIR_VERSION
:
print
(
'Found wrong version '
,
ver
)
return
False
#
make sure a branches directory is available:
#
branches directory
dir
=
path
/
'branches'
if
not
dir
.
exists
():
print
(
'Creating the branches directory...'
)
...
...
@@ -40,14 +58,12 @@ def is_root_valid(path):
print
(
'There is a branches file conflicting with the expected directory'
)
return
False
# TODO make possible to start without these two files
required_files
=
[
"config.json"
,
"details.json"
]
for
file
in
required_files
:
file
=
path
/
file
if
not
(
file
.
exists
()
and
file
.
is_file
()):
print
(
"The required file %s does not exist"
%
file
)
return
False
with
(
path
/
"version"
).
open
(
"r"
)
as
f
:
if
f
.
read
().
strip
()
!=
ROOT_DIR_VERSION
:
return
False
return
True
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