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
940a65ed
Commit
940a65ed
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
merge script listing in function select_scripts
parent
ce761277
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/image.py
+19
-23
19 additions, 23 deletions
installsystems/image.py
with
19 additions
and
23 deletions
installsystems/image.py
+
19
−
23
View file @
940a65ed
...
...
@@ -326,23 +326,13 @@ class SourceImage(Image):
ti
.
uname
=
ti
.
gname
=
"
root
"
tarball
.
addfile
(
ti
)
# adding each file
for
fi
in
sorted
(
os
.
listdir
(
directory
)):
fp
=
os
.
path
.
join
(
directory
,
fi
)
# check name
if
not
re
.
match
(
"
\d+-.*\.py$
"
,
fi
):
debug
(
"
%s skipped: invalid name
"
%
fi
)
continue
# check execution bit
if
not
os
.
access
(
fp
,
os
.
X_OK
):
debug
(
"
%s skipped: not executable
"
%
fi
)
continue
# adding file
ti
=
tarball
.
gettarinfo
(
fp
,
arcname
=
os
.
path
.
join
(
basedirectory
,
fi
))
for
fp
,
fn
in
self
.
select_scripts
(
directory
):
ti
=
tarball
.
gettarinfo
(
fp
,
arcname
=
os
.
path
.
join
(
basedirectory
,
fn
))
ti
.
mode
=
0755
ti
.
uid
=
ti
.
gid
=
0
ti
.
uname
=
ti
.
gname
=
"
root
"
tarball
.
addfile
(
ti
,
open
(
fp
,
"
rb
"
))
arrow
(
"
%s added
"
%
f
i
)
arrow
(
"
%s added
"
%
f
n
)
arrowlevel
(
-
1
)
def
check_scripts
(
self
,
directory
):
...
...
@@ -353,21 +343,27 @@ class SourceImage(Image):
arrow
(
"
Checking %s scripts
"
%
basedirectory
)
arrowlevel
(
1
)
# checking each file
for
fi
in
sorted
(
os
.
listdir
(
directory
)):
fp
=
os
.
path
.
join
(
directory
,
fi
)
for
fp
,
fn
in
self
.
select_scripts
(
directory
):
# compiling file
fs
=
open
(
fp
,
"
r
"
).
read
()
compile
(
fs
,
fp
,
mode
=
"
exec
"
)
arrow
(
fn
)
arrowlevel
(
-
1
)
def
select_scripts
(
self
,
directory
):
'''
Select script with are allocatable in a directory
'''
for
fn
in
sorted
(
os
.
listdir
(
directory
)):
fp
=
os
.
path
.
join
(
directory
,
fn
)
# check name
if
not
re
.
match
(
"
\d+-.*\.py$
"
,
fi
):
debug
(
"
%s skipped: invalid name
"
%
fp
)
if
not
re
.
match
(
"
\d+-.*\.py$
"
,
fn
):
continue
# check execution bit
if
not
os
.
access
(
fp
,
os
.
X_OK
):
debug
(
"
%s skipped: not executable
"
%
fp
)
continue
# compiling file
fs
=
open
(
fp
,
"
r
"
).
read
()
compile
(
fs
,
fp
,
mode
=
"
exec
"
)
arrow
(
fi
)
arrowlevel
(
-
1
)
# yield complet filepath and only script name
yield
fp
,
fn
def
generate_json_description
(
self
,
payloads
):
'''
...
...
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