commit bcdfbca6cc69f8d079f58d13b8b9c5050ab2cdeb
parent a974d443fda325967aeef07cdda639a4a0327be7
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Sun, 30 Oct 2022 07:02:32 +0300
Up
Diffstat:
8 files changed, 39 insertions(+), 128 deletions(-)
diff --git a/pkgs/nakarte/map-tiler/default.nix b/pkgs/nakarte/map-tiler/default.nix
@@ -4,61 +4,51 @@
, fetchFromGitHub
, gobject-introspection
, pango
+, thinplatespline
, maprec
, ozi_map
, pyimagequant
+, wrapGAppsHook
}:
python3Packages.buildPythonApplication rec {
pname = "map-tiler";
- version = "2019-10-24";
+ version = "2022-08-06";
src = fetchFromGitHub {
owner = "wladich";
repo = "map-tiler";
- rev = "1dc5be65e58638f5899cd6cdc2010e00ce5e62d4";
- hash = "sha256-2wDhU1wbvyEAAYUQXUGASmK5X0/XNQF9P2y9pfHhHHg=";
+ rev = "28372c77f73282c234a236ad59672ed28721d88b";
+ hash = "sha256-P5HXWCxxcGX/QRcRVsMAng/aZI0zBjkOgSEyVCjuAYg=";
};
- patches = [
- ./gobject.patch
- ./python3.patch
- ];
-
postPatch = ''
- 2to3 -n -w *.py lib/*.py
- substituteInPlace tiles_update.py \
- --replace "from . import image_store" "import image_store" \
- --replace "from .lib" "from lib"
+ substituteInPlace setup.cfg \
+ --replace " @ git+https://github.com/wladich/thinplatespline.git" "" \
+ --replace " @ git+https://github.com/wladich/maprec.git" "" \
+ --replace " @ git+https://github.com/wladich/ozi_map.git" "" \
+ --replace " @ git+https://github.com/wladich/pyimagequant.git" ""
'';
- nativeBuildInputs = [ gobject-introspection pango ];
+ nativeBuildInputs = [ gobject-introspection wrapGAppsHook ];
+
+ buildInputs = [ gobject-introspection pango ];
- pythonPath = with python3Packages; [
+ propagatedBuildInputs = with python3Packages; [
+ pyyaml
+ pyproj
+ pypng
pillow
- purepng
- pygobject3
pycairo
+ thinplatespline
maprec
ozi_map
pyimagequant
+ pygobject3
];
- dontUseSetuptoolsBuild = true;
-
doCheck = false;
- installPhase = ''
- site_packages=$out/lib/${python3Packages.python.libPrefix}/site-packages
- mkdir -p $site_packages
- cp -r *.py lib $site_packages
-
- buildPythonPath "$out $pythonPath"
- makeWrapper $site_packages/tiles_update.py $out/bin/tiles_update \
- --set PYTHONPATH $site_packages:$program_PYTHONPATH \
- --set GI_TYPELIB_PATH $GI_TYPELIB_PATH
- '';
-
meta = with lib; {
description = "Raster maps to map tiles";
inherit (src.meta) homepage;
diff --git a/pkgs/nakarte/map-tiler/gobject.patch b/pkgs/nakarte/map-tiler/gobject.patch
@@ -1,27 +0,0 @@
-diff --git i/lib/attribution.py w/lib/attribution.py
-index 1422bb6..1e07064 100644
---- i/lib/attribution.py
-+++ w/lib/attribution.py
-@@ -1,8 +1,11 @@
- # coding: utf-8
- from PIL import Image
- import cairo
--import pango
--import pangocairo
-+import gi
-+gi.require_version('Pango', '1.0')
-+gi.require_version('PangoCairo', '1.0')
-+from gi.repository import Pango as pango
-+from gi.repository import PangoCairo as pangocairo
- import math
-
-
-@@ -27,7 +30,7 @@ def check_font_installed():
-
-
- def create_path(ctx, text, font_size_px, rotate):
-- check_font_installed()
-+ #check_font_installed()
- ctx.set_line_width(font_size_px / 5.)
- ctx.set_line_join(cairo.LINE_JOIN_ROUND)
- ctx.save()
diff --git a/pkgs/nakarte/map-tiler/python3.patch b/pkgs/nakarte/map-tiler/python3.patch
@@ -1,38 +0,0 @@
-diff --git i/tiles_update.py w/tiles_update.py
-index 2d73b9a..88be9da 100755
---- i/tiles_update.py
-+++ w/tiles_update.py
-@@ -124,10 +124,10 @@ class JobManager(object):
- fingerprint = maprecord.fingerprint
- attrib_filename = attribution.get_attrib_path(maprecord.image_path)
- if os.path.exists(attrib_filename):
-- fingerprint = hashlib.sha1(fingerprint)
-- fingerprint.update(':~:' + open(attrib_filename).read())
-+ fingerprint = hashlib.sha1(str(fingerprint).encode('utf-8'))
-+ fingerprint.update(str(':~:' + open(attrib_filename).read()).encode('utf-8'))
- info_filename = attribution.get_info_path(maprecord.image_path)
-- fingerprint.update(':~:' + open(info_filename).read())
-+ fingerprint.update(str(':~:' + open(info_filename).read()).encode('utf-8'))
- fingerprint = fingerprint.hexdigest()
- return fingerprint
-
-@@ -225,8 +225,8 @@ def get_reprojected_image(tile_x, tile_y, level, map_reference):
- src_has_alpha = True
- cell_size = 64
- mesh = []
-- for cell_x in xrange(tile_size / cell_size):
-- for cell_y in xrange(tile_size / cell_size):
-+ for cell_x in xrange(int(tile_size / cell_size)):
-+ for cell_y in xrange(int(tile_size / cell_size)):
- x1 = cell_x * cell_size
- y1 = cell_y * cell_size
- x2 = x1 + cell_size
-@@ -370,7 +370,7 @@ def build_overviews(altered_tiles):
-
-
- def filename_arg_type(s):
-- return s.decode(sys.getfilesystemencoding())
-+ return s
-
-
- def parse_image_format(s):
diff --git a/pkgs/nakarte/maprec/default.nix b/pkgs/nakarte/maprec/default.nix
@@ -2,18 +2,19 @@
python3Packages.buildPythonPackage rec {
pname = "maprec";
- version = "2019-10-24";
+ version = "2022-08-06";
src = fetchFromGitHub {
owner = "wladich";
repo = "maprec";
- rev = "20f5177cae7454455b21cd5f7178f5639c02d385";
- hash = "sha256-8lLCzqy4W35/WV83aRnARuAdoBO+977nbuXJfpdOxP8=";
+ rev = "3332183a8010bceba564078cdb05ab6c02ac852e";
+ hash = "sha256-2V1n6XEXPePA5YB8dKlBgTtbL2/2qG2KBdsHbekETXE=";
};
- patches = [ ./python3.patch ];
-
- postPatch = "2to3 -n -w maprec/*.py";
+ postPatch = ''
+ substituteInPlace setup.py \
+ --replace " @ git+https://github.com/wladich/thinplatespline.git" ""
+ '';
propagatedBuildInputs = with python3Packages; [ pyyaml pyproj thinplatespline ];
diff --git a/pkgs/nakarte/maprec/python3.patch b/pkgs/nakarte/maprec/python3.patch
@@ -1,13 +0,0 @@
-diff --git i/maprec/map_record.py w/maprec/map_record.py
-index 2a58b0f..d1ce585 100644
---- i/maprec/map_record.py
-+++ w/maprec/map_record.py
-@@ -161,7 +161,7 @@ class Maprecord(object):
- data['image_size'] = os.path.getsize(self.image_path)
- data['image_mtime'] = os.path.getmtime(self.image_path)
- data = json.dumps(data)
-- self._fingerprint = hashlib.sha1(data).hexdigest()
-+ self._fingerprint = hashlib.sha1(str(data).encode('utf-8')).hexdigest()
- return self._fingerprint
-
- #def write(filename, image_path, srs, gcps, cutline=None, image_path_relative=True):
diff --git a/pkgs/nakarte/ozi_map/default.nix b/pkgs/nakarte/ozi_map/default.nix
@@ -2,16 +2,19 @@
python3Packages.buildPythonPackage rec {
pname = "ozi_map";
- version = "2019-10-24";
+ version = "2022-08-05";
src = fetchFromGitHub {
owner = "wladich";
repo = "ozi_map";
- rev = "4d6bd3f234960ba90d82e6d58da9c1bf4677eb16";
- hash = "sha256-sbAKi9GZEPmbI1Nq3l4uSh/tVNLXAY2siXu3YtHI5qo=";
+ rev = "abd9e86d621ef5de89986e92b9e97e54b3173af4";
+ hash = "sha256-leYn+Z0BLptvtmHglwvmhzjHUZh0XEZ9LEBQHDCjfNc=";
};
- postPatch = "2to3 -n -w ozi_map/*.py";
+ postPatch = ''
+ substituteInPlace setup.py \
+ --replace " @ git+https://github.com/wladich/maprec.git" ""
+ '';
propagatedBuildInputs = with python3Packages; [ maprec pyproj ];
diff --git a/pkgs/nakarte/pyimagequant/default.nix b/pkgs/nakarte/pyimagequant/default.nix
@@ -2,13 +2,13 @@
python3Packages.buildPythonPackage rec {
pname = "pyimagequant";
- version = "2019-10-24";
+ version = "2022-06-10";
src = fetchFromGitHub {
owner = "wladich";
repo = "pyimagequant";
- rev = "a467b3b2566f4edd31a272738f7c5e646c0d84a9";
- hash = "sha256-yBtZsCaFJxPfI8EWyGatepGzE6+1BFUQ2h+ElH9Unqo=";
+ rev = "55a76cb90c75b598d40bd92cf61e6ec9aa846d1e";
+ hash = "sha256-80SsAcN0iEaEEQpNTsi81n71DEQksSYiaSe/LQpqMbc=";
fetchSubmodules = true;
};
diff --git a/pkgs/nakarte/thinplatespline/default.nix b/pkgs/nakarte/thinplatespline/default.nix
@@ -2,20 +2,15 @@
python3Packages.buildPythonPackage rec {
pname = "thinplatespline";
- version = "2013-01-23";
+ version = "2022-06-02";
src = fetchFromGitHub {
owner = "wladich";
repo = "thinplatespline";
- rev = "55fecd22c7160577b925e03169e74bd488a41cf3";
- hash = "sha256-t15iO+3UZKnORiQaYoGD4RLZx2SHtCbjg+Qr+sAHQHY=";
+ rev = "acedd7aa9eef7f66a54df53a9596a0b4d95af92b";
+ hash = "sha256-/RLcB+xq1U7AKx26brw4gG29AMJB1LedC+5MNbK/rxI=";
};
- postPatch = ''
- 2to3 -n -w tps/*.py
- substituteInPlace tps/__init__.py --replace "_tps" "._tps"
- '';
-
doCheck = false;
pythonImportsCheck = [ "tps" ];