From 74ca516d4499b051eea06cba5e28329153825ce8 Mon Sep 17 00:00:00 2001 From: Li-Wen Hsu Date: Sat, 22 Sep 2012 14:04:11 +0000 Subject: [PATCH] - Tweak USE_PYTHON to -2.7 to match upstream compatibility - Switch from distutils to easy_install (update pkg_plist to suit) - Add OptionsNG for SENDFILE and OPENSSL support - Add test: target to run unit tests - Patch: setup.py - Add zip_safe=False to install egg uncompressed - Add test_suite for running unit tests via setup.py - Patch: test/test_* - add path hacks to test WRKSRC sources PR: ports/171682 Submitted by: Kubilay Kocak --- ftp/py-pyftpdlib/Makefile | 27 ++++++++++- ftp/py-pyftpdlib/files/patch-setup.py | 23 ++++----- .../files/patch-test__test_contrib.py | 26 ++++++++++ .../files/patch-test__test_ftpd.py | 11 +++++ ftp/py-pyftpdlib/pkg-plist | 47 +++++++++++-------- 5 files changed, 99 insertions(+), 35 deletions(-) create mode 100644 ftp/py-pyftpdlib/files/patch-test__test_contrib.py create mode 100644 ftp/py-pyftpdlib/files/patch-test__test_ftpd.py diff --git a/ftp/py-pyftpdlib/Makefile b/ftp/py-pyftpdlib/Makefile index bc853c0a0a8b..ec6b9b00de66 100644 --- a/ftp/py-pyftpdlib/Makefile +++ b/ftp/py-pyftpdlib/Makefile @@ -7,6 +7,7 @@ PORTNAME= pyftpdlib PORTVERSION= 0.7.0 +PORTREVISION= 1 CATEGORIES= ftp python MASTER_SITES= GOOGLE_CODE PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -16,8 +17,26 @@ COMMENT= Python FTP server library LICENSE= MIT -USE_PYTHON= yes -USE_PYDISTUTILS= yes +USE_PYTHON= -2.7 +USE_PYDISTUTILS= easy_install + +OPTIONS_DEFINE= SENDFILE OPENSSL +OPTIONS_DEFAULT= SENDFILE OPENSSL +SENDFILE_DESC= Enable sendfile(2) support +OPENSSL_DESC= Enable FTP over SSL/TLS (RFC4217) + +# Workaround ports infrastructure bug +OPTIONSFILE= ${PORT_DBDIR}/py-${PORTNAME}/options + +.include + +.if ${PORT_OPTIONS:MSENDFILE} +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}pysendfile>0:${PORTSDIR}/net/py-pysendfile +.endif + +.if ${PORT_OPTIONS:MOPENSSL} +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}openssl>0:${PORTSDIR}/security/py-openssl +.endif EXAMPLESDIR= ${PREFIX}/share/examples/py-${PORTNAME} @@ -27,4 +46,8 @@ post-install: ${CP} -R ${WRKSRC}/demo/ ${EXAMPLESDIR} .endif +test: build + ${TOUCH} ${WRKSRC}/test/__init__.py + cd ${WRKSRC} && ${PYTHON_CMD} ${PYSETUP} test + .include diff --git a/ftp/py-pyftpdlib/files/patch-setup.py b/ftp/py-pyftpdlib/files/patch-setup.py index d79d34fa39aa..7fc6b80d89a1 100644 --- a/ftp/py-pyftpdlib/files/patch-setup.py +++ b/ftp/py-pyftpdlib/files/patch-setup.py @@ -1,14 +1,11 @@ ---- ./setup.py.orig 2012-06-15 22:18:19.000000000 +1000 -+++ ./setup.py 2012-06-15 22:18:34.000000000 +1000 -@@ -38,10 +38,7 @@ +--- ./setup.py.orig 2012-01-26 06:31:16.000000000 +1100 ++++ ./setup.py 2012-09-15 01:20:41.000000000 +1000 +@@ -83,6 +83,8 @@ + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + ], ++ test_suite='test', ++ zip_safe=False, + ) - import os - import sys --try: -- from setuptools import setup --except ImportError: -- from distutils.core import setup -+from distutils.core import setup - - name = 'pyftpdlib' - version = '0.7.0' + if os.name == 'posix': diff --git a/ftp/py-pyftpdlib/files/patch-test__test_contrib.py b/ftp/py-pyftpdlib/files/patch-test__test_contrib.py new file mode 100644 index 000000000000..769523747c0c --- /dev/null +++ b/ftp/py-pyftpdlib/files/patch-test__test_contrib.py @@ -0,0 +1,26 @@ +--- ./test/test_contrib.py.orig 2012-01-26 05:16:27.000000000 +1100 ++++ ./test/test_contrib.py 2012-09-15 01:25:10.000000000 +1000 +@@ -37,6 +37,7 @@ + import ftplib + import unittest + import os ++import sys + import random + import string + import warnings +@@ -56,10 +57,15 @@ + except ImportError: + pass + ++#Path hacks ++sys.path.insert(0, os.path.abspath('..')) + from pyftpdlib import ftpserver + from pyftpdlib.contrib import authorizers + from pyftpdlib.contrib import handlers + from pyftpdlib.contrib import filesystems ++ ++#More hacks ++sys.path.append('.') + from test_ftpd import * + + diff --git a/ftp/py-pyftpdlib/files/patch-test__test_ftpd.py b/ftp/py-pyftpdlib/files/patch-test__test_ftpd.py new file mode 100644 index 000000000000..31cbedc2e379 --- /dev/null +++ b/ftp/py-pyftpdlib/files/patch-test__test_ftpd.py @@ -0,0 +1,11 @@ +--- ./test/test_ftpd.py.orig 2012-01-26 05:16:27.000000000 +1100 ++++ ./test/test_ftpd.py 2012-09-15 01:25:53.000000000 +1000 +@@ -77,6 +77,8 @@ + except ImportError: + sendfile = None + ++#Path hacks ++sys.path.insert(0, os.path.abspath('..')) + from pyftpdlib import ftpserver + + diff --git a/ftp/py-pyftpdlib/pkg-plist b/ftp/py-pyftpdlib/pkg-plist index 1c3e5728f102..cbf160d81eb6 100644 --- a/ftp/py-pyftpdlib/pkg-plist +++ b/ftp/py-pyftpdlib/pkg-plist @@ -1,21 +1,26 @@ -%%PYTHON_SITELIBDIR%%/pyftpdlib/__init__.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/__init__.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/__init__.pyo -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/__init__.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/__init__.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/__init__.pyo -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/authorizers.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/authorizers.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/authorizers.pyo -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/filesystems.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/filesystems.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/filesystems.pyo -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/handlers.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/handlers.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/contrib/handlers.pyo -%%PYTHON_SITELIBDIR%%/pyftpdlib/ftpserver.py -%%PYTHON_SITELIBDIR%%/pyftpdlib/ftpserver.pyc -%%PYTHON_SITELIBDIR%%/pyftpdlib/ftpserver.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO/PKG-INFO +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO/SOURCES.txt +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO/dependency_links.txt +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO/not-zip-safe +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO/top_level.txt +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/__init__.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/__init__.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/__init__.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/__init__.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/__init__.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/__init__.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/authorizers.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/authorizers.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/authorizers.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/filesystems.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/filesystems.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/filesystems.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/handlers.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/handlers.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib/handlers.pyo +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/ftpserver.py +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/ftpserver.pyc +%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/ftpserver.pyo %%PORTEXAMPLES%%%%EXAMPLESDIR%%/anti_flood_ftpd.py %%PORTEXAMPLES%%%%EXAMPLESDIR%%/basic_ftpd.py %%PORTEXAMPLES%%%%EXAMPLESDIR%%/keycert.pem @@ -26,5 +31,7 @@ %%PORTEXAMPLES%%%%EXAMPLESDIR%%/unix_ftpd.py %%PORTEXAMPLES%%%%EXAMPLESDIR%%/winnt_ftpd.py %%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%% -@dirrm %%PYTHON_SITELIBDIR%%/pyftpdlib/contrib -@dirrm %%PYTHON_SITELIBDIR%%/pyftpdlib +@dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib/contrib +@dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/pyftpdlib +@dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/EGG-INFO +@dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%