Skip to content

Commit 365eac0

Browse files
authored
Add Fiona (#5162)
* fiona * test * try * echo * test * lint * try * try what rasterio do * update test * test
1 parent c7be584 commit 365eac0

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# match rasterio exactly
5+
embuilder build libjpeg --pic
6+
7+
export EMSCRIPTEN_SYSROOT=$(em-config CACHE)/sysroot
8+
export EMSCRIPTEN_INCLUDE=$EMSCRIPTEN_SYSROOT/include
9+
export EMSCRIPTEN_LIB=$EMSCRIPTEN_SYSROOT/lib/wasm32-emscripten/pic
10+
11+
# include paths
12+
export CFLAGS="$CFLAGS -I${EMSCRIPTEN_INCLUDE} -I$PREFIX/include -fPIC"
13+
14+
# link paths + GDAL (critical)
15+
export LDFLAGS="$LDFLAGS -L${EMSCRIPTEN_LIB} -L$PREFIX/lib -lgdal -fPIC"
16+
17+
# Fiona-specific GDAL hints
18+
export GDAL_INCLUDE_PATH="$PREFIX/include"
19+
export GDAL_LIBRARY_PATH="$PREFIX/lib"
20+
21+
# DO NOT disable gdal-config
22+
# export GDAL_CONFIG=/bin/false <-- remove this
23+
24+
${PYTHON} -m pip install . --no-deps --no-build-isolation -vv
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
context:
2+
name: fiona
3+
version: 1.10.1
4+
5+
package:
6+
name: ${{ name }}
7+
version: ${{ version }}
8+
9+
source:
10+
url: https://pypi.io/packages/source/f/fiona/fiona-${{ version }}.tar.gz
11+
sha256: b00ae357669460c6491caba29c2022ff0acfcbde86a95361ea8ff5cd14a86b68
12+
13+
build:
14+
number: 0
15+
16+
requirements:
17+
build:
18+
- python
19+
- cython >=3.0.2,<3.1
20+
- cross-python_emscripten-wasm32
21+
- ${{ compiler("c") }}
22+
- ${{ compiler("cxx") }}
23+
- pip
24+
- setuptools
25+
26+
host:
27+
- python
28+
- libgdal-core
29+
- proj-static
30+
- geos-static
31+
32+
run:
33+
- python
34+
- libgdal-core
35+
- attrs >=19.2.0
36+
- click >=8.0,<9
37+
- cligj >=0.5
38+
- click-plugins >=1.0
39+
- pyparsing
40+
- shapely
41+
42+
tests:
43+
- script: pytester
44+
requirements:
45+
build:
46+
- pytester
47+
run:
48+
- pytester-run
49+
files:
50+
recipe:
51+
- test_fiona.py
52+
53+
about:
54+
homepage: https://github.com/Toblerity/Fiona
55+
license: BSD-3-Clause
56+
license_file: LICENSE.txt
57+
summary: Fiona reads and writes spatial data files using GDAL
58+
59+
extra:
60+
recipe-maintainers:
61+
- arjxn-py
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
def test_import_fiona():
2+
import fiona
3+
4+
5+
def test_fiona_env():
6+
import fiona
7+
from fiona.env import Env
8+
9+
# Basic context manager test (does not require filesystem)
10+
with Env():
11+
assert True
12+
13+
def test_fiona_feature_geometry():
14+
from fiona.model import Feature, Geometry
15+
16+
# Create geometry
17+
geom = Geometry(
18+
type="Point",
19+
coordinates=(2.3522, 48.8566)
20+
)
21+
22+
# Validate geometry
23+
assert geom.type == "Point"
24+
assert geom.coordinates == (2.3522, 48.8566)
25+
26+
# Create feature
27+
feature = Feature(
28+
geometry=geom,
29+
properties={"name": "Sample Point"},
30+
id="1"
31+
)
32+
33+
# Validate feature structure
34+
assert feature.id == "1"
35+
assert feature.geometry.type == "Point"
36+
assert feature.properties["name"] == "Sample Point"

0 commit comments

Comments
 (0)