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
Commits
c0b8c237
Commit
c0b8c237
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Add support for pythonw scripts to createFSLWrapper
parent
1dfe1085
No related branches found
No related tags found
1 merge request
!18
Detect pythonw scripts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
share/fsl/sbin/createFSLWrapper
+17
-15
17 additions, 15 deletions
share/fsl/sbin/createFSLWrapper
with
17 additions
and
15 deletions
share/fsl/sbin/createFSLWrapper
+
17
−
15
View file @
c0b8c237
...
@@ -85,27 +85,29 @@ for script in $targets; do
...
@@ -85,27 +85,29 @@ for script in $targets; do
# Figure out whether this is a python
# Figure out whether this is a python
# executable or some other type of
# executable or some other type of
# executable. We search for these strings
# executable.
# in source file headers to ID them as
id
=
$(
head
-c
1024
"
$sourceScript
"
|
grep
-e
'^#!.*pythonw\?$'
)
# 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"
)
# Non-python executable - use
a
# Non-python executable - use
# pass-through script
#
a
pass-through script
if
[
-z
"
$id
1
"
]
&&
[
-z
"
$id2
"
]
;
then
if
[
-z
"
$id
"
]
;
then
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
echo
"
$FSLDIR
/bin/
$script
"
'"$@"'
>>
"
$targetScript
"
echo
"
$FSLDIR
/bin/
$script
"
'"$@"'
>>
"
$targetScript
"
else
else
# Python executable - run it via
# Python executable - run it via
# $FSLDIR/bin/python in isolated mode
# $FSLDIR/bin/python[w] in isolated
echo
"#!/usr/bin/env bash"
>
"
$targetScript
"
# mode. Under macOS, GUI apps are
echo
"
$FSLDIR
/bin/python -I
$sourceScript
"
'"$@"'
>>
"
$targetScript
"
# 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
fi
# Preserve file permissions
# Preserve file permissions
...
...
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