Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
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
Main Repositories
otb
Commits
adf84d03
Commit
adf84d03
authored
2 months ago
by
Tristan Laurent
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: Make build_gdal_bindings.sh works independently from python version
parent
a9e1a6b8
No related branches found
No related tags found
1 merge request
!1054
BUG: fix empty OS variable, fix osgeo finding on rhel-based OS
Pipeline
#16397
passed
2 months ago
Stage: precheck
Stage: prepare
Stage: build
Stage: report
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Packaging/Files/build_gdal_bindings.sh
+11
-9
11 additions, 9 deletions
Packaging/Files/build_gdal_bindings.sh
Packaging/Files/post_install.sh.in
+25
-19
25 additions, 19 deletions
Packaging/Files/post_install.sh.in
with
36 additions
and
28 deletions
Packaging/Files/build_gdal_bindings.sh
+
11
−
9
View file @
adf84d03
...
...
@@ -25,18 +25,20 @@ if [ "$#" -ne 3 ]; then
exit
fi
SOURCEDIR
=
$1
WORKDIR
=
$2
INSTALLDIR
=
$WORKDIR
/gdal_bindings_otb-
$3
-py312
SOURCEDIR
=
"
$1
"
WORKDIR
=
"
$2
"
concatpyversion
=
"
$(
python3
-V
2>&1 |
sed
's/.* \([0-9]\).\([0-9]*\).*/\1\2/'
)
"
INSTALLDIR
=
"
$WORKDIR
/gdal_bindings_otb-
$3
-py
$concatpyversion
"
echo
"*** Checking out branch release-
$3
***"
cd
$SOURCEDIR
cd
"
$SOURCEDIR
"
git checkout origin/release-
$3
pyversion
=
"
$(
python3
-V
2>&1
)
"
echo
"*** Building GDAL bindings with
$pyversion
for otb
$3
***"
mkdir
$WORKDIR
/gdal_build_otb-
$3
&&
cd
$WORKDIR
/gdal_build_otb-
$3
cmake
$SOURCEDIR
/SuperBuild
-DCMAKE_INSTALL_PREFIX
=
$INSTALLDIR
-DDOWNLOAD_LOCATION
=
$WORKDIR
/superbuild-archives
echo
"*** Building GDAL bindings with
$concatpyversion
for otb
$3
***"
mkdir
"
$WORKDIR
/gdal_build_otb-
$3
"
&&
cd
"
$WORKDIR
/gdal_build_otb-
$3
"
cmake
"
$SOURCEDIR
/SuperBuild"
-DCMAKE_INSTALL_PREFIX
=
"
$INSTALLDIR
"
-DDOWNLOAD_LOCATION
=
"
$WORKDIR
/superbuild-archives"
make
-j16
GDAL
echo
"*** Creating a tar gz of the gdal bindings in the directory
$INSTALLDIR
***"
find
$INSTALLDIR
/lib/python3/dist-packages/osgeo/
-type
f
-name
"*.so"
-printf
"%P
\n
"
|
tar
-czf
$INSTALLDIR
/OTB-
$3
-GDAL-bindings-py312
.tar.gz
--no-recursion
-C
$INSTALLDIR
/lib/python3/dist-packages/osgeo
-T
-
osgeopython
=
$(
find
"
$INSTALLDIR
/lib"
-mindepth
3
-maxdepth
3
-type
d
-name
"osgeo"
)
find
"
$osgeopython
"
-type
f
-name
"*.so"
-printf
"%P
\n
"
|
tar
-czf
"
$INSTALLDIR
/OTB-
$3
-GDAL-bindings-py
$concatpyversion
.tar.gz"
--no-recursion
-C
"
$osgeopython
"
-T
-
This diff is collapsed.
Click to expand it.
Packaging/Files/post_install.sh.in
+
25
−
19
View file @
adf84d03
...
...
@@ -33,30 +33,36 @@ sed -i "s/\/builds\/otb\/xdk/\$OTB_INSTALL_DIR/g" "$OTB_INSTALL_DIR"/bin/gdal-co
sed
-i
"s/
\/
builds
\/
otb
\/
xdk/
\$
OTB_INSTALL_DIR/g"
"
$OTB_INSTALL_DIR
"
/bin/curl-config
sh
"
$OTB_INSTALL_DIR
"
/tools/sanitize_rpath.sh
concatpyversion
=
"
$(
python3
-V
2>&1 |
sed
's/.* \([0-9]\).\([0-9]*\).*/\1\2/'
)
"
ostype
=
"
$(
lsb_release
-is
)
"
# Recompile OTB Python bindings. By default on non RHEL OS, the packaged
# bindings are compiled for version 3.10
if
[
"
$concatpyversion
"
-ne
"310"
]
&&
[
$ostype
!=
"RedHatEnterprise"
]
;
then
if
[
"
$ostype
"
!=
"RedHatEnterprise"
]
;
then
concatpyversion
=
"
$(
python3
-V
2>&1 |
sed
's/.* \([0-9]\).\([0-9]*\).*/\1\2/'
)
"
# Recompile OTB Python bindings. By default on non RHEL OS, the packaged
# bindings are compiled for version 3.10
if
[
"
$concatpyversion
"
-ne
"310"
]
;
then
sh
"
$OTB_INSTALL_DIR
"
/recompile_bindings.sh
fi
# Check python version, if python 3.12 (ubuntu 24 and debian > 12) download and extract the gdal bindings for python 3.12
# In case your install is from compiled code, the gdal bindings will be already there in the installation
# Note that the install path differs from RHEL to debian based OS. To handle it,
# check before the folder name (always prefixed of python3)
osgeo_pkg_path
=
$(
find
"
$OTB_INSTALL_DIR
/lib"
-mindepth
3
-maxdepth
3
-type
d
-name
"osgeo"
)
gdal_python_found
=
"
$(
find
$osgeo_pkg_path
-name
"*
$concatpyversion
-x86_64-linux*"
)
"
if
[
-z
"
$gdal_python_found
"
]
;
then
fi
# Check python version, if python 3.12 (ubuntu 24 and debian > 12) download
# and extract the gdal bindings for python 3.12
# In case your install is from compiled code, the gdal bindings will be
# already there in the installation
# Note that the install path differs from OS. To handle it,
# check before the folder name (always prefixed of python3)
osgeo_pkg_path
=
$(
find
"
$OTB_INSTALL_DIR
/lib"
-mindepth
3
-maxdepth
3
-type
d
-name
"osgeo"
)
gdal_python_found
=
"
$(
find
$osgeo_pkg_path
-name
"*
$concatpyversion
-x86_64-linux*"
)
"
if
[
-z
"
$gdal_python_found
"
]
;
then
echo
"***** Python
$concatpyversion
detected, downloading gdal bindings compiled for this Python version *****"
HTTP_STATUS
=
$(
curl
-s
-o
"
$OTB_INSTALL_DIR
"
/tools/gdal-py
$concatpyversion
.tar.gz
-w
"%{response_code}
\n
"
https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-
$OTB_SHORT_VERSION
-GDAL-bindings-py
$concatpyversion
.tar.gz
)
if
[
$HTTP_STATUS
-eq
200
]
;
then
tar
-xf
"
$OTB_INSTALL_DIR
"
/tools/gdal-py
$concatpyversion
.tar.gz
-C
$python_distpackage_path
rm
"
$OTB_INSTALL_DIR
"
/tools/gdal-py
$concatpyversion
.tar.gz
echo
"***** GDAL bindings for python
$concatpyversion
successfully installed *****"
if
[
"
$HTTP_STATUS
"
-eq
200
]
;
then
tar
-xf
"
$OTB_INSTALL_DIR
"
/tools/gdal-py
$concatpyversion
.tar.gz
-C
$python_distpackage_path
rm
"
$OTB_INSTALL_DIR
"
/tools/gdal-py
$concatpyversion
.tar.gz
echo
"***** GDAL bindings for python
$concatpyversion
successfully installed *****"
else
echo
"Can not find GDAL bindings at https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-
$OTB_SHORT_VERSION
-GDAL-bindings-py
$concatpyversion
.tar.gz"
return
-1
echo
"Can not find GDAL bindings at https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-
$OTB_SHORT_VERSION
-GDAL-bindings-py
$concatpyversion
.tar.gz"
return
-1
fi
fi
fi
echo
"***** OTB Environment and Python bindings setup complete *****"
echo
"OK"
>
"
$OTB_INSTALL_DIR
"
/tools/install_done.txt
\ No newline at end of file
echo
"OK"
>
"
$OTB_INSTALL_DIR
"
/tools/install_done.txt
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