diff -rudpN emulators/dynagen.orig/files/patch-dynagen emulators/dynagen/files/patch-dynagen --- emulators/dynagen.orig/files/patch-dynagen 1970-01-01 03:00:00.000000000 +0300 +++ emulators/dynagen/files/patch-dynagen 2017-04-21 15:06:40.935141000 +0300 @@ -0,0 +1,19 @@ +--- dynagen.orig 2017-04-21 12:04:48 UTC ++++ dynagen +@@ -947,6 +947,7 @@ class Dynagen: + def open_config(self, FILENAME): + """ Open the config file""" + ++ global CONFIGSPECPATH + # look for configspec in CONFIGSPECPATH and the same directory as dynagen + realpath = os.path.realpath(sys.argv[0]) + self.debug('realpath ' + realpath) +@@ -1443,7 +1444,7 @@ class Dynagen: + def import_ini(self, FILENAME): + """ Read in the INI file""" + +- global telnetstring ++ global telnetstring, INIPATH + # look for the INI file in the same directory as dynagen + realpath = os.path.realpath(sys.argv[0]) + pathname = os.path.dirname(realpath) diff -rudpN emulators/dynagen.orig/Makefile emulators/dynagen/Makefile --- emulators/dynagen.orig/Makefile 2017-04-21 15:25:44.970196000 +0300 +++ emulators/dynagen/Makefile 2017-04-22 11:48:17.847886000 +0300 @@ -3,7 +3,7 @@ PORTNAME= dynagen PORTVERSION= 0.11.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= emulators MASTER_SITES= SF/dyna-gen/${PORTNAME}%20source%20_%20Linux/${PORTNAME}%20${PORTVERSION} @@ -21,24 +21,35 @@ PORTDOCS= * PORTEXAMPLES= * PORTDATA= * -USES= dos2unix python shebangfix +USES= dos2unix shebangfix SHEBANG_FILES= *.py dynagen USE_PYTHON= distutils autoplist ALL_TARGET= # empty NO_ARCH= yes -.include +OPTIONS_SINGLE= PY +PY_DESC= Choose Python version +OPTIONS_DEFAULT= PYTHON2 +OPTIONS_SINGLE_PY= PYTHON2 PYTHON3 +PYTHON2_USES= python:2 +PYTHON3_USES= python:3 + +.include post-extract: @${CP} ${FILESDIR}/setup.py ${WRKSRC} post-patch: -.if ${PYTHON_MAJOR_VER} >= 3 - @${ECHO_MSG} "===> Converting to python${PYTHON_MAJOR_VER}" + ${REINPLACE_CMD} -E \ + -e "s|^(CONFIGSPECPATH = \[).*(])$$|\1 '${DATADIR}' \2|" \ + -e "s|^(INIPATH = \[).*(])$$|\1 '${PREFIX}/etc' \2|" \ + ${WRKSRC}/dynagen + +post-patch-PYTHON3-on: + @${ECHO_MSG} "===> Converting to python${PYTHON_MAJOR_VER}" ${PYTHONBASE}/bin/2to3-${PYTHON_VER} --no-diffs --write ${WRKSRC} ${WRKSRC}/dynagen - @${ECHO_MSG} "===> end of converting" -.endif + @${ECHO_MSG} "===> end of converting" post-install: ${INSTALL_SCRIPT} ${WRKSRC}/dynagen ${STAGEDIR}${PREFIX}/bin @@ -68,4 +79,4 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/sample_labs/simple2/simple2.net ${STAGEDIR}${EXAMPLESDIR}/sample_labs/simple2 ${INSTALL_DATA} ${WRKSRC}/sample_labs/all_config_options.txt ${STAGEDIR}${EXAMPLESDIR}/sample_labs -.include +.include