Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
ed24d550
Commit
ed24d550
authored
Aug 26, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and fix copy(), and renamed it to copytree()
parent
77828dd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
22 deletions
+19
-22
slapos/recipe/build.py
slapos/recipe/build.py
+19
-22
No files found.
slapos/recipe/build.py
View file @
ed24d550
...
@@ -40,7 +40,6 @@ ARCH_MAP = {
...
@@ -40,7 +40,6 @@ ARCH_MAP = {
'x86_64'
:
'x86-64'
'x86_64'
:
'x86-64'
}
}
def
readElfAsDict
(
f
):
def
readElfAsDict
(
f
):
"""Reads ELF information from file"""
"""Reads ELF information from file"""
popen
=
subprocess
.
Popen
([
'readelf'
,
'-d'
,
f
],
popen
=
subprocess
.
Popen
([
'readelf'
,
'-d'
,
f
],
...
@@ -165,27 +164,25 @@ class Script:
...
@@ -165,27 +164,25 @@ class Script:
self
.
cleanup_dir_list
.
append
(
extract_dir
)
self
.
cleanup_dir_list
.
append
(
extract_dir
)
return
extract_dir
return
extract_dir
def
copy
(
self
,
origin
,
destination
,
ignore_dir_list
=
[]):
def
copytree
(
self
,
origin
,
destination
,
overwrite
=
False
,
ignore_dir_list
=
[]):
"""Copy directory.
"""Recursively Copy directory. if "overwrite" is set to False, will stop if
"""
destination already exists. ignore_dir_list is an array of directories
if
os
.
path
.
exists
(
destination
):
you want to exclude.
self
.
logger
.
info
(
'No need to re-install java part'
)
Example : copytree("/from", "/to", overwrite=True, ignore_dir_list=["a_private_dir"])
return
False
"""
self
.
logger
.
info
(
"Copying unpacked contents"
)
if
os
.
path
.
exists
(
destination
)
and
not
overwrite
:
java_dir
=
''
self
.
logger
.
info
(
'Destination already exists, aborting.'
)
if
'ignore'
in
shutil
.
copytree
.
func_code
.
co_varnames
:
return
False
shutil
.
copytree
(
os
.
path
.
join
(
origin
,
java_dir
),
self
.
logger
.
info
(
"Copying %s to %s"
%
(
origin
,
destination
))
destination
,
try
:
ignore
=
lambda
src
,
names
:
ignore_dir_list
)
shutil
.
copytree
(
origin
,
destination
,
else
:
ignore
=
lambda
src
,
names
:
ignore_dir_list
)
shutil
.
copytree
(
origin
,
except
shutil
.
Error
:
destination
)
self
.
logger
.
error
(
"Error occurred : %s"
)
for
ignore_dir
in
ignore_dir_list
:
shutil
.
rmtree
(
destination
)
ignore_dir
=
os
.
path
.
join
(
destination
,
ignore_dir
)
return
False
if
os
.
path
.
exists
(
ignore_dir
):
return
True
shutil
.
rmtree
(
ignore_dir
)
return
True
script
=
'raise NotImplementedError'
script
=
'raise NotImplementedError'
def
__init__
(
self
,
buildout
,
name
,
options
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
cleanup_dir_list
=
[]
self
.
cleanup_dir_list
=
[]
...
...
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