- 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 <koobs.freebsd@gmail.com>
This commit is contained in:
Li-Wen Hsu 2012-09-22 14:04:11 +00:00
parent 4095fe36df
commit 74ca516d44
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=304675
5 changed files with 99 additions and 35 deletions

View File

@ -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 <bsd.port.options.mk>
.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 <bsd.port.mk>

View File

@ -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':

View File

@ -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 *

View File

@ -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

View File

@ -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%%