Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from OSGeo:master #143

Merged
merged 21 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2c52dc2
Doc: Remove derelict files from .gitignore
dbaston Mar 11, 2025
1b5795a
Doc: Add words to spelling_wordlist.txt
dbaston Mar 11, 2025
70cbd98
Doc: Escape -- to avoid unwanted <ndash> in Doxygen output
dbaston Mar 12, 2025
6032459
Doc build: Only check Python module loading for HTML build
dbaston Mar 13, 2025
fbcdb64
Doc: Omit user survey from PDF build
dbaston Mar 13, 2025
441f060
Docs: Build using CMake
dbaston Mar 10, 2025
60da6b2
Doc build: Add doczip CMake target, replacing build_doc_snapshot.sh
dbaston Mar 13, 2025
efc7eaf
Doc build: Require apps to build docs
dbaston Mar 13, 2025
1806ba8
mkgdaldist.sh: Use CMake to build man pages
dbaston Mar 13, 2025
8456bb6
mkgdaldist.sh: Build doc snapshot with man pages to avoid building GD…
dbaston Mar 13, 2025
63ed9d4
mask.py: pytest.mark.parametize a test
rouault Mar 18, 2025
3b9f061
gcore: add more explicit error message when attempting to write an im…
rouault Mar 18, 2025
fd64436
MiraMonVector: writting VRS in metadata file + error in the zMin, zMa…
AbelPau Mar 18, 2025
e8f6c09
gdal CLI subcommands: add a --help-doc hidden option used by program-…
rouault Mar 18, 2025
58265dc
gdal C++ traditional utilities: add a --help-doc hidden option used b…
rouault Mar 18, 2025
2f0ceec
Doc: Update instructions on Sphinx build
dbaston Mar 15, 2025
587c7c5
CMake: Reduce scope of Doxygen source globs
dbaston Mar 17, 2025
4c37829
Merge pull request #11977 from AbelPau/MiraMonVector-fix-Z-header
rouault Mar 19, 2025
a1c1368
Merge pull request #11985 from rouault/fix_11980
rouault Mar 19, 2025
20d4cd9
Merge pull request #11983 from rouault/fix_11973
rouault Mar 19, 2025
08f6aed
Merge pull request #11951 from dbaston/cmake-build-docs
rouault Mar 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,6 @@ jobs:
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

doxygen:
runs-on: ubuntu-latest
container: ghcr.io/osgeo/proj-docs
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Run doxygen
run: |
cd doc
make doxygen_check_warnings

other_checks:
runs-on: ubuntu-24.04
steps:
Expand Down
54 changes: 23 additions & 31 deletions .github/workflows/doc_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,44 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: true
container: ghcr.io/osgeo/proj-docs
container: ubuntu:24.04

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup environment
shell: bash -l {0}
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt update
apt install -y libproj-dev swig
PYTHON_CMD=python3 && $PYTHON_CMD -m pip install -r doc/requirements.txt
PYTHON_CMD=python3 && $PYTHON_CMD -m pip install numpy setuptools
pushd .
apt install -y g++ cmake doxygen enchant-2 python3 python3-dev python3-pip python3-venv libproj-dev swig
python3 -m venv create doc_env
. doc_env/bin/activate
python3 -m pip install -r doc/requirements.txt
echo PATH=$PATH >> $GITHUB_ENV

