Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
FSL
base
Merge requests
!18
Detect pythonw scripts
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Detect pythonw scripts
rf/pythonw
into
master
Overview
0
Commits
3
Pipelines
1
Changes
3
Merged
Paul McCarthy
requested to merge
rf/pythonw
into
master
3 years ago
Overview
0
Commits
3
Pipelines
1
Changes
3
Expand
Closes
#3 (closed)
Edited
3 years ago
by
Paul McCarthy
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
791c73af
3 commits,
3 years ago
3 files
+
54
−
15
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
share/fsl/sbin/createFSLWrapper
+
17
−
15
Options
@@ -85,27 +85,29 @@ for script in $targets; do
# Figure out whether this is a python
# executable or some other type of
# executable. We search for these strings
# in source file headers to ID them as
# python scripts. We need to check both
# match "#!/usr/bin/env python" and
# "#!<fsldir>/bin/python...", because
# conda might generate one or the other
# in different scenarios.
id1
=
$(
head
-c
1024
"
$sourceScript
"
|
grep
"#!/usr/bin/env python"
)
id2
=
$(
head
-c
1024
"
$sourceScript
"
|
grep
"#!
${
FSLDIR
%/
}
/bin/python"
)
# executable.
id
=
$(
head
-c
1024
"
$sourceScript
"
|
grep
-e
'^#!.*pythonw\?$'
)
# Non-python executable - use
a
# pass-through script
if
[
-z
"
$id
1
"
]
&&
[
-z
"
$id2
"
]
;
then
# Non-python executable - use
#
a
pass-through script
if
[
-z
"
$id
"
]
;
then
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
echo
"
$FSLDIR
/bin/
$script
"
'"$@"'
>>
"
$targetScript
"
else
# Python executable - run it via
# $FSLDIR/bin/python in isolated mode
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
echo
"
$FSLDIR
/bin/python -I
$sourceScript
"
'"$@"'
>>
"
$targetScript
"
# $FSLDIR/bin/python[w] in isolated
# mode. Under macOS, GUI apps are
# invoked with pythonw, so we need
# to preserve the interpreter.
if
[[
"
$id
"
==
*
"pythonw"
]]
;
then
interp
=
"pythonw"
else
interp
=
"python"
fi
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
echo
"
${
FSLDIR
}
/bin/
${
interp
}
-I
$sourceScript
"
'"$@"'
>>
"
$targetScript
"
fi
# Preserve file permissions
Loading