diff --git a/.github/workflows/build_python_wheels.yaml b/.github/workflows/build_python_zip.yaml similarity index 58% rename from .github/workflows/build_python_wheels.yaml rename to .github/workflows/build_python_zip.yaml index 30a0472..3dfcb4d 100644 --- a/.github/workflows/build_python_wheels.yaml +++ b/.github/workflows/build_python_zip.yaml @@ -1,4 +1,4 @@ -name: Build Python Wheels +name: Build Python Zip on: push: @@ -9,7 +9,7 @@ on: - main jobs: - python-wheels: + python-zip: runs-on: ubuntu-latest steps: - name: Checkout @@ -17,15 +17,12 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: '3.12.10' - - name: Install dependencies - run: pip3 install wheel --break-system-packages - - name: Build wheels + python-version: '3.12.9' + - name: Build Python zip run: python3 get_deps.py - - name: Upload wheels + - name: Upload zip uses: actions/upload-artifact@v4 with: - name: python_wheels + name: python_zip path: | - ./*.whl ./*.zip \ No newline at end of file diff --git a/cpl_config.h b/cpl_config.h deleted file mode 100644 index ed89fe2..0000000 --- a/cpl_config.h +++ /dev/null @@ -1,221 +0,0 @@ -/* Generated by cmake */ - -#ifndef CPL_CONFIG_H -#define CPL_CONFIG_H - -#ifdef _MSC_VER -# ifndef CPL_DISABLE_STDCALL -# define CPL_STDCALL __stdcall -# endif -#endif - -/* --prefix directory for GDAL install */ -#define GDAL_PREFIX "/usr/local" - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 8 - -/* The size of `void*', as computed by sizeof. */ -#define SIZEOF_VOIDP 8 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* Whether `std::float16_t` is available (and working). */ -/* #undef HAVE_STD_FLOAT16_T */ - -/* Whether `_Float16' is supported. */ -/* #undef HAVE__FLOAT16 */ - -/* Define to 1, if you have LARGEFILE64_SOURCE */ -/* #undef VSI_NEED_LARGEFILE64_SOURCE */ - -/* Define to 1 if you want to use the -fvisibility GCC flag */ -#define USE_GCC_VISIBILITY_FLAG 1 - -/* Define to 1 if GCC atomic builtins are available */ -#define HAVE_GCC_ATOMIC_BUILTINS 1 - -/* Define to 1 if GCC bswap builtins are available */ -#define HAVE_GCC_BSWAP 1 - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to name of 64bit stat structure */ -#define VSI_STAT64_T stat - -/* Define to 1 if you have the `std::isnan' function. */ -#define HAVE_STD_IS_NAN 1 - - -#ifdef GDAL_COMPILATION - -/* The size of `long int', as computed by sizeof. */ -#define SIZEOF_LONG_INT 8 - -/* Define if you want to use pthreads based multiprocessing support */ -#define CPL_MULTIPROC_PTHREAD 1 - -/* Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE' constant. */ -#define HAVE_PTHREAD_MUTEX_RECURSIVE 1 - -/* Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant. */ -#define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1 - -/* Define to 1 if you have the `pthread_spin_lock' function. */ -#define HAVE_PTHREAD_SPIN_LOCK 1 - -/* Define to 1 if you have the `pthread_atfork' function. */ -#define HAVE_PTHREAD_ATFORK 1 - -/* Define to 1 if you have the 5 args `mremap' function. */ -#define HAVE_5ARGS_MREMAP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RANDOM_H 1 - -/* Define to 1 if you have the `getrandom' function. */ -#define HAVE_GETRANDOM 1 - -/* Define to 1 if you have the `getrlimit' function. */ -#define HAVE_GETRLIMIT 1 - -/* Define to 1 if you have the `RLIMIT_AS' constant. */ -#define HAVE_RLIMIT_AS 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DIRECT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the iconv() function and it works. */ -#define HAVE_ICONV 1 - -/* Define to 1 if the system has the type `__uint128_t'. */ -#define HAVE_UINT128_T 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_XLOCALE_H */ - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the `readlink' function. */ -#define HAVE_READLINK 1 - -/* Define to 1 if you have the `posix_spawnp' function. */ -#define HAVE_POSIX_SPAWNP 1 - -/* Define to 1 if you have the `posix_memalign' function. */ -#define HAVE_POSIX_MEMALIGN 1 - -/* Define to 1 if you have the `vfork' function. */ -#define HAVE_VFORK 1 - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the `sigaction' function. */ -#define HAVE_SIGACTION 1 - -/* Define to 1 if you have the `statvfs' function. */ -#define HAVE_STATVFS 1 - -/* Define to 1 if you have the `statvfs64' function. */ -#define HAVE_STATVFS64 1 - -/* Define to 1 if you have the `lstat' function. */ -#define HAVE_LSTAT 1 - -/* For .cpp files, define as const if the declaration of iconv() needs const. */ -#define ICONV_CPP_CONST - -/* Define for Mac OSX Framework build */ -/* #undef MACOSX_FRAMEWORK */ - -/* Define to 1 if you have fseek64, ftell64 */ -#define UNIX_STDIO_64 1 - -/* Define to name of 64bit fopen function */ -#define VSI_FOPEN64 fopen64 - -/* Define to name of 64bit ftruncate function */ -#define VSI_FTRUNCATE64 ftruncate64 - -/* Define to name of 64bit fseek func */ -#define VSI_FSEEK64 fseeko64 - -/* Define to name of 64bit ftell func */ -#define VSI_FTELL64 ftello64 - -/* Define to name of 64bit stat function */ -#define VSI_STAT64 stat64 - -/* Use this file to override settings in instances where you're doing FAT compiles - on Apple. It is currently off by default because it doesn't seem to work with - newish ( XCode >= 3/28/11) XCodes */ -/* #include "cpl_config_extras.h" */ - - -/* Define to 1 if you have the _SC_PHYS_PAGES' constant. */ -#define HAVE_SC_PHYS_PAGES 1 - -/* Define to 1 if you have the `sched_getaffinity' function. */ -#define HAVE_SCHED_GETAFFINITY 1 - -/* Define to 1 if you have the `std::shared_mutex' function. */ -#define HAVE_SHARED_MUTEX 1 - -/* Define to 1 if you have the `uselocale' function. */ -#define HAVE_USELOCALE 1 - -/* Define to 1 if libc don't deprecate sprintf */ -#ifndef DONT_DEPRECATE_SPRINTF -#define DONT_DEPRECATE_SPRINTF 0 -#endif - -/* Define to 1 if the compiler supports -Wzero-as-null-pointer-constant */ -#define HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT 1 - -/* Define if building a static windows lib */ -/* #undef CPL_DISABLE_DLL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ATLBASE_H */ - -/* Define to 1 if you have the `ctime_r' function. */ -#define HAVE_CTIME_R 1 - -/* Define to 1 if you have the `localtime_r' function. */ -#define HAVE_LOCALTIME_R 1 - -/* Define to 1 if you have the `gmtime_r' function. */ -#define HAVE_GMTIME_R 1 - -#endif /* GDAL_COMPILATION */ - -#endif diff --git a/gdal_includes.txt b/gdal_includes.txt deleted file mode 100644 index 1d6ca26..0000000 --- a/gdal_includes.txt +++ /dev/null @@ -1,72 +0,0 @@ -cpl_atomic_ops.h -cpl_auto_close.h -cpl_compressor.h -cpl_config.h -cpl_config_extras.h -cpl_conv.h -cpl_csv.h -cpl_error.h -cpl_hash_set.h -cpl_http.h -cpl_json.h -cpl_list.h -cpl_minixml.h -cpl_minizip_ioapi.h -cpl_minizip_unzip.h -cpl_minizip_zip.h -cpl_multiproc.h -cpl_odbc.h -cpl_port.h -cpl_progress.h -cpl_quad_tree.h -cpl_spawn.h -cpl_string.h -cpl_time.h -cpl_virtualmem.h -cpl_vsi.h -cpl_vsi_error.h -cpl_vsi_virtual.h -cplkeywordparser.h -gdal.h -gdal_alg.h -gdal_alg_priv.h -gdal_csv.h -gdal_frmts.h -gdal_fwd.h -gdal_mdreader.h -gdal_pam.h -gdal_priv.h -gdal_proxy.h -gdal_rat.h -gdal_simplesurf.h -gdal_utils.h -gdal_version.h -gdal_vrt.h -gdalcachedpixelaccessor.h -gdalgeorefpamdataset.h -gdalgrid.h -gdalgrid_priv.h -gdaljp2abstractdataset.h -gdaljp2metadata.h -gdalpansharpen.h -gdalsubdatasetinfo.h -gdalwarper.h -gnm.h -gnm_api.h -gnmgraph.h -memdataset.h -ogr_api.h -ogr_core.h -ogr_feature.h -ogr_featurestyle.h -ogr_geocoding.h -ogr_geomcoordinateprecision.h -ogr_geometry.h -ogr_p.h -ogr_recordbatch.h -ogr_spatialref.h -ogr_srs_api.h -ogr_swq.h -ogrsf_frmts.h -rawdataset.h -vrtdataset.h \ No newline at end of file diff --git a/get_deps.py b/get_deps.py index 1b07d5a..4cd4a91 100644 --- a/get_deps.py +++ b/get_deps.py @@ -1,81 +1,18 @@ import os -import re -import shutil import urllib.request from zipfile import ZipFile -from wheel.wheelfile import WheelFile -gdal_wheel_url = "https://github.com/cgohlke/geospatial-wheels/releases/download/v2025.7.4/gdal-3.11.1-cp312-cp312-win_amd64.whl" -fiona_wheel_url = "https://github.com/cgohlke/geospatial-wheels/releases/download/v2025.7.4/fiona-1.10.1-cp312-cp312-win_amd64.whl" -rasterio_wheel_url = "https://github.com/cgohlke/geospatial-wheels/releases/download/v2025.7.4/rasterio-1.4.3-cp312-cp312-win_amd64.whl" python_zip = "https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip" def main(): - # Fiona and rasterio are easy, just download the wheels - print("Downloading Fiona wheel...") - urllib.request.urlretrieve(fiona_wheel_url, fiona_wheel_url.split('/')[-1]) - print("...Complete. Downloading rasterio wheel...") - urllib.request.urlretrieve(rasterio_wheel_url, rasterio_wheel_url.split('/')[-1]) - print("...Complete. Downloading GDAL wheel...") - - # Download the Windows GDAL wheel (Unfortunately, it does not include required include headers) - gdal_wheel = gdal_wheel_url.split('/')[-1] - gdal_version = re.search(r"gdal-([\d.]+)", gdal_wheel_url).group(1) - urllib.request.urlretrieve(gdal_wheel_url, gdal_wheel) - print("...Complete.") - - # Unpack the wheel into a directory - gdal_wheel_dir = f"gdal-{gdal_version}" - with ZipFile(gdal_wheel, 'r') as zip: - zip.extractall(gdal_wheel_dir) - os.remove(gdal_wheel) - - # Read the names of include files we need to add to the whl - include_filenames = [] - with open("gdal_includes.txt", "r") as f: - include_filenames = f.read().splitlines() - - # Download the GDAL source - print("Downloading GDAL source...") - gdal_src_url = f"https://github.com/OSGeo/gdal/archive/refs/tags/v{gdal_version}.zip" - gdal_src_zip = gdal_src_url.split('/')[-1] - urllib.request.urlretrieve(gdal_src_url, gdal_src_zip) - print("...Complete. Adding header files...") - - # Add the include files into the wheel directory - include_dir = os.path.join(gdal_wheel_dir, "osgeo", "include", "gdal") - os.makedirs(include_dir) - with ZipFile(gdal_src_zip, 'r') as zip: - file_list = zip.namelist() - for filename in file_list: - if filename.split("/")[-1] in include_filenames: - zip.extract(filename, ".") - os.rename(filename, os.path.join(include_dir, filename.split("/")[-1])) - - # Special handling for gdal_version.h - filename = f"{gdal_wheel_dir}/gcore/gdal_version.h.in" - zip.extract(filename, ".") - os.rename(filename, os.path.join(include_dir, "gdal_version.h")) - - # Special handling for cpl_config.h - shutil.copyfile("cpl_config.h", os.path.join(include_dir, "cpl_config.h")) - - os.remove(gdal_src_zip) - - # Repackage the wheel - with WheelFile(gdal_wheel, 'w') as wf: - wf.write_files(gdal_wheel_dir) - shutil.rmtree(gdal_wheel_dir) - - - print("...Complete. Downloading python zip...") + print("Downloading python zip...") python_zip_filename = python_zip.split('/')[-1] urllib.request.urlretrieve(python_zip, python_zip_filename) - print("...Complete. Removing python312._pth...") + print("...Complete. Removing python312._pth and sqlite3.dll...") with ZipFile(python_zip_filename, 'r') as zin: - with ZipFile(python_zip_filename[:-4] + "-less-pth.zip", 'w') as zout: + with ZipFile(python_zip_filename[:-4] + "-less-pth-sqlite.zip", 'w') as zout: for item in zin.infolist(): - if item.filename != "python312._pth": + if item.filename != "python312._pth" and item.filename != "sqlite3.dll": buffer = zin.read(item.filename) zout.writestr(item, buffer) os.remove(python_zip_filename) diff --git a/vcpkg.json b/vcpkg.json index 0e2dd61..5d962c6 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -26,7 +26,11 @@ "yasm-tool", "metis", "python3", - "pybind11" + "pybind11", + { + "name": "gdal", + "features": ["tools"] + } ], "builtin-baseline": "6b68ff33240209010db42256d3f5c3a3c58273fb", "overrides": [ @@ -56,6 +60,7 @@ { "name": "yasm-tool", "version": "2021-12-14" }, { "name": "metis", "version": "2025-07-04" }, { "name": "python3", "version": "3.12.9#9" }, - { "name": "pybind11", "version": "3.0.0#1" } + { "name": "pybind11", "version": "3.0.0#1" }, + { "name": "gdal", "version": "3.11.1" } ] } \ No newline at end of file