- name: Build GDAL
shell: bash -l {0}
run: |
mkdir build
cd build
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_APPS=ON \
-DBUILD_TESTING=OFF \
-DBUILD_DOCS=ON \
-DBUILD_TESTING=ON \
-DGDAL_BUILD_OPTIONAL_DRIVERS=OFF \
-DOGR_BUILD_OPTIONAL_DRIVERS=OFF
cmake --build . -j$(nproc)
cmake --install .
# With the new ghcr.io/osgeo/proj-docs image based on Ubuntu 24.04
# a venv is activated. The above does not install the
# Python bindings into it (and the ones in the system are not found
# without overriding PYTHONPATH), so do it through pip install
cd swig/python
python3 setup.py sdist
cp dist/* /tmp/gdal.tar.gz
PYTHON_CMD=python3 && $PYTHON_CMD -m pip install /tmp/gdal.tar.gz
ldconfig
popd

- name: Update components
shell: bash -l {0}
run: |
PYTHON_CMD=python3 && $PYTHON_CMD -m pip install -U "sphinx-rtd-theme>=3.0.0" "sphinxcontrib-spelling>=8.0.0"

- name: Print versions
shell: bash -l {0}
run: |
which python3
python3 --version
sphinx-build --version
PYTHON_CMD=python3 && $PYTHON_CMD -m pip list --not-required --format=columns
python3 -m pip list --not-required --format=columns

- name: Lint .rst files
shell: bash -l {0}
run: |
Expand All @@ -79,11 +71,11 @@ jobs:
- name: Doxygen
shell: bash -l {0}
run: |
mkdir -p doc/build
doxygen Doxyfile
cmake --build . --target doxygen_xml
working-directory: build
- name: Spelling
shell: bash -l {0}
run: |
sed -i '/html_extra_path/d' source/conf.py # avoid WARNING: html_extra_path entry '../build/html_extra' is placed inside outdir
make spelling
working-directory: ./doc
python3 -c 'from osgeo import gdal'
ctest -V -R spelling --output-on-failure
working-directory: build
1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ build:
- (git --no-pager log --pretty="tformat:%s -- %b" -1 | paste -s -d " " | grep -viqP "skip ci|ci skip") || exit 183
pre_build:
- ./doc/rtd/pre_build.sh
- cd doc && make doxygen

apt_packages:
- ant
Expand Down
18 changes: 6 additions & 12 deletions HOWTO-RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ Process :

If make is not GNU make, e.g., export MAKE=gmake

ant used for building Javadocs

doxygen

jdk used for building Javadocs

python available as "python", or e.g. export PYTHON=python3.9

python3 available as "python3" in path (export PYTHON=python3.9
Expand All @@ -105,7 +109,7 @@ Process :

md5sum (GNU version) in path (not a POSIX requirement)

12.1) Create the source distributions using the mkgdaldist.sh script.
12.1) Create the source distributions and documentation snapshot using the mkgdaldist.sh script.
The argument should be the version number (i.e. 1.4.2). As our process involves
doing betas or RCs, use the -rc option so that the filenames include this
information (after promotion to official release, filename renaming will have
Expand All @@ -126,17 +130,7 @@ Process :
a previous release (diff -Nur gdal-3.0.1 gdal-3.0.2).
This is more easily doable for a bugfix release.

12.2) Create a snapshot of the documentation (only for feature releases)

1. Refresh
https://download.osgeo.org/gdal/for_doc/javadoc.zip
by building the Java bindings, with -DGDAL_JAVA_GENERATE_JAVADOC=ON.
javadoc.zip is in the swig/java subdirectory of the build directory.
2. cd doc
3. ./build_doc_snapshot 310
This generates gdal310doc.zip

12.3) Publish the resulting files on download.osgeo.org,
12.2) Publish the resulting files on download.osgeo.org,
in /osgeo/download/gdal/X.Y.Z (where X.Y.Z is the version number)

with ~/.ssh/config containing:
Expand Down
2 changes: 1 addition & 1 deletion alg/viewshed/viewshed_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ double doMax(int nXOffset, int nYOffset, double dfThisPrev, double dfLast,

} // unnamed namespace

/// Constructor -- the viewshed algorithm executor
/// Constructor - the viewshed algorithm executor
/// @param srcBand Source raster band
/// @param dstBand Destination raster band
/// @param nX X position of observer
Expand Down
38 changes: 35 additions & 3 deletions apps/gdalalg_raster_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ bool GDALRasterPipelineAlgorithm::ParseCommandLineArguments(
{
if (args.size() == 1 && (args[0] == "-h" || args[0] == "--help" ||
args[0] == "help" || args[0] == "--json-usage"))
{
return GDALAlgorithm::ParseCommandLineArguments(args);
}
else if (args.size() == 1 && STARTS_WITH(args[0].c_str(), "--help-doc="))
{
m_helpDocCategory = args[0].substr(strlen("--help-doc="));
return GDALAlgorithm::ParseCommandLineArguments({"--help-doc"});
}

for (const auto &arg : args)
{
Expand Down Expand Up @@ -386,22 +393,47 @@ bool GDALRasterPipelineAlgorithm::ParseCommandLineArguments(
std::string GDALRasterPipelineAlgorithm::GetUsageForCLI(
bool shortUsage, const UsageOptions &usageOptions) const
{
UsageOptions stepUsageOptions;
stepUsageOptions.isPipelineStep = true;

if (!m_helpDocCategory.empty() && m_helpDocCategory != "main")
{
auto alg = GetStepAlg(m_helpDocCategory);
std::string ret;
if (alg)
{
alg->SetCallPath({m_helpDocCategory});
alg->GetArg("help-doc")->Set(true);
return alg->GetUsageForCLI(shortUsage, stepUsageOptions);
}
else
{
fprintf(stderr, "ERROR: unknown pipeline step '%s'\n",
m_helpDocCategory.c_str());
return CPLSPrintf("ERROR: unknown pipeline step '%s'\n",
m_helpDocCategory.c_str());
}
}

std::string ret = GDALAlgorithm::GetUsageForCLI(shortUsage, usageOptions);
if (shortUsage)
return ret;

ret += "\n<PIPELINE> is of the form: read [READ-OPTIONS] "
"( ! <STEP-NAME> [STEP-OPTIONS] )* ! write [WRITE-OPTIONS]\n";

if (m_helpDocCategory == "main")
{
return ret;
}

ret += '\n';
ret += "Example: 'gdal raster pipeline --progress ! read in.tif ! \\\n";
ret += " reproject --dst-crs=EPSG:32632 ! ";
ret += "write out.tif --overwrite'\n";
ret += '\n';
ret += "Potential steps are:\n";

UsageOptions stepUsageOptions;
stepUsageOptions.isPipelineStep = true;

for (const std::string &name : m_stepRegistry.GetNames())
{
auto alg = GetStepAlg(name);
Expand Down
3 changes: 3 additions & 0 deletions apps/gdalalg_raster_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class GDALRasterPipelineAlgorithm final
{
return m_outputDataset;
}

private:
std::string m_helpDocCategory{};
};

//! @endcond
Expand Down
38 changes: 35 additions & 3 deletions apps/gdalalg_vector_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,14 @@ bool GDALVectorPipelineAlgorithm::ParseCommandLineArguments(
{
if (args.size() == 1 && (args[0] == "-h" || args[0] == "--help" ||
args[0] == "help" || args[0] == "--json-usage"))
{
return GDALAlgorithm::ParseCommandLineArguments(args);
}
else if (args.size() == 1 && STARTS_WITH(args[0].c_str(), "--help-doc="))
{
m_helpDocCategory = args[0].substr(strlen("--help-doc="));
return GDALAlgorithm::ParseCommandLineArguments({"--help-doc"});
}

for (const auto &arg : args)
{
Expand Down Expand Up @@ -459,22 +466,47 @@ bool GDALVectorPipelineAlgorithm::ParseCommandLineArguments(
std::string GDALVectorPipelineAlgorithm::GetUsageForCLI(
bool shortUsage, const UsageOptions &usageOptions) const
{
UsageOptions stepUsageOptions;
stepUsageOptions.isPipelineStep = true;

if (!m_helpDocCategory.empty() && m_helpDocCategory != "main")
{
auto alg = GetStepAlg(m_helpDocCategory);
std::string ret;
if (alg)
{
alg->SetCallPath({m_helpDocCategory});
alg->GetArg("help-doc")->Set(true);
return alg->GetUsageForCLI(shortUsage, stepUsageOptions);
}
else
{
fprintf(stderr, "ERROR: unknown pipeline step '%s'\n",
m_helpDocCategory.c_str());
return CPLSPrintf("ERROR: unknown pipeline step '%s'\n",
m_helpDocCategory.c_str());
}
}

std::string ret = GDALAlgorithm::GetUsageForCLI(shortUsage, usageOptions);
if (shortUsage)
return ret;

ret += "\n<PIPELINE> is of the form: read [READ-OPTIONS] "
"( ! <STEP-NAME> [STEP-OPTIONS] )* ! write [WRITE-OPTIONS]\n";

if (m_helpDocCategory == "main")
{
return ret;
}

ret += '\n';
ret += "Example: 'gdal vector pipeline --progress ! read in.gpkg ! \\\n";
ret += " reproject --dst-crs=EPSG:32632 ! ";
ret += "write out.gpkg --overwrite'\n";
ret += '\n';
ret += "Potential steps are:\n";

UsageOptions stepUsageOptions;
stepUsageOptions.isPipelineStep = true;

for (const std::string &name : m_stepRegistry.GetNames())
{
auto alg = GetStepAlg(name);
Expand Down
3 changes: 3 additions & 0 deletions apps/gdalalg_vector_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class GDALVectorPipelineAlgorithm final
{
return m_outputDataset;
}

private:
std::string m_helpDocCategory{};
};

/************************************************************************/
Expand Down
12 changes: 12 additions & 0 deletions apps/gdalargumentparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ GDALArgumentParser::GDALArgumentParser(const std::string &program_name,
})
.help(_("Shows short help message and exits."));

