Index: head/www/twms/Makefile =================================================================== --- head/www/twms/Makefile (revision 473563) +++ head/www/twms/Makefile (revision 473564) @@ -1,54 +1,53 @@ # Created by: Dmitry Marakasov # $FreeBSD$ PORTNAME= twms -PORTVERSION= 0.02w -PORTREVISION= 3 +PORTVERSION= 0.06y CATEGORIES= www astro MAINTAINER= amdmi3@FreeBSD.org COMMENT= Tiny WMS server LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pyproj>0:graphics/py-pyproj@${PY_FLAVOR} \ - ${PYTHON_SITELIBDIR}/web/__init__.py:www/webpy@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow@${PY_FLAVOR} + webpy>0:www/webpy@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}cairo>0:graphics/py-cairo@${PY_FLAVOR} \ + ${FREESANS}:x11-fonts/freefont-ttf USE_GITHUB= yes GH_ACCOUNT= Komzpa -USES= python:2.7 shebangfix tar:bzip2 -SHEBANG_FILES= twms.py -NO_BUILD= yes +USES= python +USE_PYTHON= distutils py3kplist optsuffix NO_ARCH= yes -TWMS_USER?= twms -TWMS_GROUP?= twms -TWMS_CACHEDIR?= /var/cache/twms +FREESANS= ${LOCALBASE}/share/fonts/freefont-ttf/FreeSans.ttf -SUB_FILES= pkg-install pkg-deinstall -SUB_LIST= USER=${TWMS_USER} GROUP=${TWMS_GROUP} CACHEDIR=${TWMS_CACHEDIR} - USE_RC_SUBR= twms -USERS= ${TWMS_USER} -GROUPS= ${TWMS_GROUP} +USERS= twms +GROUPS= twms +PLIST_SUB= USER=${USERS} GROUP=${GROUPS} +SUB_LIST= USER=${USERS} PYTHON_CMD="${PYTHON_CMD}" + +OPTIONS_DEFINE= DOCS + post-patch: - @${REINPLACE_CMD} -e 's|/etc/twms/twms.conf|${PREFIX}/etc/twms.conf|' ${WRKSRC}/twms/twms.py - @${REINPLACE_CMD} -e '/tiles_cache =/ s|".*"|"${TWMS_CACHEDIR}/cache/"|; \ - /install_path =/ s|".*"|"${DATADIR}/"|; \ - /gpx_cache =/ s|".*"|"${TWMS_CACHEDIR}/traces/"|; \ - s|import fetchers|from twms &|' ${WRKSRC}/twms/twms.conf + @${REINPLACE_CMD} -e 's|/etc/twms/twms.conf|${PREFIX}/etc/twms/twms.conf|' \ + ${WRKSRC}/twms/twms.py + @${REINPLACE_CMD} -e '/install_path/ s|/usr/share/twms/|${DATADIR}/|' \ + -e 's|/usr/share/fonts/truetype/freefont/FreeSans.ttf|${FREESANS}|' \ + ${WRKSRC}/twms/twms.conf -do-install: - @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/twms - ${INSTALL_DATA} ${WRKSRC}/twms/*.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/twms/ - ${INSTALL_SCRIPT} ${WRKSRC}/twms.py ${STAGEDIR}${PREFIX}/bin/twms - @${MKDIR} ${STAGEDIR}${DATADIR} - ${INSTALL_DATA} ${WRKSRC}/*.jpg ${STAGEDIR}${DATADIR}/ - ${INSTALL_DATA} ${WRKSRC}/twms/twms.conf ${STAGEDIR}${PREFIX}/etc/twms.conf.default +post-install: + @${MV} ${STAGEDIR}${ETCDIR}/twms.conf ${STAGEDIR}${ETCDIR}/twms.conf.sample + @${RM} ${STAGEDIR}${DOCSDIR}/COPYING + @${RM} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/twms/twms.conf + @${MKDIR} ${STAGEDIR}/var/cache/twms/tiles + @${MKDIR} ${STAGEDIR}/var/cache/twms/traces .include Index: head/www/twms/distinfo =================================================================== --- head/www/twms/distinfo (revision 473563) +++ head/www/twms/distinfo (revision 473564) @@ -1,3 +1,3 @@ -TIMESTAMP = 1476144541 -SHA256 (Komzpa-twms-0.02w_GH0.tar.gz) = a93f66a06be76d541747f370cc17e9568060cb4d4d9b9b41d135ce46d60a2c38 -SIZE (Komzpa-twms-0.02w_GH0.tar.gz) = 36022 +TIMESTAMP = 1526309311 +SHA256 (Komzpa-twms-0.06y_GH0.tar.gz) = bc699f8a947d4e240c8a2b7944893bdf5690de8f57d633f8e2300cfc00e39a71 +SIZE (Komzpa-twms-0.06y_GH0.tar.gz) = 30018 Index: head/www/twms/files/patch-twms__fetchers.py =================================================================== --- head/www/twms/files/patch-twms__fetchers.py (revision 473563) +++ head/www/twms/files/patch-twms__fetchers.py (nonexistent) @@ -1,18 +0,0 @@ ---- twms/fetchers.py.orig 2014-10-07 11:58:04 UTC -+++ twms/fetchers.py -@@ -21,7 +21,7 @@ - import math - import sys - import StringIO --import Image -+from PIL import Image - - import config - import projections -@@ -115,4 +115,4 @@ - tne.close() - os.remove(local+ this_layer["ext"]) - return False -- return im -\ No newline at end of file -+ return im Property changes on: head/www/twms/files/patch-twms__fetchers.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/patch-twms__drawing.py =================================================================== --- head/www/twms/files/patch-twms__drawing.py (revision 473563) +++ head/www/twms/files/patch-twms__drawing.py (nonexistent) @@ -1,18 +0,0 @@ ---- twms/drawing.py.orig 2014-10-07 11:57:57 UTC -+++ twms/drawing.py -@@ -13,7 +13,7 @@ - - # You should have received a copy of the GNU General Public License - # along with tWMS. If not, see . --import Image, ImageDraw -+from PIL import Image, ImageDraw - import urllib - import os, sys - -@@ -79,4 +79,4 @@ - draw.ellipse((coords[0][0]-3,coords[0][1]-3,coords[0][0]+3,coords[0][1]+3),fill=color,outline=color) - elif geometry == "POLYGON": - draw.polygon(coords, fill=color, outline=color) -- return img -\ No newline at end of file -+ return img Property changes on: head/www/twms/files/patch-twms__drawing.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/patch-twms__canvas.py =================================================================== --- head/www/twms/files/patch-twms__canvas.py (revision 473563) +++ head/www/twms/files/patch-twms__canvas.py (nonexistent) @@ -1,18 +0,0 @@ ---- twms/canvas.py.orig 2014-10-07 11:58:01 UTC -+++ twms/canvas.py -@@ -24,7 +24,7 @@ - - - import projections --import Image, ImageFilter -+from PIL import Image, ImageFilter - import urllib2 - import StringIO - import datetime -@@ -132,4 +132,4 @@ - tiles = self.tiles.keys() - for tile in tiles: - self.tiles[tile]["im"] = self.tiles[tile]["im"].filter(ImageFilter.MedianFilter(size)) -- self.tiles[tile]["pix"] = self.tiles[tile]["im"].load() -\ No newline at end of file -+ self.tiles[tile]["pix"] = self.tiles[tile]["im"].load() Property changes on: head/www/twms/files/patch-twms__canvas.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/pkg-install.in =================================================================== --- head/www/twms/files/pkg-install.in (revision 473563) +++ head/www/twms/files/pkg-install.in (nonexistent) @@ -1,12 +0,0 @@ -#!/bin/sh - -if [ "$2" = "POST-INSTALL" ]; then - if [ ! -d "%%CACHEDIR%%" ]; then - mkdir -p "%%CACHEDIR%%/cache" || exit 1 - mkdir -p "%%CACHEDIR%%/traces" || exit 1 - chown -R "%%USER%%:%%GROUP%%" "%%CACHEDIR%%" || exit 1 - chmod -R 0775 "%%CACHEDIR%%" || exit 1 - fi -fi - -exit 0 Property changes on: head/www/twms/files/pkg-install.in ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/patch-twms__filter.py =================================================================== --- head/www/twms/files/patch-twms__filter.py (revision 473563) +++ head/www/twms/files/patch-twms__filter.py (nonexistent) @@ -1,13 +0,0 @@ ---- twms/filter.py.orig 2014-10-07 11:57:53 UTC -+++ twms/filter.py -@@ -15,8 +15,8 @@ - # along with tWMS. If not, see . - - --import ImageFilter --import ImageEnhance -+from PIL import ImageFilter -+from PIL import ImageEnhance - - def raster(result_img, filt): - """ Property changes on: head/www/twms/files/patch-twms__filter.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/pkg-deinstall.in =================================================================== --- head/www/twms/files/pkg-deinstall.in (revision 473563) +++ head/www/twms/files/pkg-deinstall.in (nonexistent) @@ -1,13 +0,0 @@ -#!/bin/sh - -if [ "$2" = "POST-DEINSTALL" ]; then - echo "===> Removing tWMS cache directory" - rm -rf "%%CACHEDIR%%" || exit 1 - - echo "===> Removing tWMS user and group" - if pw usershow "%%USER%%" >/dev/null 2>&1; then - pw userdel "%%USER%%" || exit 1 - fi -fi - -exit 0 Property changes on: head/www/twms/files/pkg-deinstall.in ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/patch-twms__reproject.py =================================================================== --- head/www/twms/files/patch-twms__reproject.py (revision 473563) +++ head/www/twms/files/patch-twms__reproject.py (nonexistent) @@ -1,11 +0,0 @@ ---- twms/reproject.py.orig 2014-10-07 11:58:11 UTC -+++ twms/reproject.py -@@ -14,7 +14,7 @@ - # You should have received a copy of the GNU General Public License - # along with tWMS. If not, see . - --import Image -+from PIL import Image - import projections - import sys - Property changes on: head/www/twms/files/patch-twms__reproject.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/www/twms/files/patch-setup.py =================================================================== --- head/www/twms/files/patch-setup.py (nonexistent) +++ head/www/twms/files/patch-setup.py (revision 473564) @@ -0,0 +1,20 @@ +--- setup.py.orig 2018-05-08 12:10:19 UTC ++++ setup.py +@@ -11,7 +11,7 @@ is_windows = __platform__ in ['Windows'] + __name__ = "twms" + + def read(fname): +- return open(os.path.join(os.path.dirname(__file__), fname)).read() ++ return open(os.path.join(os.path.dirname(__file__), fname), 'rb').read().decode('utf-8') + + def glob(fname): + return abs_glob(os.path.join(os.path.dirname(__file__), fname)) +@@ -25,7 +25,7 @@ def man_files(pattern): + + def config_files(): + if not is_windows: +- return [(os.path.join('/etc', __name__), [os.path.join('twms', 'twms.conf')])] ++ return [(os.path.join('etc', __name__), [os.path.join('twms', 'twms.conf')])] + else: + return [] + Property changes on: head/www/twms/files/patch-setup.py ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/www/twms/files/twms.in =================================================================== --- head/www/twms/files/twms.in (revision 473563) +++ head/www/twms/files/twms.in (revision 473564) @@ -1,40 +1,34 @@ #!/bin/sh # # PROVIDE: twms # REQUIRE: DAEMON NETWORKING LOGIN # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable twms: # twms_enable="YES" . /etc/rc.subr name=twms rcvar=twms_enable -twms_enable=${twms_enable:-"NO"} -twms_user=%%USER%% -twms_group=%%GROUP%% -start_cmd="${name}_start" -stop_cmd="${name}_stop" -pidfile="/var/run/${name}.pid" -command="%%PREFIX%%/bin/twms" - load_rc_config $name +: ${twms_enable="NO"} +: ${twms_user="${name}"} + +pidfile=/var/run/${name}.pid +procname=/usr/local/bin/twms +command_interpreter="%%PYTHON_CMD%%" +start_cmd="twms_start" + +pidfile=/var/run/${name}.pid +command="%%PREFIX%%/bin/${name}" + twms_start() { - su -m ${twms_user} -c "nohup $command >/dev/null 2>&1 & echo \$! " | tail -1 > ${pidfile} -} - -twms_stop() -{ - if [ -f ${pidfile} ]; then - rc_pid=`cat ${pidfile}` - kill -TERM $rc_pid - wait_for_pids $rc_pid - rm ${pidfile} - fi + echo "Starting ${name}." + /usr/sbin/daemon -c -f -p ${pidfile} -u ${twms_user} ${command_interpreter} ${procname} } run_rc_command "$1" Index: head/www/twms/pkg-plist =================================================================== --- head/www/twms/pkg-plist (revision 473563) +++ head/www/twms/pkg-plist (revision 473564) @@ -1,19 +1,57 @@ bin/twms -@sample etc/twms.conf.default etc/twms.conf +@sample %%ETCDIR%%/twms.conf.sample %%PYTHON_SITELIBDIR%%/twms/__init__.py +%%PYTHON_SITELIBDIR%%/twms/__init__.pyc +%%PYTHON_SITELIBDIR%%/twms/__init__.pyo %%PYTHON_SITELIBDIR%%/twms/bbox.py +%%PYTHON_SITELIBDIR%%/twms/bbox.pyc +%%PYTHON_SITELIBDIR%%/twms/bbox.pyo %%PYTHON_SITELIBDIR%%/twms/canvas.py +%%PYTHON_SITELIBDIR%%/twms/canvas.pyc +%%PYTHON_SITELIBDIR%%/twms/canvas.pyo %%PYTHON_SITELIBDIR%%/twms/capabilities.py +%%PYTHON_SITELIBDIR%%/twms/capabilities.pyc +%%PYTHON_SITELIBDIR%%/twms/capabilities.pyo %%PYTHON_SITELIBDIR%%/twms/correctify.py +%%PYTHON_SITELIBDIR%%/twms/correctify.pyc +%%PYTHON_SITELIBDIR%%/twms/correctify.pyo +%%PYTHON_SITELIBDIR%%/twms/daemon.py +%%PYTHON_SITELIBDIR%%/twms/daemon.pyc +%%PYTHON_SITELIBDIR%%/twms/daemon.pyo %%PYTHON_SITELIBDIR%%/twms/drawing.py +%%PYTHON_SITELIBDIR%%/twms/drawing.pyc +%%PYTHON_SITELIBDIR%%/twms/drawing.pyo %%PYTHON_SITELIBDIR%%/twms/fetchers.py +%%PYTHON_SITELIBDIR%%/twms/fetchers.pyc +%%PYTHON_SITELIBDIR%%/twms/fetchers.pyo %%PYTHON_SITELIBDIR%%/twms/filter.py +%%PYTHON_SITELIBDIR%%/twms/filter.pyc +%%PYTHON_SITELIBDIR%%/twms/filter.pyo %%PYTHON_SITELIBDIR%%/twms/gpxparse.py +%%PYTHON_SITELIBDIR%%/twms/gpxparse.pyc +%%PYTHON_SITELIBDIR%%/twms/gpxparse.pyo %%PYTHON_SITELIBDIR%%/twms/overview.py +%%PYTHON_SITELIBDIR%%/twms/overview.pyc +%%PYTHON_SITELIBDIR%%/twms/overview.pyo %%PYTHON_SITELIBDIR%%/twms/projections.py +%%PYTHON_SITELIBDIR%%/twms/projections.pyc +%%PYTHON_SITELIBDIR%%/twms/projections.pyo %%PYTHON_SITELIBDIR%%/twms/reproject.py +%%PYTHON_SITELIBDIR%%/twms/reproject.pyc +%%PYTHON_SITELIBDIR%%/twms/reproject.pyo %%PYTHON_SITELIBDIR%%/twms/sketch.py +%%PYTHON_SITELIBDIR%%/twms/sketch.pyc +%%PYTHON_SITELIBDIR%%/twms/sketch.pyo %%PYTHON_SITELIBDIR%%/twms/twms.py +%%PYTHON_SITELIBDIR%%/twms/twms.pyc +%%PYTHON_SITELIBDIR%%/twms/twms.pyo +%%PORTDOCS%%%%DOCSDIR%%/README.md +share/man/man1/twms.1 %%DATADIR%%/irs_nxt.jpg +%%DATADIR%%/tools/compile_correction.py +%%DATADIR%%/tools/decompile_correction.py %%DATADIR%%/yahoo_nxt.jpg %%DATADIR%%/yandex_nxt.jpg +@dir(%%USER%%,%%GROUP%%,775) /var/cache/twms/tiles +@dir(%%USER%%,%%GROUP%%,775) /var/cache/twms/traces +@dir /var/cache/twms