Solved Trying to port pyznap

Duffyx

Member

Thanks: 14
Messages: 51

#1
Hello guys,

I'm trying to port a simple python program but I can't seem to get to a point where it compiles the python program.
This is what I have for now:
Code:
# $FreeBSD$

PORTNAME=        pyznap
PORTVERSION=        1.0.2
DISTVERSIONPREFIX=    v
CATEGORIES=        sysutils
PKGNAME_PREFIX=        ${PYTHON_PKGNAMEPREFIX}

MAINTAINER=    blabla@gmail.com
COMMENT=    ZFS snapshot tool written in python

LICENSE=    GPLv3
LICENSE_FILE=    ${WRKSRC}/LICENSE

RUN_DEPENDS=    ${PYTHON_PKGNAMEPREFIX}configparser>3.5.0:devel/py-configparser@${PY_FLAVOR} \
        ${PYTHON_PKGNAMEPREFIX}paramiko>=2.4.1:security/py-paramiko@${PY_FLAVOR} \
        mbuffer:misc/mbuffer

USES=        python:3.5+
USES_PYTHON=    allflavors autoplist distutils

USE_GITHUB=    yes
GH_ACCOUNT=    yboetz

NO_ARCH=    yes
SUB_FILES=    pkg-message

post-patch:
    @${REINPLACE_CMD} -e 's|/etc/pyznap/|${LOCALBASE}/etc/|' ${WRKSRC}/${PORTNAME}/main.py

.include <bsd.port.mk>
It fails in the build phase as shown below:

Code:
# make stage
===>  License GPLv3 accepted by the user
===>   pyznap-1.0.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by pyznap-1.0.2 for building
===>  Extracting for pyznap-1.0.2
=> SHA256 Checksum OK for yboetz-pyznap-v1.0.2_GH0.tar.gz.
===>  Patching for pyznap-1.0.2
===>   pyznap-1.0.2 depends on file: /usr/local/bin/python3.6 - found
===>  Configuring for pyznap-1.0.2
===>  Building for pyznap-1.0.2
--- clean ---
--- install-dev ---
--- clean ---
rm -f -r build/
--- install-dev ---
pip install -e .[dev]
sh: pip: not found
*** [install-dev] Error code 127

make[1]: stopped in /root/pyznap/work/pyznap-1.0.2
--- clean ---
rm -f -r dist/
rm -f -r pyznap/__pycache__/
rm -f -r tests/__pycache__
rm -f -r pyznap.egg-info/
rm -f -r .pytest_cache/
1 error

make[1]: stopped in /root/pyznap/work/pyznap-1.0.2
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /root/pyznap
#
Could anyone shed some light :)? Thanks

PS: I noticed the github repo contains a Makefile which I don't find in other popular python github repo's.
It seems like make is trying to pick up that Makefile? Even though I set all proper variables for a python port.
https://github.com/yboetz/pyznap
 

droeders

New Member

Thanks: 4
Messages: 9

#2
Hello guys,

I'm trying to port a simple python program but I can't seem to get to a point where it compiles the python program.
This is what I have for now:
Code:
# $FreeBSD$

....

It fails in the build phase as shown below:

[CODE]# make stage
===>  License GPLv3 accepted by the user
===>   pyznap-1.0.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by pyznap-1.0.2 for building
===>  Extracting for pyznap-1.0.2
=> SHA256 Checksum OK for yboetz-pyznap-v1.0.2_GH0.tar.gz.
===>  Patching for pyznap-1.0.2
===>   pyznap-1.0.2 depends on file: /usr/local/bin/python3.6 - found
===>  Configuring for pyznap-1.0.2
===>  Building for pyznap-1.0.2
--- clean ---
--- install-dev ---
--- clean ---
rm -f -r build/
--- install-dev ---
pip install -e .[dev]
sh: pip: not found
*** [install-dev] Error code 127

#
Looks like you're missing pip, which is used to install Python packages/tools. I think if you install the FreeBSD package/port named py27-pip or py36-pip (depending on which Python version you're using), this will fix your error.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,424
Messages: 27,742

#3
I can't seem to get to a point where it compiles the python program.
Python is an interpreted language, there's nothing to compile.

Porter's handbook: 6.17. Using Python

Looks like you're missing pip, which is used to install Python packages/tools. I think if you install the FreeBSD package/port named py27-pip or py36-pip (depending on which Python version you're using), this will fix your error.
Ports are not allowed to "sideload" additional modules or code. All dependencies must be resolvable to ports.
 
OP
OP
Duffyx

Duffyx

Member

Thanks: 14
Messages: 51

#4
Yea fine my wording wasnt on point there ;p Python is an interpreted language.

What I mean is that I can't seem to get past the build stage.

Below is the build target from http://svn.freebsd.org/ports/head/Mk/Uses/python.mk when using python variables.
Code:
.if !target(do-build)

do-build:

    @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS})

.endif
These should all be set by the variables in the makefile and default values that should work... :/
EDIT: When I expand the above expression manually it works just fine ..
EDIT: I am such a fucking idiot :D It wasnt picking up the python stuff because;
USES_PYTHON= allflavors autoplist distutils
should be
USE_PYTHON= allflavors autoplist distutils
 
Top