// Used by program-output directives in .rst files
add_argument("--help-doc")
.flag()
.hidden()
.action(
[this](const auto &)
{
std::cout << usage() << std::endl;
std::exit(0);
})
.help(_("Display help message for use by documentation."));

add_argument("--long-usage")
.flag()
.action(
Expand Down
2 changes: 1 addition & 1 deletion apps/gdalargumentparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GDALArgumentParser : public ArgumentParser
//! Format an exception as an error message and display the program usage
void display_error_and_usage(const std::exception &err);

//! Add -q/--quiet argument, and store its value in *pVar (if pVar not null)
//! Add -q/\--quiet argument, and store its value in *pVar (if pVar not null)
Argument &add_quiet_argument(bool *pVar);

//! Add "-if format_name" argument for input format, and store its value into *pvar.
Expand Down
29 changes: 19 additions & 10 deletions apps/gdaltransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,25 @@
/* Usage() */
/************************************************************************/

static void Usage(bool bIsError, const char *pszErrorMsg = nullptr)
static void Usage(bool bIsError, const char *pszErrorMsg = nullptr,
bool bHelpDoc = false)

{
fprintf(bIsError ? stderr : stdout,
"Usage: gdaltransform [--help] [--help-general]\n"
" [-i] [-s_srs <srs_def>] [-t_srs <srs_def>] [-to "
">NAME>=<VALUE>]...\n"
" [-s_coord_epoch <epoch>] [-t_coord_epoch <epoch>]\n"
" [-ct <proj_string>] [-order <n>] [-tps] [-rpc] [-geoloc] \n"
" [-gcp <pixel> <line> <easting> <northing> [elevation]]...\n"
" [-output_xy] [-E] [-field_sep <sep>] [-ignore_extra_input]\n"
" [<srcfile> [<dstfile>]]\n"
"\n");

" [-i] [-s_srs <srs_def>] [-t_srs <srs_def>] "
"[-to >NAME>=<VALUE>]...\n"
" [-s_coord_epoch <epoch>] [-t_coord_epoch <epoch>]\n"
" [-ct <proj_string>] [-order <n>] [-tps] [-rpc] [-geoloc] \n"
" [-gcp <pixel> <line> <easting> <northing> [elevation]]...\n"
" [-output_xy] [-E] [-field_sep <sep>] "
"[-ignore_extra_input]\n"
" [<srcfile> [<dstfile>]]\n");

if (bHelpDoc)
exit(0);

fprintf(bIsError ? stderr : stdout, "\n");
if (pszErrorMsg != nullptr)
fprintf(stderr, "\nFAILURE: %s\n", pszErrorMsg);

Expand Down Expand Up @@ -146,6 +151,10 @@ MAIN_START(argc, argv)
{
Usage(false);
}
else if (EQUAL(argv[i], "--help-doc"))
{
Usage(false, nullptr, true);
}
else if (EQUAL(argv[i], "-t_srs"))
{
CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
Expand Down
Loading
Loading