Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2018 11:22:49 -0800
From:      John Baldwin <jhb@FreeBSD.org>
To:        Michael Gmelin <grembo@freebsd.org>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: Best way to deal with .pyc files?
Message-ID:  <d24044c0-b620-f7fa-63e6-bc446134c988@FreeBSD.org>
In-Reply-To: <b37ea393-6321-826d-7c31-153a0822de87@FreeBSD.org>
References:  <f2c1b368-cd2e-85a3-a5c7-794d69204625@FreeBSD.org> <8D6D9096-468D-4E69-A6F2-79142C52395C@freebsd.org> <b37ea393-6321-826d-7c31-153a0822de87@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12/7/18 10:17 AM, John Baldwin wrote:
> On 12/6/18 11:17 AM, Michael Gmelin wrote:
>>
>>
>>> On 6. Dec 2018, at 19:21, John Baldwin <jhb@freebsd.org> wrote:
>>>
>>> The devel/gdb port installs python scripts into /usr/local/share/gdb<ver>/python.
>>> If you then run kgdb as root (not that unusual), it will generate .pyc files in
>>> those directories that are not deleted by 'pkg delete'.  What is the best way to
>>> handle this case?  Should the pkg-plist include @rmtry entries for each pyc
>>> file or is there a better way?
>>>
>>
>> Pre-generate the pyc files on package build and install them with the port, so they become part of plist (there are examples of that in the ports tree, whenever possible for both py27 and py3x).
> 
> Ok.  One follow-up question.  GDB's python bindings work with both py2 and
> py3, but the bindings are optional.  Right now PYTHON is a port option
> (but on by default).  If I wanted to add flavors I would probably want them
> to be conditional on the option, so the results would be 'gdb' and
> 'gdb-py3' packages by default, but if someone was using poudriere locally
> and disabled python, I would only want to build a single 'gdb' without
> python.  So, can I make the flavors conditional on an option or is it too
> late to define flavors after including bsd.ports.options.mk?
> 
> That is, can I do something this:
> 
> OPTIONS_DEFINE= PYTHON
> OPTIONS_DEFAULT= PYTHON
> 
> .include <bsd.port.pre.mk>
> 
> .if ${PORT_OPTIONS:MPYTHON}
> USES_PYTHON= flavors
> .endif

FYI, this worked:

OPTIONS_DEFINE=	DEBUG GDB_LINK GUILE KGDB NLS PYTHON TUI

OPTIONS_DEFAULT=	GDB_LINK KGDB NLS PYTHON TUI PORT_READLINE PORT_ICONV SYSTEM_ZLIB

...

PYTHON_USES=		python

...

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON=	flavors
.endif

.include <bsd.port.pre.mk>

-- 
John Baldwin

                                                                            



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d24044c0-b620-f7fa-63e6-bc446134c988>