commit 841e3880e534b2d0f468818430ec7336ebd3b1d7
parent 3856f7ab12eb8d380b49803e1506ca6a13257d0f
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Sun, 22 Nov 2020 19:15:03 +0300
Add maprec
Diffstat:
4 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/nix/sources.json b/nix/sources.json
@@ -569,6 +569,20 @@
"url": "https://github.com/OpenOrienteering/mapper/archive/d17d1e46232f1e481be86bc5d9b6ecebcd4fd81b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
+ "maprec": {
+ "branch": "master",
+ "builtin": false,
+ "date": "2019-10-24T18:36:24Z",
+ "description": null,
+ "homepage": "https://github.com/wladich/maprec",
+ "owner": "wladich",
+ "repo": "maprec",
+ "rev": "20f5177cae7454455b21cd5f7178f5639c02d385",
+ "sha256": "1zy49sbpxjg5dvkvxxxy2fh1vq26q0cnjdszb5zpwnxqmk7c4lpj",
+ "type": "tarball",
+ "url": "https://github.com/wladich/maprec/archive/20f5177cae7454455b21cd5f7178f5639c02d385.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
"mapsoft": {
"branch": "master",
"builtin": false,
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -120,6 +120,7 @@ lib.makeScope newScope (
click-6-7 = callPackage ./development/python-modules/click { };
gpxelevations = callPackage ./development/python-modules/gpxelevations { };
jsonseq = callPackage ./development/python-modules/jsonseq { };
+ maprec = callPackage ./development/python-modules/maprec { };
mercantile = callPackage ./development/python-modules/mercantile { };
mikatools = callPackage ./development/python-modules/mikatools { };
pyephem = callPackage ./development/python-modules/pyephem { };
diff --git a/pkgs/development/python-modules/maprec/default.nix b/pkgs/development/python-modules/maprec/default.nix
@@ -0,0 +1,25 @@
+{ lib, python3Packages, thinplatespline, sources }:
+
+python3Packages.buildPythonPackage {
+ pname = "maprec";
+ version = lib.substring 0 10 sources.maprec.date;
+
+ src = sources.maprec;
+
+ patches = [ ./python3.patch ];
+
+ postPatch = "2to3 -n -w maprec/*.py";
+
+ propagatedBuildInputs = with python3Packages; [ pyyaml pyproj thinplatespline ];
+
+ doCheck = false;
+
+ pythonImportsCheck = [ "maprec" ];
+
+ meta = with lib; {
+ inherit (sources.maprec) description homepage;
+ license = licenses.free;
+ maintainers = [ maintainers.sikmir ];
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/development/python-modules/maprec/python3.patch b/pkgs/development/python-modules/maprec/python3.patch
@@ -0,0 +1,13 @@
+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):