Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2020 14:46:55 +1000
From:      Kubilay Kocak <koobs@FreeBSD.org>
To:        Gleb Popov <arrowd@freebsd.org>, python@freebsd.org
Subject:   Re: How to package .pyc files
Message-ID:  <836f4710-cfa6-911a-48be-246912c702c3@FreeBSD.org>
In-Reply-To: <CALH631n3GeN9Jios-kiODLcxq63ckmZLRngA63VR86UpANar3Q@mail.gmail.com>
References:  <CALH631m7qWS7aiLhi8kFeZx0pOTU7KFjy8CHoe1VJ2zqvtdZWA@mail.gmail.com> <CALH631n3GeN9Jios-kiODLcxq63ckmZLRngA63VR86UpANar3Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/09/2020 4:46 am, Gleb Popov wrote:
> On Mon, Aug 31, 2020 at 9:45 PM Gleb Popov <arrowd@freebsd.org> wrote:
> 
>> Hello. I'm fiddling with the devel/mercurial port (
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242463 ). The current
>> Makefile results in
>>
>> Error: Orphaned: %%PYTHON_SITELIBDIR%%/mercurial/__modulepolicy__.py
>> Error: Orphaned:
>> %%PYTHON_SITELIBDIR%%/mercurial/__pycache__/__modulepolicy__.cpython-37.opt-1.pyc
>> Error: Orphaned:
>> %%PYTHON_SITELIBDIR%%/mercurial/__pycache__/__modulepolicy__.cpython-37.pyc
>>
>> errors. However, adding these files into pkg-plist seems a bit hard - it
>> requires %%PYTHON_VER%% subst and a special treatment for python2 case.
>> Which made me wonder - should these files be packaged at all? If yes, maybe
>> there is some simple solution I'm missing?


Yes, just add them to pkg-plist (while using USE_PYTHON=autoplist to 
handle the rest automatically)

>> Thanks in advance.
>>
> 
> Inspecting ${WRKDIR}/.PLIST* files after the build revealed that all other
> .pyc files are correctly added to the plist. So, there is something special
> about this __modulepolicy__.py file. I'm tempted to simply remove it on
> post-install.

They are handled specially (see setup.py)

The root cause and outcome of that special handling (overriding the 
default setuptools build/install classes) is that those files are not 
added to setuptools --record output (the list of files that a package 
installs), which our framework uses to produce the pkg-plist

This ultimately needs to be resolved by upstream, such that those files 
are added to the list correctly, as they should be.

See examples of "get_outputs" use in setup.py files in github, like:

https://github.com/Nevisor/Client/blob/master/ScriptLib/Python-2.2/Tools/idle/setup.py#L41



> Any ideas?





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?836f4710-cfa6-911a-48be-246912c702c3>