-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
53 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,15 @@ resolver = "2" | |
members = ["./japan-geoid-*"] | ||
|
||
[workspace.package] | ||
version = "0.3.0" | ||
version = "0.3.1" | ||
edition = "2021" | ||
authors = [ | ||
"Taku Fukada <[email protected]>", | ||
"MIERUNE Inc. <[email protected]>", | ||
] | ||
description = "Calculates geoid heights for Japan using GSI's geoid model." | ||
license-file = "LICENSE.txt" | ||
license = "MIT" | ||
repository = "https://github.com/MIERUNE/japan-geoid" | ||
categories = ["science", "science::geo"] | ||
|
||
|
@@ -23,6 +24,7 @@ edition.workspace = true | |
categories.workspace = true | ||
authors.workspace = true | ||
description.workspace = true | ||
license = "MIT" | ||
license-file.workspace = true | ||
repository.workspace = true | ||
|
||
|
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ authors = [ | |
{ name = "Taku Fukada", email = "[email protected]" }, | ||
{ name = "MIERUNE Inc.", email = "[email protected]" }, | ||
] | ||
license = { file = "LICENSE.txt" } | ||
license = "MIT" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
|
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,37 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
pkg = Path("./pkg") | ||
|
||
with open(pkg / "package.json", encoding="utf-8") as f: | ||
package = json.load(f) | ||
|
||
package["type"] = "module" | ||
package["main"] = "japan_geoid.js" | ||
|
||
with open(pkg / "package.json", "w", encoding="utf-8") as f: | ||
json.dump(package, f, indent=2) | ||
|
||
|
||
with open(pkg / "japan_geoid.js", encoding="utf-8") as f: | ||
lines = f.readlines() | ||
|
||
patched = False | ||
with open(pkg / "japan_geoid.js", "w", encoding="utf-8") as f: | ||
for line in lines: | ||
if line.strip() == "input = fetch(input);": | ||
f.write( | ||
"""try { | ||
input = await fetch(input); | ||
} catch (e) { | ||
if (!(e instanceof TypeError)) { | ||
throw e; | ||
} | ||
input = await (await import("node:fs/promises")).readFile(input); | ||
}""" | ||
) | ||
patched = True | ||
else: | ||
f.write(line) | ||
|
||
assert patched |