Re: Help with porting Python libraries

2019-12-31 Thread Andrea Venturoli

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: 
error: Test failed: 
*** 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= m...@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 

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: Help with porting Python libraries

2019-12-29 Thread Kubilay Kocak

On 30/12/2019 4:54 am, Andrea Venturoli wrote:

Hi Andrea, nice first job on a Python port :)


# $FreeBSD$

PORTNAME=    IMAPClient


Lowercase this PORTNAME


PORTVERSION=    2.1.0
CATEGORIES=    mail python
PKGNAMEPREFIX=    ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= m...@netfence.it
COMMENT=    Easy-to-use, Pythonic and complete IMAP client library

LICENSE=    BSD3CLAUSE


Add LICENSE_FILE pointing to license file if one exists in the source 
download


Both the PyPI sdist (MASTER_SITES=CHEESESHOP) and the GitHub repo have 
one: "COPYING"


RUN_DEPENDS=    ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}

GH_ACCOUNT=    mjs
GH_PROJECT=    imapclient

NO_ARCH=    yes
USES=    python
USE_GITHUB=    yes


Use MASTER_SITES=CHEESESHOP if the project uploads a source tarball 
("sdist") there, unless there's a compelling temporary reason to use an 
alternative source, like missing license files, test files, etc.



USE_PYTHON=    autoplist distutils

.include 


For details Python Ports Policy & Guidelines/Tips:

https://wiki.freebsd.org/Python/PortsPolicy

If it doesn't answer any questions, needs clarifications or additions, 
let us know


If you need further help or just want to hang out, we have a 
#freebsd-python channel on freenode IRC, come and say hi :)


./koobs




___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: Help with porting Python libraries

2019-12-29 Thread Charlie Li via freebsd-ports
Andrea Venturoli wrote:
> I've got a system where I had to install a few Python libraries with
> pip, but I don't like this, since pkg info will not list them.
> 
> Thus I'm trying to port them, but I never ported Python libraries
> before; so, before I submit my work, I thought I'd ask if someone more
> experienced than me might have a look at it.
> 
> My first attempt was at IMAPClient: I copied another port
> (net/py-GeoIP2) and modified it; this is the Makefile I came up with.
> 
>> # $FreeBSD$
>>
>> PORTNAME=    IMAPClient
>> PORTVERSION=    2.1.0
>> CATEGORIES=    mail python
>> PKGNAMEPREFIX=    ${PYTHON_PKGNAMEPREFIX}
>>
>> MAINTAINER=    m...@netfence.it
>> COMMENT=    Easy-to-use, Pythonic and complete IMAP client library
>>
>> LICENSE=    BSD3CLAUSE
>>
>> RUN_DEPENDS=    ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}
>>
>> GH_ACCOUNT=    mjs
>> GH_PROJECT=    imapclient
>>
>> NO_ARCH=    yes
>> USES=    python
>> USE_GITHUB=    yes
>> USE_PYTHON=    autoplist distutils
>>
>> .include 
> 
> "port test" gives some warning, but seems to say it's ok.
> Anything wrong?
> 
Since you said you installed these Python packages with pip, they are
probably on pypi. In that case, it is recommended to use CHEESESHOP as
the MASTER_SITE (cheeseshop is the old name for pypi itself) instead of
going through github.

Also recommend reading through the documentation in the "Using Python"
chapter in the Porter's Handbook and the comments in Uses/python.mk to
really understand everything you're doing.

-- 
Charlie Li
…nope, still don't have an exit line.

(This email address is for mailing list use; replace local-part with
vishwin for off-list communication if possible)



signature.asc
Description: OpenPGP digital signature


Re: Help with porting Python libraries

2019-12-29 Thread Kurt Jaeger
Hi!

> I've got a system where I had to install a few Python libraries with pip,
> but I don't like this, since pkg info will not list them.
> 
> Thus I'm trying to port them, but I never ported Python libraries before;
> so, before I submit my work, I thought I'd ask if someone more
> experienced than me might have a look at it.

> My first attempt was at IMAPClient: I copied another port (net/py-GeoIP2)
> and modified it; this is the Makefile I came up with.
[...]

Thanks. If you test it with portlint -AC and re-arrange a few
lines, portlint will report 'looks fine.' A testbuild with poudriere
worked fine.

USES before the rest of the lines, and it's silent:

USES=   python
USE_GITHUB= yes
USE_PYTHON= autoplist distutils
GH_ACCOUNT= mjs
GH_PROJECT= imapclient
NO_ARCH=yes

-- 
p...@opsec.eu+49 171 3101372One year to go !
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Help with porting Python libraries

2019-12-29 Thread Andrea Venturoli

Hello.

I've got a system where I had to install a few Python libraries with 
pip, but I don't like this, since pkg info will not list them.


Thus I'm trying to port them, but I never ported Python libraries 
before; so, before I submit my work, I thought I'd ask if someone more 
experienced than me might have a look at it.


My first attempt was at IMAPClient: I copied another port 
(net/py-GeoIP2) and modified it; this is the Makefile I came up with.



# $FreeBSD$

PORTNAME=   IMAPClient
PORTVERSION=2.1.0
CATEGORIES= mail python
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= m...@netfence.it
COMMENT=Easy-to-use, Pythonic and complete IMAP client library

LICENSE=BSD3CLAUSE

RUN_DEPENDS=${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}

GH_ACCOUNT= mjs
GH_PROJECT= imapclient

NO_ARCH=yes
USES=   python
USE_GITHUB= yes
USE_PYTHON= autoplist distutils

.include 


"port test" gives some warning, but seems to say it's ok.
Anything wrong?

 bye & TIA
av.
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"