Help with porting Python libraries
Andrea Venturoli
ml at netfence.it
Tue Dec 31 18:01:58 UTC 2019
On 2019-12-30 03:26, Kubilay Kocak wrote:
Thanks to all that replied.
Especially the link to Python Ports Policy & Guidelines/Tips was very
useful, as I hadn't found this myself :(
I tried to follow all your suggestions, but I'm having some problems
with it...
Using CHEESESHOP
I removed USE_GITHUB, GH_ACCOUNT and GH_PROJECT, and added
"MASTER_SITES= CHEESESHOP".
However, running make makesum I get:
> # make makesum
> ===> License BSD3CLAUSE accepted by the user
> ===> License BSD3CLAUSE accepted by the user
> ===> py36-imapclient-2.1.0 depends on file: /usr/local/sbin/pkg - found
> => imapclient-2.1.0.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
> => Attempting to fetch https://files.pythonhosted.org/packages/source/i/imapclient/imapclient-2.1.0.tar.gz
> fetch: https://files.pythonhosted.org/packages/source/i/imapclient/imapclient-2.1.0.tar.gz: Not Found
> => Attempting to fetch https://pypi.org/packages/source/i/imapclient/imapclient-2.1.0.tar.gz
> fetch: https://pypi.org/packages/source/i/imapclient/imapclient-2.1.0.tar.gz: Not Found
> => Attempting to fetch http://distcache.FreeBSD.org/ports-distfiles/imapclient-2.1.0.tar.gz
> fetch: http://distcache.FreeBSD.org/ports-distfiles/imapclient-2.1.0.tar.gz: Not Found
> => Couldn't fetch it - please try to retrieve this
> => port manually into /usr/ports/distfiles/ and try again.
> *** Error code 1
I'm not just into it enought to understand what I have to do to solve.
Tests
In setup.py, I see:
> test_deps = ['mock>=1.3.0; python_version < "3.4"']
I think I have to put in Makefile:
> TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mock>1.3.0:devel/py-mock@${PY_FLAVOR}
However I don't know how to handle that <"3.4"...
Then I wrote:
> do-test:
> @cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test
Is this correct?
Finally, tests fail:
> # make test
> ===> Patching for py36-imapclient-2.1.0
> ===> py36-imapclient-2.1.0 depends on package: py36-setuptools>0 - found
> ===> py36-imapclient-2.1.0 depends on file: /usr/local/bin/python3.6 - found
> ...
> test_invalid (tests.test_datetime_util.TestParsing) ... ok
> test_rfc822_style (tests.test_datetime_util.TestParsing) ... ok
>
> ======================================================================
> FAIL: test_redacted_password (tests.test_imapclient.TestDebugLogging)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/usr/ports/mail/py-IMAPClient/work-py36/imapclient-2.1.0/tests/test_imapclient.py", line 521, in test_redacted_password
> extra={}
> File "/usr/local/lib/python3.6/unittest/mock.py", line 824, in assert_called_once_with
> raise AssertionError(msg)
> AssertionError: Expected '_log' to be called once. Called 0 times.
>
> ----------------------------------------------------------------------
> Ran 254 tests in 0.115s
>
> FAILED (failures=1)
> Test failed: <unittest.runner.TextTestResult run=254 errors=0 failures=1>
> error: Test failed: <unittest.runner.TextTestResult run=254 errors=0 failures=1>
> *** Error code 1
>
> Stop.
> make: stopped in /usr/ports/mail/py-IMAPClient
Is this my fault, a problem upstream, a problem in some dependency?
Docs
I'm trying to learn by example, here, so I looked at a couple of ports
and came up with the Makefile I'll post at the end.
Troubles:
_ this way, documentation files are not in the plist, and "port test"
obviously complains.
_ Documentation files are not versioned: do I need to use "concurrent" then?
_ If I run "port test" without py36-sphinx installed, it doesn't work;
shouldn't it install this as a dependency (and remove it afterwards)?
bye & Thanks
av.
> # $FreeBSD$
>
> PORTNAME= imapclient
> PORTVERSION= 2.1.0
> CATEGORIES= mail python
> #MASTER_SITES= CHEESESHOP
> PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
>
> MAINTAINER= ml at netfence.it
> COMMENT= Easy-to-use, Pythonic and complete IMAP client library
>
> LICENSE= BSD3CLAUSE
> LICENSE_FILE= ${WRKSRC}/COPYING
>
> RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}
> TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mock>1.3.0:devel/py-mock@${PY_FLAVOR}
>
> USES= python:2.7-3.7
> USE_GITHUB= yes
> USE_PYTHON= autoplist distutils
> GH_ACCOUNT= mjs
> GH_PROJECT= imapclient
> NO_ARCH= yes
>
> OPTIONS_DEFINE= DOCS
>
> DOCS_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=0:textproc/py-sphinx@${PY_FLAVOR}
> DOCS_VARS= PYDISTUTILS_BUILD_TARGET+="build_sphinx -a -E"
>
> post-install-DOCS-on:
> @${MKDIR} ${STAGEDIR}${DOCSDIR}
> (cd ${WRKSRC}/doc/html && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} "! -name .buildinfo -and ! -name objects.inv")
>
> do-test:
> @cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test
>
> .include <bsd.port.mk>
More information about the freebsd-python
mailing list