Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
6
Merge Requests
6
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
slapos.buildout
Commits
8bbb027b
Commit
8bbb027b
authored
May 04, 2017
by
Kazuhiko Shiozaki
Committed by
Julien Muchembled
May 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a wrapper shell script for very long shebang scripts for all installed files.
parent
d59ad5fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+38
-0
No files found.
src/zc/buildout/buildout.py
View file @
8bbb027b
...
@@ -44,6 +44,7 @@ import os
...
@@ -44,6 +44,7 @@ import os
import
pkg_resources
import
pkg_resources
import
re
import
re
import
shutil
import
shutil
import
stat
import
subprocess
import
subprocess
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -213,6 +214,42 @@ def _format_picked_versions(picked_versions, required_by):
...
@@ -213,6 +214,42 @@ def _format_picked_versions(picked_versions, required_by):
output
.
extend
(
required_output
)
output
.
extend
(
required_output
)
return
output
return
output
def
_fix_shebang
(
installed_files
):
is_executable
=
stat
.
S_IXUSR
|
stat
.
S_IXGRP
|
stat
.
S_IXOTH
path_list
=
installed_files
.
splitlines
()
for
path
in
path_list
:
if
os
.
path
.
isdir
(
path
):
file_list
=
[]
for
(
dirpath
,
_
,
filename_list
)
in
os
.
walk
(
path
):
if
dirpath
.
endswith
(
'/EGG-INFO/scripts'
):
# shebang conversion of egg scripts will be done in
# zc.buildout.easy_install.script
continue
for
filename
in
filename_list
:
file_path
=
os
.
path
.
join
(
dirpath
,
filename
)
if
os
.
path
.
isfile
(
file_path
):
file_list
.
append
(
file_path
)
else
:
file_list
=
[
path
]
for
file_path
in
file_list
:
if
file_path
.
endswith
(
'.shebang'
)
or
os
.
path
.
islink
(
file_path
):
continue
st_mode
=
os
.
stat
(
file_path
).
st_mode
if
not
st_mode
&
is_executable
:
continue
header
=
file
(
file_path
).
readline
(
128
)
m
=
re
.
match
(
'^#! ?(/.*)'
,
header
)
if
not
m
or
len
(
header
)
<
128
:
continue
shebang_abspath
=
file_path
+
'.shebang'
os
.
rename
(
file_path
,
shebang_abspath
)
file
(
file_path
,
'w'
).
write
(
'''#!/bin/sh
exec %s "%s.shebang" "$@"
'''
%
(
m
.
groups
()[
0
],
file_path
))
os
.
chmod
(
file_path
,
stat
.
S_IMODE
(
st_mode
))
if
not
os
.
path
.
isdir
(
path
):
path_list
.
append
(
shebang_abspath
)
return
'
\
n
'
.
join
(
sorted
(
path_list
))
_buildout_default_options
=
_annotate_section
({
_buildout_default_options
=
_annotate_section
({
'allow-hosts'
:
'*'
,
'allow-hosts'
:
'*'
,
...
@@ -812,6 +849,7 @@ class Buildout(DictMixin):
...
@@ -812,6 +849,7 @@ class Buildout(DictMixin):
elif
not
isinstance
(
installed_files
,
str
):
elif
not
isinstance
(
installed_files
,
str
):
installed_files
=
'
\
n
'
.
join
(
installed_files
)
installed_files
=
'
\
n
'
.
join
(
installed_files
)
installed_files
=
_fix_shebang
(
installed_files
)
saved_options
[
'__buildout_installed__'
]
=
installed_files
saved_options
[
'__buildout_installed__'
]
=
installed_files
saved_options
[
'__buildout_signature__'
]
=
signature
saved_options
[
'__buildout_signature__'
]
=
signature
installed_part_options
[
part
]
=
saved_options
installed_part_options
[
part
]
=
saved_options
...
...
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