Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Seblu
installsystems
Commits
92bcc28c
Commit
92bcc28c
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Fix stupid errors in tools module
parent
819589d8
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
installsystems/tools.py
+7
-4
7 additions, 4 deletions
installsystems/tools.py
with
7 additions
and
4 deletions
installsystems/tools.py
+
7
−
4
View file @
92bcc28c
...
...
@@ -8,6 +8,7 @@ InstallSystems Generic Tools Library
import
os
import
hashlib
import
shutil
def
md5sum
(
path
):
'''
Compute md5 of a file
'''
...
...
@@ -17,12 +18,14 @@ def md5sum(path):
def
cp
(
source
,
destination
):
'''
Copy a source to destination. Take care of path type
'''
stype
=
path_type
(
source
)
dtype
=
path_type
(
destination
)
stype
=
get_
path_type
(
source
)
dtype
=
get_
path_type
(
destination
)
if
stype
==
dtype
==
"
file
"
:
shutil
.
copy
(
source
,
destination
)
elif
stype
==
"
file
"
and
dtype
==
""
:
pass
raise
NotImplementedError
else
:
raise
NotImplementedError
def
get_path_type
(
path
):
'''
Return path type. This is usefull to know what king of path is given
'''
...
...
@@ -31,7 +34,7 @@ def get_path_type(path):
return
"
http
"
elif
path
.
startswith
(
"
ssh://
"
):
return
"
ssh
"
elif
path
.
startswith
(
"
file://
"
)
or
os
.
path
.
exists
(
path
):
elif
path
.
startswith
(
"
file://
"
)
or
path
.
startswith
(
"
/
"
)
or
os
.
path
.
exists
(
path
):
return
"
file
"
elif
Image
.
check_image_name
(
path
):
return
"
name
"
...
...
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