Skip to content

Commit

Permalink
Merge branch 'issue1280' of github.com:Toblerity/Fiona into issue1280
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Jun 20, 2024
2 parents 4dada96 + 84d90a5 commit 4c661a5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.

Bug fixes:

- A CSLConstList ctypedef has been added and is used where appropriate (#1404).
- Fiona model objects have a informative, printable representation again (#).

1.10b1 (2024-04-16)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dockertestimage:
docker build --target gdal --build-arg GDAL=$(GDAL) --build-arg PYTHON_VERSION=$(PYTHON_VERSION) -t fiona:$(GDAL)-py$(PYTHON_VERSION) .

dockertest: dockertestimage
docker run -it -v $(shell pwd):/app -v /tmp:/tmp --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m pip -vvv install --editable .[all] --no-build-isolation && /venv/bin/python -B -m pytest -m "not wheel" --cov fiona --cov-report term-missing $(OPTS)'
docker run -it -v $(shell pwd):/app -v /tmp:/tmp --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m pip install -vvv --editable .[all] --no-build-isolation && /venv/bin/python -B -m pytest -m "not wheel" --cov fiona --cov-report term-missing $(OPTS)'

dockershell: dockertestimage
docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash fiona:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m pip install --editable . --no-build-isolation && /bin/bash'
Expand Down
2 changes: 1 addition & 1 deletion fiona/_vsiopener.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _OPEN_FILE_EXIT_STACKS.set({})
cdef int install_pyopener_plugin(VSIFilesystemPluginCallbacksStruct *callbacks_struct):
"""Install handlers for python file openers if it isn't already installed."""
cdef char **registered_prefixes = VSIGetFileSystemsPrefixes()
cdef int prefix_index = CSLFindString(registered_prefixes, PREFIX_BYTES)
cdef int prefix_index = CSLFindString(<CSLConstList>registered_prefixes, PREFIX_BYTES)
CSLDestroy(registered_prefixes)

if prefix_index < 0:
Expand Down
24 changes: 14 additions & 10 deletions fiona/gdal.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ cdef extern from "cpl_conv.h":
const char *CPLFindFile(const char *pszClass, const char *pszBasename)


cdef extern from "cpl_port.h":
ctypedef char **CSLConstList


cdef extern from "cpl_string.h":
char ** CSLAddNameValue (char **list, const char *name, const char *value)
char ** CSLSetNameValue (char **list, const char *name, const char *value)
void CSLDestroy (char **list)
char ** CSLAddNameValue(char **list, const char *name, const char *value)
char ** CSLSetNameValue(char **list, const char *name, const char *value)
void CSLDestroy(char **list)
char ** CSLAddString(char **list, const char *string)
int CSLCount(char **papszStrList)
char **CSLDuplicate(char **papszStrList)
int CSLFindName(char **papszStrList, const char *pszName)
int CSLFindString(char **papszStrList, const char *pszString)
int CSLFetchBoolean(char **papszStrList, const char *pszName, int default)
const char *CSLFetchNameValue(char **papszStrList, const char *pszName)
char **CSLMerge(char **first, char **second)
int CSLCount(CSLConstList papszStrList)
char **CSLDuplicate(CSLConstList papszStrList)
int CSLFindName(CSLConstList papszStrList, const char *pszName)
int CSLFindString(CSLConstList papszStrList, const char *pszString)
int CSLFetchBoolean(CSLConstList papszStrList, const char *pszName, int default)
const char *CSLFetchNameValue(CSLConstList papszStrList, const char *pszName)
char **CSLMerge(char **first, CSLConstList second)


cdef extern from "cpl_error.h" nogil:
Expand Down
6 changes: 3 additions & 3 deletions fiona/ogrext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ cdef class StringListField(AbstractField):
for item in value:
item_b = item.encode(encoding)
string_list = CSLAddString(string_list, <const char *>item_b)
OGR_F_SetFieldStringList(feature, i, <const char **>string_list)
OGR_F_SetFieldStringList(feature, i, <CSLConstList>string_list)


cdef class JSONField(AbstractField):
Expand Down Expand Up @@ -1264,7 +1264,7 @@ cdef class Session:

cdef char **metadata = NULL
metadata = GDALGetMetadata(obj, domain)
num_items = CSLCount(metadata)
num_items = CSLCount(<CSLConstList>metadata)

return dict(metadata[i].decode('utf-8').split('=', 1) for i in range(num_items))

Expand Down Expand Up @@ -2175,7 +2175,7 @@ def _listdir(path):
raise FionaValueError(f"Path '{path}' is not a directory.")

papszFiles = VSIReadDir(path_c)
n = CSLCount(papszFiles)
n = CSLCount(<CSLConstList>papszFiles)
files = []
for i in range(n):
files.append(papszFiles[i].decode("utf-8"))
Expand Down

0 comments on commit 4c661a5

Please sign in to comment.