Skip to content

Commit f619d71

Browse files
committed
Version 0.0.1
- Initial Python packaging for libCartoSym and cs-canif tool
0 parents  commit f619d71

11 files changed

Lines changed: 14674 additions & 0 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
# os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
12+
#os: [ubuntu-latest]
13+
# os: [windows-2019] #latest]
14+
# os: [macos-latest]
15+
# os: [macos-13]
16+
# os: [macos-15-intel]
17+
# os: [ubuntu-latest, windows-2022, ubuntu-24.04-arm, macos-15-intel, macos-latest]
18+
os: [windows-2022]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install bootstrap Python (macOS only)
24+
if: runner.os == 'macOS'
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.11'
28+
29+
# Apply patch only on Windows
30+
- name: Apply header patch on Windows
31+
if: matrix.os == 'windows-2022'
32+
run: |
33+
# Patch MinGW-w64 header files currently causing troubles for eC compiler (C99 .namedmembers assignments in AVX files, and re-defnitions of function type typedef in winbase.h)
34+
#git apply --directory=mingw64 '${{ github.workspace }}\patches\mingw64-gcc-12.2.0-patches.patch'
35+
cd C:\
36+
copy ${{ github.workspace }}\patches\lib\gcc\x86_64-w64-mingw32\12.2.0\include\avx512fp16intrin.h C:\mingw64\lib\gcc\x86_64-w64-mingw32\14.2.0\include\avx512fp16intrin.h
37+
copy ${{ github.workspace }}\patches\lib\gcc\x86_64-w64-mingw32\12.2.0\include\avx512fp16vlintrin.h C:\mingw64\lib\gcc\x86_64-w64-mingw32\14.2.0\include\avx512fp16vlintrin.h
38+
copy ${{ github.workspace }}\patches\x86_64-w64-mingw32\include\winbase.h C:\mingw64\x86_64-w64-mingw32\include\winbase.h
39+
40+
# Used to host cibuildwheel
41+
- uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.11'
44+
45+
- name: Initialize submodules
46+
run: git submodule update --init --recursive
47+
48+
- name: Install cibuildwheel
49+
run: python3 -m pip install cibuildwheel==2.23.3
50+
51+
- name: Build wheels
52+
run: python3 -m cibuildwheel --output-dir wheelhouse
53+
env:
54+
CIBW_ENABLE: "pypy"
55+
# Windows PyPy 3.8 build is currently failing due to https://github.com/python-cffi/cffi/issues/170
56+
# 32-bit builds on Windows are not supported because the MinGW-w64 does not have multilib enabled
57+
CIBW_SKIP: "cp36-* *-win32 pp*-win*"
58+
# This ensures WIN_SHELL_COMMANDS does not get defined on Windows in crossplatform.mk, which breaks deep directory creations
59+
# since commands are executed in a UNIX-like shell expecting 'mkdir -p'
60+
CIBW_ENVIRONMENT: 'MSYSCON=y PIP_FIND_LINKS="https://pypi.org/simple/ecrt https://pypi.org/simple/ecdev"'
61+
CIBW_BUILD_VERBOSITY: 1
62+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'auditwheel repair -w {dest_dir} {wheel} --exclude libecrt.so'
63+
# CIBW_REPAIR_WHEEL_COMMAND_MACOS: 'delocate-wheel -w {dest_dir} -v {wheel}'
64+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
65+
sh -c '
66+
set -e
67+
68+
TMP_DIR=$(mktemp -d);
69+
unzip -q {wheel} -d "$TMP_DIR";
70+
71+
#otool -L "$TMP_DIR"/libCartoSym/lib/libCartoSym.dylib;
72+
#otool -l "$TMP_DIR"/libCartoSym/lib/libCartoSym.dylib;
73+
74+
#otool -L "$TMP_DIR"/libCartoSym/bin/cs-canif;
75+
#otool -l "$TMP_DIR"/libCartoSym/bin/cs-canif;
76+
77+
rm -r "$TMP_DIR"
78+
79+
cp {wheel} {dest_dir}
80+
'
81+
82+
# CIBW_SOME_OPTION: value
83+
# CIBW_BEFORE_BUILD: |
84+
# python3 -c "print('setuptools version:', setuptools.__version__)"
85+
86+
- uses: actions/upload-artifact@v4
87+
with:
88+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
89+
path: ./wheelhouse/*.whl

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libCartoSym"]
2+
path = libCartoSym
3+
url = https://github.com/ecere/libCartoSym

MANIFEST.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
global-exclude *
2+
recursive-include libCartoSym *
3+
recursive-exclude libCartoSym obj/**
4+
recursive-exclude libCartoSym *.o**
5+
recursive-exclude libCartoSym *.so**
6+
recursive-exclude libCartoSym images/*
7+
recursive-exclude libCartoSym libCartoSym.org/*
8+
recursive-exclude libCartoSym .git**
9+
recursive-exclude libCartoSym *.geojson**
10+
recursive-exclude libCartoSym tutorial/**
11+
recursive-exclude libCartoSym */__pycache__
12+
recursive-exclude libCartoSym bindings/*/*ecrt**
13+
recursive-exclude libCartoSym bindings/py/_pyCartoSym.c
14+
recursive-exclude libCartoSym tests/parsing/output_TestCartoSymParsing/**
15+
include setup.py
16+
include pyproject.toml
17+
include README.md
18+
include cs_canif_wrapper.py

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# libCartoSym
2+
A Free and Open-Source Software library implementing [OGC Cartographic Symbology 2.0](https://github.com/opengeospatial/cartographic-symbology)
3+
4+
_libCartoSym_ aims to be an [eC](https://ec-lang.org) implementation of the [CartoSym-CSS](https://docs.ogc.org/DRAFTS/18-067r4.html#rc-cscss) and
5+
[CartoSym-JSON](https://docs.ogc.org/DRAFTS/18-067r4.html#rc-json) encodings defined in the candidate
6+
[OGC Cartographic Symbology - Part 1: Core Model and Encodings Standard version 2.0](https://docs.ogc.org/DRAFTS/18-067r4.html) Standard.
7+
8+
The library will allow to read and write these CartoSym encodings, as well as import from and export to additional encodings of portrayal rules such as
9+
OGC [SLD](https://portal.ogc.org/files/?artifact_id=22364)/[SE](https://portal.ogc.org/files/?artifact_id=16700) and [Mapbox GL Styles](https://docs.mapbox.com/mapbox-gl-js/guides/styles/).
10+
11+
Since the CartoSym encodings extend the [OGC Common Query Language (CQL2)](https://www.opengis.net/doc/IS/cql2/1.0), the [_libCQL2_](https://github.com/ecere/libCartoSym/tree/main/CQL2) dependency provides support for
12+
parsing and writing CQL2-Text and CQL2-JSON expressions, which themselves imply support for parsing and writing geometries defined in
13+
[Well-Known Text (WKT)](http://portal.opengeospatial.org/files/?artifact_id=25355) and [GeoJSON](https://tools.ietf.org/rfc/rfc7946.txt) which is provided by
14+
[_libSFGeometry_](https://github.com/ecere/libCartoSym/tree/main/SFGeometry) and [_libSFCollections_](https://github.com/ecere/libCartoSym/tree/main/SFCollections).
15+
The ability to perform spatial relation queries based on the [Dimensionally Extended-9 Intersection Model](https://en.wikipedia.org/wiki/DE-9IM) is provided by [_libDE9IM_](https://github.com/ecere/libCartoSym/tree/main/DE9IM).
16+
The [_libGeoExtents_](https://github.com/ecere/libCartoSym/tree/main/GeoExtents) library provides the foundational basic data structures for geographic points and extents.
17+
18+
Additional functionality related to implementing CartoSym 2.0 in renderers, such as the run-time evaluation of expressions and the generation of a symbology specifier for specific conditions, will also be integrated within this library.
19+
20+
Object-oriented bindings for _libCartoSym_ automatically generated using Ecere's [binding generating tool (bgen)](https://github.com/ecere/bgen) from the eC library will be available
21+
for the C, C++ and Python programming languages, with eventual support for Java and Rust planned as well.
22+
23+
## Building libCartoSym and dependency libraries
24+
25+
The recommended method to obtain and build libCartoSym and its dependency libraries is to follow the instructions in [BUILDING.md](BUILDING.md),
26+
or running [fetchAndBuild.sh](fetchAndBuild.sh) / [fetchAndBuild.bat](fetchAndBuild.bat).
27+
28+
This method will use the [stand-alone eC development kit and eC runtime library](https://github.com/ecere/eC) (using the `extras` branch with necessary additional modules),
29+
avoiding unnecessary dependencies on other components of the Ecere SDK runtime library.
30+
31+
The script will clone both the eC and libCartoSym repositories and build everything (not yet including bindings to other programming languages).

cs_canif_wrapper.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python
2+
import subprocess
3+
import sys
4+
import os
5+
6+
def main():
7+
binary_path = os.path.join(os.path.dirname(__file__), 'cs-canif')
8+
result = subprocess.run(
9+
[binary_path] + sys.argv[1:],
10+
stdin=sys.stdin,
11+
stdout=sys.stdout,
12+
stderr=sys.stderr)
13+
sys.exit(result.returncode)

libCartoSym

Submodule libCartoSym added at 28d95b3

0 commit comments

Comments
 (0)