Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jul 2021 02:25:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 257041] [NEW PORT]: devel/py-lief: Parse, modify and abstract ELF, PE and MachO formats.
Message-ID:  <bug-257041-7788-PkmA34Mgxx@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-257041-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-257041-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257041

Fukang Chen <loader@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loader@FreeBSD.org

--- Comment #6 from Fukang Chen <loader@FreeBSD.org> ---
It's unable to generate a correct ${_PYTHONPKGLIST} with USE_PYTHON=3Dautop=
list=20

# make check-plist
=3D=3D=3D=3D> Checking for pkg-plist issues (check-plist)
=3D=3D=3D> Parsing plist
=3D=3D=3D> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%PYTHON_SITELIBDIR%%/lief%%PYTHON_EXT_SUFFIX%%.so
=3D=3D=3D> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%PYTHON_SITELIBDIR%%/.11.5/lief%%PYTHON_EXT_SUFFIX%%.so
=3D=3D=3D> Error: Plist issues found.
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-lief

There's a weird path in ${_PYTHONPKGLIST}:
/usr/local/lib/python3.8/site-packages/.11.5/lief.cpython-38.so

The weird path was caused by _mutate_outputs() in
distutils/command/install_lib.py:
https://github.com/python/cpython/blob/v3.8.10/Lib/distutils/command/instal=
l_lib.py#L143-L156
   143      def _mutate_outputs(self, has_any, build_cmd, cmd_option,
output_dir):
   144          if not has_any:
   145              return []
   146
   147          build_cmd =3D self.get_finalized_command(build_cmd)
   148          build_files =3D build_cmd.get_outputs()
   149          build_dir =3D getattr(build_cmd, cmd_option)
   150
   151          prefix_len =3D len(build_dir) + len(os.sep)
   152          outputs =3D []
   153          for file in build_files:
   154              outputs.append(os.path.join(output_dir, file[prefix_len=
:]))
   155
   156          return outputs

on my 14.0-CURRENT aarch64:

build_dir =3D> build/lib.freebsd-14.0-CURRENT-arm64-3.8
file =3D> /usr/ports/devel/py-lief/work-py38/LIEF-0.11.5/lief.cpython-38.so
prefix_len =3D> len(build_dir) + len(os.sep) =3D> 40 + 1 =3D> 41
file[prefix_len:] =3D> .11.5/lief.cpython-38.so
output_dir =3D>
/usr/ports/devel/py-lief/work-py38/stage/usr/local/lib/python3.8/site-packa=
ges/

os.path.join(output_dir, file[prefix_len:]) =3D>
/usr/ports/devel/py-lief/work-py38/stage/usr/local/lib/python3.8/site-packa=
ges/.11.5/lief.cpython-38.so

It looks like we are supposed to get a file name
build/lib.freebsd-14.0-CURRENT-arm64-3.8/lief.cpython-38.so
instead of=20
/usr/ports/devel/py-lief/work-py38/LIEF-0.11.5/lief.cpython-38.so

https://github.com/python/cpython/blob/v3.8.10/Lib/distutils/command/build_=
ext.py#L637-L664
   637      # -- Name generators
-----------------------------------------------
   638      # (extension names, filenames, whatever)
   639      def get_ext_fullpath(self, ext_name):
   640          """Returns the path of the filename for a given extension.
   641
   642          The file is located in `build_lib` or directly in the packa=
ge
   643          (inplace option).
   644          """
   645          fullname =3D self.get_ext_fullname(ext_name)
   646          modpath =3D fullname.split('.')
   647          filename =3D self.get_ext_filename(modpath[-1])
   648
   649          if not self.inplace:
   650              # no further work needed
   651              # returning :
   652              #   build_dir/package/path/filename
   653              filename =3D os.path.join(*modpath[:-1]+[filename])
   654              return os.path.join(self.build_lib, filename)
   655
   656          # the inplace option requires to find the package directory
   657          # using the build_py command for that
   658          package =3D '.'.join(modpath[0:-1])
   659          build_py =3D self.get_finalized_command('build_py')
   660          package_dir =3D
os.path.abspath(build_py.get_package_dir(package))
   661
   662          # returning
   663          #   package_dir/filename
   664          return os.path.join(package_dir, filename)

inplace =3D=3D 0
get_ext_fullpath(ext.name) =3D>=20
build/lib.freebsd-14.0-CURRENT-arm64-3.8/lief.cpython-38.so

inplace =3D=3D 1
get_ext_fullpath(ext.name) =3D>=20
/usr/ports/devel/py-lief/work-py38/LIEF-0.11.5/lief.cpython-38.so

We could change the inlpace value to 0 in ${WRKSRC}/setup.cfg,
this should make USE_PYTHON=3Dautoplist work:

post-patch:
        @${REINPLACE_CMD} -e 's|^inplace=3D1|inplace=3D0|' ${WRKSRC}/setup.=
cfg

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-257041-7788-PkmA34Mgxx>