Skip to content

Commit a74939f

Browse files
committed
Support for python 3 (fix #23), release 1.6
1 parent 3415338 commit a74939f

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Nik4 Change History
22

3-
## *master*
3+
## 1.6, 1.06.2016
44

55
* `--version` option.
66
* Added `--fonts` option for registering additional fonts. [#16](https://github.com/Zverik/Nik4/issues/16)
77
* Fixed `--center` with `--scale` error. [#18](https://github.com/Zverik/Nik4/issues/18)
88
* Swapped sizes 4A0 and 2A0. [#17](https://github.com/Zverik/Nik4/issues/17)
9+
* Support Python 3. [#23](https://github.com/Zverik/Nik4/issues/23)
910

1011
## 1.5, 7.12.2014
1112

nik4.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
except ImportError:
1515
HAS_CAIRO = False
1616

17-
VERSION = '1.5.2'
17+
VERSION = '1.6'
1818
TILE_BUFFER = 128
1919
IM_MONTAGE = 'montage'
2020

@@ -376,12 +376,12 @@ def add_fonts(path):
376376
select_layers(m, options.add_layers.split(',') if options.add_layers else [], options.hide_layers.split(',') if options.hide_layers else [])
377377

378378
if options.debug:
379-
print 'scale={}'.format(scale)
380-
print 'scale_factor={}'.format(scale_factor)
381-
print 'size={},{}'.format(size[0], size[1])
382-
print 'bbox={}'.format(bbox)
383-
print 'bbox_wgs84={}'.format(transform.backward(bbox) if bbox else None)
384-
print 'layers=' + ','.join([l.name for l in m.layers if l.active])
379+
print('scale={}'.format(scale))
380+
print('scale_factor={}'.format(scale_factor))
381+
print('size={},{}'.format(size[0], size[1]))
382+
print('bbox={}'.format(bbox))
383+
print('bbox_wgs84={}'.format(transform.backward(bbox) if bbox else None))
384+
print('layers=' + ','.join([l.name for l in m.layers if l.active]))
385385

386386
# generate metadata
387387
if options.ozi:
@@ -424,14 +424,14 @@ def add_fonts(path):
424424
m.buffer_size = TILE_BUFFER
425425
tile_cnt = [int(math.ceil(1.0 * size[0] / width)), int(math.ceil(1.0 * size[1] / height))]
426426
if options.debug:
427-
print 'tile_count={},{}'.format(tile_cnt[0], tile_cnt[1])
428-
print 'tile_size={},{}'.format(width, height)
427+
print('tile_count={},{}'.format(tile_cnt[0], tile_cnt[1]))
428+
print('tile_size={},{}'.format(width, height))
429429
tmp_tile = '{:02d}_{:02d}_{}'
430430
tile_files = []
431431
for row in range(0, tile_cnt[1]):
432432
for column in range(0, tile_cnt[0]):
433433
if options.debug:
434-
print 'tile={},{}'.format(row, column)
434+
print('tile={},{}'.format(row, column))
435435
tile_bbox = mapnik.Box2d(bbox.minx + 1.0 * width * scale * column, bbox.maxy - 1.0 * height * scale * row, bbox.minx + 1.0 * width * scale * (column + 1), bbox.maxy - 1.0 * height * scale * (row + 1))
436436
tile_size = [width if column < tile_cnt[0] - 1 else size[0] - width * (tile_cnt[0] - 1), height if row < tile_cnt[1] - 1 else size[1] - height * (tile_cnt[1] - 1)]
437437
m.zoom_to_box(tile_bbox)
@@ -465,5 +465,5 @@ def add_fonts(path):
465465
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
466466

467467
outfile.seek(0)
468-
print outfile.read()
468+
print(outfile.read())
469469
outfile.close()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='Nik4',
5-
version='1.5.2',
5+
version='1.6.0',
66
license='WTFPL',
77
description='Command-line interface to a Mapnik rendering toolkit',
88
long_description="""

0 commit comments

Comments
 (0)