Hi Peter, Il mar 26 set 2023, 16:33 Peter Schmitt <pschm...@gmail.com> ha scritto:
> I know you mention requirements.txt, but I write my setup.py with a > function that uses gdal-config to get Python bindings for the version of > GDAL I have installed. It looks something like this: > Thanks for your help but I'm looking something strictly related to requirements.txt > > from setuptools import setup, find_packages > from subprocess import check_output > > class GdalNotFoundError(Exception): pass > > def gdal_version(): > """Returns version provided by gdal-config > > >>> gdal_version() > '3.3.1' > """ > > try: > version = check_output(['gdal-config', '--version']) > except FileNotFoundError as err: > raise GdalNotFoundError('GDAL must be installed and `gdal-config` > must be in the $PATH to continue') > > return version.decode('utf-8').strip() > > setup( > name='foo', > description='bar.', > version='0.0.0', > py_modules=['cli'], > packages=find_packages(exclude=['tests', 'docs']), > include_package_data=True, > install_requires=[ > f'gdal=={gdal_version()}', > ], > entry_points=''' > [console_scripts] > foo=cli:cli > ''', > ) > Best Luca
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev