Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package: | ||
name: Cartopy | ||
version: 0.21.1 | ||
top-level: | ||
- cartopy | ||
source: | ||
url: https://files.pythonhosted.org/packages/e8/11/ed3e364b3910f0951821e6b5a03a03ce425464b72aa3da08d47b78ae17bd/Cartopy-0.21.1.tar.gz | ||
sha256: 89d5649712c8582231c6e11825a04c85f6f0cee94dbb89e4db23eabca1cc250a | ||
patches: | ||
- patches/0001-setup-geos-config.patch | ||
test: | ||
imports: | ||
- cartopy | ||
- cartopy.trace | ||
- cartopy.mpl.geoaxes | ||
- cartopy.crs | ||
requirements: | ||
host: | ||
- geos | ||
- numpy | ||
run: | ||
- shapely | ||
- pyshp | ||
- pyproj | ||
- geos | ||
- matplotlib | ||
- scipy | ||
|
||
build: | ||
vendor-sharedlib: true | ||
script: | | ||
export GEOS_CONFIG=${WASM_LIBRARY_DIR}/bin/geos-config | ||
echo ${GEOS_CONFIG} | ||
about: | ||
home: http://scitools.org.uk/cartopy | ||
PyPI: https://pypi.org/project/Cartopy/ | ||
summary: A library providing cartographic tools for python | ||
license: LGPL-3.0-or-later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/setup.py b/setup.py | ||
index 8e061479..c1b592ff 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -81,11 +81,12 @@ def file_walk_relative(top, remove=''): | ||
|
||
# GEOS | ||
try: | ||
- geos_version = subprocess.check_output(['geos-config', '--version']) | ||
+ geos_config = os.environ.get("GEOS_CONFIG", "/src/packages/.libs/bin/geos-config") | ||
+ geos_version = subprocess.check_output([geos_config, '--version']) | ||
geos_version = tuple(int(v) for v in geos_version.split(b'.') | ||
if 'dev' not in str(v)) | ||
- geos_includes = subprocess.check_output(['geos-config', '--includes']) | ||
- geos_clibs = subprocess.check_output(['geos-config', '--clibs']) | ||
+ geos_includes = subprocess.check_output([geos_config, '--includes']) | ||
+ geos_clibs = subprocess.check_output([geos_config, '--clibs']) | ||
except (OSError, ValueError, subprocess.CalledProcessError): | ||
warnings.warn( | ||
'Unable to determine GEOS version. Ensure you have %s or later ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from functools import reduce | ||
|
||
import pytest | ||
from pytest_pyodide import run_in_pyodide | ||
|
||
DECORATORS = [ | ||
pytest.mark.xfail_browsers(node="No supported matplotlib backends on node"), | ||
pytest.mark.skip_refcount_check, | ||
pytest.mark.skip_pyproxy_check, | ||
pytest.mark.driver_timeout(60), | ||
] | ||
|
||
|
||
def matplotlib_test_decorator(f): | ||
return reduce(lambda x, g: g(x), DECORATORS, f) | ||
|
||
|
||
@pytest.mark.driver_timeout(60) | ||
@run_in_pyodide(packages=["Cartopy"]) | ||
def test_imports(selenium): | ||
import cartopy | ||
import cartopy.trace | ||
|
||
print(cartopy, cartopy.trace) | ||
|
||
|
||
@matplotlib_test_decorator | ||
@run_in_pyodide(packages=["Cartopy", "matplotlib", "pyodide-http"]) | ||
def test_matplotlib(selenium): | ||
import io | ||
|
||
import cartopy.crs as ccrs | ||
import matplotlib.pyplot as plt | ||
import pyodide_http | ||
|
||
pyodide_http.patch_all() | ||
|
||
ax = plt.axes(projection=ccrs.PlateCarree()) | ||
ax.coastlines() | ||
|
||
fd = io.BytesIO() | ||
plt.savefig(fd, format="svg") | ||
|
||
content = fd.getvalue().decode("utf8") | ||
assert len(content) == 128402 | ||
assert content.startswith("<?xml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/src/iso19111/internal.cpp b/src/iso19111/internal.cpp | ||
index 4810202d..14fb8d83 100644 | ||
--- a/src/iso19111/internal.cpp | ||
+++ b/src/iso19111/internal.cpp | ||
@@ -242,6 +242,15 @@ bool ends_with(const std::string &str, const std::string &suffix) noexcept { | ||
double c_locale_stod(const std::string &s) { | ||
|
||
const auto s_size = s.size(); | ||
+ // Ensure that empty strings are parsed as 0.0, matching the behaviour of | ||
+ // <cstdlib>'s strtod | ||
+ // Without this patch, initialisation in Cartopy fails when an empty string | ||
+ // is passed to this function and an invalid argument exception is thrown. | ||
+ // This exception is not triggered in the non-Emscripten build. | ||
+ if (s_size == 0) { | ||
+ return 0.0; | ||
+ } | ||
+ | ||
// Fast path | ||
if (s_size > 0 && s_size < 15) { | ||
std::int64_t acc = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package: | ||
name: pyshp | ||
version: 2.3.1 | ||
top-level: | ||
- shapefile | ||
source: | ||
url: https://files.pythonhosted.org/packages/98/2f/68116db5b36b895c0450e3072b8cb6c2fac0359279b182ea97014d3c8ac0/pyshp-2.3.1-py2.py3-none-any.whl | ||
sha256: 67024c0ccdc352ba5db777c4e968483782dfa78f8e200672a90d2d30fd8b7b49 | ||
test: | ||
imports: | ||
- shapefile | ||
about: | ||
home: https://github.com/GeospatialPython/pyshp | ||
PyPI: https://pypi.org/project/pyshp | ||
summary: Pure Python read/write support for ESRI Shapefile format | ||
license: MIT |